crun-1.16.1/0000755000000000000000000000000014656670214010750 5ustar0000000000000000crun-1.16.1/build-aux/0000755000000000000000000000000014656670213012641 5ustar0000000000000000crun-1.16.1/build-aux/compile0000755000000000000000000001635014656670156014232 0ustar0000000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 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* | MSYS*) 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/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.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 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/build-aux/config.guess0000755000000000000000000012617314656670156015201 0ustar0000000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-08-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 1 2 13 15 trap 'exitcode=$?; test -z "$tmp" || rm -fr "$tmp"; exit $exitcode' 0 set_cc_for_build() { : "${TMPDIR=/tmp}" # shellcheck disable=SC2039 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$driver" break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) UNAME_REL="`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" case `isainfo -b` in 32) echo i386-pc-solaris2"$UNAME_REL" ;; 64) echo x86_64-pc-solaris2"$UNAME_REL" ;; esac exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi else echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf fi exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; *:Minix:*:*) echo "$UNAME_MACHINE"-unknown-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: crun-1.16.1/build-aux/config.sub0000755000000000000000000007530414656670156014643 0ustar0000000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-08-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type IFS="-" read -r field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 os=$maybe_os ;; android-linux) basic_machine=$field1-unknown os=linux-android ;; *) basic_machine=$field1-$field2 os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any patern case $field1-$field2 in decstation-3100) basic_machine=mips-dec os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 os= ;; *) basic_machine=$field1 os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc os=bsd ;; a29khif) basic_machine=a29k-amd os=udi ;; adobe68k) basic_machine=m68010-adobe os=scout ;; alliant) basic_machine=fx80-alliant os= ;; altos | altos3068) basic_machine=m68k-altos os= ;; am29k) basic_machine=a29k-none os=bsd ;; amdahl) basic_machine=580-amdahl os=sysv ;; amiga) basic_machine=m68k-unknown os= ;; amigaos | amigados) basic_machine=m68k-unknown os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=sysv4 ;; apollo68) basic_machine=m68k-apollo os=sysv ;; apollo68bsd) basic_machine=m68k-apollo os=bsd ;; aros) basic_machine=i386-pc os=aros ;; aux) basic_machine=m68k-apple os=aux ;; balance) basic_machine=ns32k-sequent os=dynix ;; blackfin) basic_machine=bfin-unknown os=linux ;; cegcc) basic_machine=arm-unknown os=cegcc ;; convex-c1) basic_machine=c1-convex os=bsd ;; convex-c2) basic_machine=c2-convex os=bsd ;; convex-c32) basic_machine=c32-convex os=bsd ;; convex-c34) basic_machine=c34-convex os=bsd ;; convex-c38) basic_machine=c38-convex os=bsd ;; cray) basic_machine=j90-cray os=unicos ;; crds | unos) basic_machine=m68k-crds os= ;; da30) basic_machine=m68k-da30 os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec os= ;; delta88) basic_machine=m88k-motorola os=sysv3 ;; dicos) basic_machine=i686-pc os=dicos ;; djgpp) basic_machine=i586-pc os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=ose ;; gmicro) basic_machine=tron-gmicro os=sysv ;; go32) basic_machine=i386-pc os=go32 ;; h8300hms) basic_machine=h8300-hitachi os=hms ;; h8300xray) basic_machine=h8300-hitachi os=xray ;; h8500hms) basic_machine=h8500-hitachi os=hms ;; harris) basic_machine=m88k-harris os=sysv3 ;; hp300) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=bsd ;; hp300hpux) basic_machine=m68k-hp os=hpux ;; hppaosf) basic_machine=hppa1.1-hp os=osf ;; hppro) basic_machine=hppa1.1-hp os=proelf ;; i386mach) basic_machine=i386-mach os=mach ;; vsta) basic_machine=i386-pc os=vsta ;; isi68 | isi) basic_machine=m68k-isi os=sysv ;; m68knommu) basic_machine=m68k-unknown os=linux ;; magnum | m3230) basic_machine=mips-mips os=sysv ;; merlin) basic_machine=ns32k-utek os=sysv ;; mingw64) basic_machine=x86_64-pc os=mingw64 ;; mingw32) basic_machine=i686-pc os=mingw32 ;; mingw32ce) basic_machine=arm-unknown os=mingw32ce ;; monitor) basic_machine=m68k-rom68k os=coff ;; morphos) basic_machine=powerpc-unknown os=morphos ;; moxiebox) basic_machine=moxie-unknown os=moxiebox ;; msdos) basic_machine=i386-pc os=msdos ;; msys) basic_machine=i686-pc os=msys ;; mvs) basic_machine=i370-ibm os=mvs ;; nacl) basic_machine=le32-unknown os=nacl ;; ncr3000) basic_machine=i486-ncr os=sysv4 ;; netbsd386) basic_machine=i386-pc os=netbsd ;; netwinder) basic_machine=armv4l-rebel os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=newsos ;; news1000) basic_machine=m68030-sony os=newsos ;; necv70) basic_machine=v70-nec os=sysv ;; nh3000) basic_machine=m68k-harris os=cxux ;; nh[45]000) basic_machine=m88k-harris os=cxux ;; nindy960) basic_machine=i960-intel os=nindy ;; mon960) basic_machine=i960-intel os=mon960 ;; nonstopux) basic_machine=mips-compaq os=nonstopux ;; os400) basic_machine=powerpc-ibm os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=ose ;; os68k) basic_machine=m68k-none os=os68k ;; paragon) basic_machine=i860-intel os=osf ;; parisc) basic_machine=hppa-unknown os=linux ;; pw32) basic_machine=i586-unknown os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=rdos ;; rdos32) basic_machine=i386-pc os=rdos ;; rom68k) basic_machine=m68k-rom68k os=coff ;; sa29200) basic_machine=a29k-amd os=udi ;; sei) basic_machine=mips-sei os=seiux ;; sequent) basic_machine=i386-sequent os= ;; sps7) basic_machine=m68k-bull os=sysv2 ;; st2000) basic_machine=m68k-tandem os= ;; stratus) basic_machine=i860-stratus os=sysv4 ;; sun2) basic_machine=m68000-sun os= ;; sun2os3) basic_machine=m68000-sun os=sunos3 ;; sun2os4) basic_machine=m68000-sun os=sunos4 ;; sun3) basic_machine=m68k-sun os= ;; sun3os3) basic_machine=m68k-sun os=sunos3 ;; sun3os4) basic_machine=m68k-sun os=sunos4 ;; sun4) basic_machine=sparc-sun os= ;; sun4os3) basic_machine=sparc-sun os=sunos3 ;; sun4os4) basic_machine=sparc-sun os=sunos4 ;; sun4sol2) basic_machine=sparc-sun os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun os= ;; sv1) basic_machine=sv1-cray os=unicos ;; symmetry) basic_machine=i386-sequent os=dynix ;; t3e) basic_machine=alphaev5-cray os=unicos ;; t90) basic_machine=t90-cray os=unicos ;; toad1) basic_machine=pdp10-xkl os=tops20 ;; tpf) basic_machine=s390x-ibm os=tpf ;; udi29k) basic_machine=a29k-amd os=udi ;; ultra3) basic_machine=a29k-nyu os=sym1 ;; v810 | necv810) basic_machine=v810-nec os=none ;; vaxv) basic_machine=vax-dec os=sysv ;; vms) basic_machine=vax-dec os=vms ;; vxworks960) basic_machine=i960-wrs os=vxworks ;; vxworks68) basic_machine=m68k-wrs os=vxworks ;; vxworks29k) basic_machine=a29k-wrs os=vxworks ;; xbox) basic_machine=i686-pc os=mingw32 ;; ymp) basic_machine=ymp-cray os=unicos ;; *) basic_machine=$1 os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi os=${os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray os=${os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $os in irix*) ;; *) os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony os=newsos ;; next | m*-next) cpu=m68k vendor=next case $os in nextstep* ) ;; ns2*) os=nextstep2 ;; *) os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde os=${os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) IFS="-" read -r cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x$os != x ] then case $os in # First match some system type aliases that might get confused # with valid system types. # solaris* is a basic system type, with this one exception. auroraux) os=auroraux ;; bluegene*) os=cnk ;; solaris1 | solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; solaris) os=solaris2 ;; unixware*) os=sysv4.2uw ;; gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) es1800*) os=ose ;; # Some version numbers need modification chorusos*) os=chorusos ;; isc) os=isc2.2 ;; sco6) os=sco5v6 ;; sco5) os=sco3.2v5 ;; sco4) os=sco3.2v4 ;; sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` ;; sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; scout) # Don't match below ;; sco*) os=sco3.2v2 ;; psos*) os=psos ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # sysv* is not here because it comes later, after sysvr4. gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | kopensolaris* | plan9* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | knetbsd* | mirbsd* | netbsd* \ | bitrig* | openbsd* | solidbsd* | libertybsd* \ | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ | chorusrdb* | cegcc* | glidix* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ | linux-newlib* | linux-musl* | linux-uclibc* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ | interix* | uwin* | mks* | rhapsody* | darwin* \ | openstep* | oskit* | conix* | pw32* | nonstopux* \ | storm-chaos* | tops10* | tenex* | tops20* | its* \ | os2* | vos* | palmos* | uclinux* | nucleus* \ | morphos* | superux* | rtmk* | windiss* \ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; qnx*) case $cpu in x86 | i*86) ;; *) os=nto-$os ;; esac ;; hiux*) os=hiuxwe2 ;; nto-qnx*) ;; nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; sim | xray | os68k* | v88r* \ | windows* | osx | abug | netware* | os9* \ | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) ;; linux-dietlibc) os=linux-dietlibc ;; linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; lynx*178) os=lynxos178 ;; lynx*5) os=lynxos5 ;; lynx*) os=lynxos ;; mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; opened*) os=openedition ;; os400*) os=os400 ;; sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; wince*) os=wince ;; utek*) os=bsd ;; dynix*) os=bsd ;; acis*) os=aos ;; atheos*) os=atheos ;; syllable*) os=syllable ;; 386bsd) os=bsd ;; ctix* | uts*) os=sysv ;; nova*) os=rtmk-nova ;; ns2) os=nextstep2 ;; nsk*) os=nsk ;; # Preserve the version number of sinix5. sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; sinix*) os=sysv4 ;; tpf*) os=tpf ;; triton*) os=sysv3 ;; oss*) os=sysv3 ;; svr4*) os=sysv4 ;; svr3) os=sysv3 ;; sysvr4) os=sysv4 ;; # This must come after sysvr4. sysv*) ;; ose*) os=ose ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) os=mint ;; zvmoe) os=zvmoe ;; dicos*) os=dicos ;; pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $cpu in arm*) os=eabi ;; *) os=elf ;; esac ;; nacl*) ;; ios) ;; none) ;; *-eabi) ;; *) echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $cpu-$vendor in score-*) os=elf ;; spu-*) os=elf ;; *-acorn) os=riscix1.2 ;; arm*-rebel) os=linux ;; arm*-semi) os=aout ;; c4x-* | tic4x-*) os=coff ;; c8051-*) os=elf ;; clipper-intergraph) os=clix ;; hexagon-*) os=elf ;; tic54x-*) os=coff ;; tic55x-*) os=coff ;; tic6x-*) os=coff ;; # This must come before the *-dec entry. pdp10-*) os=tops20 ;; pdp11-*) os=none ;; *-dec | vax-*) os=ultrix4.2 ;; m68*-apollo) os=domain ;; i386-sun) os=sunos4.0.2 ;; m68000-sun) os=sunos3 ;; m68*-cisco) os=aout ;; mep-*) os=elf ;; mips*-cisco) os=elf ;; mips*-*) os=elf ;; or32-*) os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=sysv3 ;; sparc-* | *-sun) os=sunos4.1.1 ;; pru-*) os=elf ;; *-be) os=beos ;; *-ibm) os=aix ;; *-knuth) os=mmixware ;; *-wec) os=proelf ;; *-winbond) os=proelf ;; *-oki) os=proelf ;; *-hp) os=hpux ;; *-hitachi) os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=sysv ;; *-cbm) os=amigaos ;; *-dg) os=dgux ;; *-dolphin) os=sysv3 ;; m68k-ccur) os=rtu ;; m88k-omron*) os=luna ;; *-next) os=nextstep ;; *-sequent) os=ptx ;; *-crds) os=unos ;; *-ns) os=genix ;; i370-*) os=mvs ;; *-gould) os=sysv ;; *-highlevel) os=bsd ;; *-encore) os=bsd ;; *-sgi) os=irix ;; *-siemens) os=sysv4 ;; *-masscomp) os=rtu ;; f30[01]-fujitsu | f700-fujitsu) os=uxpv ;; *-rom68k) os=coff ;; *-*bug) os=coff ;; *-apple) os=macos ;; *-atari*) os=mint ;; *-wrs) os=vxworks ;; *) os=none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $os in riscix*) vendor=acorn ;; sunos*) vendor=sun ;; cnk*|-aix*) vendor=ibm ;; beos*) vendor=be ;; hpux*) vendor=hp ;; mpeix*) vendor=hp ;; hiux*) vendor=hitachi ;; unos*) vendor=crds ;; dgux*) vendor=dg ;; luna*) vendor=omron ;; genix*) vendor=ns ;; clix*) vendor=intergraph ;; mvs* | opened*) vendor=ibm ;; os400*) vendor=ibm ;; ptx*) vendor=sequent ;; tpf*) vendor=ibm ;; vxsim* | vxworks* | windiss*) vendor=wrs ;; aux*) vendor=apple ;; hms*) vendor=hitachi ;; mpw* | macos*) vendor=apple ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) vendor=atari ;; vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: crun-1.16.1/build-aux/depcomp0000755000000000000000000005602014656670156014227 0ustar0000000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/build-aux/install-sh0000755000000000000000000003643514656670156014666 0ustar0000000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2018-03-11.20; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac 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. ;; *) # Note that $RANDOM variable is not portable (e.g. dash); Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p' feature. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_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 && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/build-aux/ltmain.sh0000644000000000000000000117106714656670152014500 0ustar0000000000000000#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.6 package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES 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 . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! 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 # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! 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 ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do eval $_G_hook '"$@"' # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ -specs=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: crun-1.16.1/build-aux/missing0000755000000000000000000001533614656670156014256 0ustar0000000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/build-aux/tap-driver.sh0000755000000000000000000004601314656670156015267 0ustar0000000000000000#! /bin/sh # Copyright (C) 2011-2020 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. # This file is maintained in Automake, please report # bugs to or send patches to # . scriptversion=2013-12-23.17; # UTC # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u me=tap-driver.sh fatal () { echo "$me: fatal: $*" >&2 exit 1 } usage_error () { echo "$me: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat < # trap : 1 3 2 13 15 if test $merge -gt 0; then exec 2>&1 else exec 2>&3 fi "$@" echo $? ) | LC_ALL=C ${AM_TAP_AWK-awk} \ -v me="$me" \ -v test_script_name="$test_name" \ -v log_file="$log_file" \ -v trs_file="$trs_file" \ -v expect_failure="$expect_failure" \ -v merge="$merge" \ -v ignore_exit="$ignore_exit" \ -v comments="$comments" \ -v diag_string="$diag_string" \ ' # TODO: the usages of "cat >&3" below could be optimized when using # GNU awk, and/on on systems that supports /dev/fd/. # Implementation note: in what follows, `result_obj` will be an # associative array that (partly) simulates a TAP result object # from the `TAP::Parser` perl module. ## ----------- ## ## FUNCTIONS ## ## ----------- ## function fatal(msg) { print me ": " msg | "cat >&2" exit 1 } function abort(where) { fatal("internal error " where) } # Convert a boolean to a "yes"/"no" string. function yn(bool) { return bool ? "yes" : "no"; } function add_test_result(result) { if (!test_results_index) test_results_index = 0 test_results_list[test_results_index] = result test_results_index += 1 test_results_seen[result] = 1; } # Whether the test script should be re-run by "make recheck". function must_recheck() { for (k in test_results_seen) if (k != "XFAIL" && k != "PASS" && k != "SKIP") return 1 return 0 } # Whether the content of the log file associated to this test should # be copied into the "global" test-suite.log. function copy_in_global_log() { for (k in test_results_seen) if (k != "PASS") return 1 return 0 } function get_global_test_result() { if ("ERROR" in test_results_seen) return "ERROR" if ("FAIL" in test_results_seen || "XPASS" in test_results_seen) return "FAIL" all_skipped = 1 for (k in test_results_seen) if (k != "SKIP") all_skipped = 0 if (all_skipped) return "SKIP" return "PASS"; } function stringify_result_obj(result_obj) { if (result_obj["is_unplanned"] || result_obj["number"] != testno) return "ERROR" if (plan_seen == LATE_PLAN) return "ERROR" if (result_obj["directive"] == "TODO") return result_obj["is_ok"] ? "XPASS" : "XFAIL" if (result_obj["directive"] == "SKIP") return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL; if (length(result_obj["directive"])) abort("in function stringify_result_obj()") return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL } function decorate_result(result) { color_name = color_for_result[result] if (color_name) return color_map[color_name] "" result "" color_map["std"] # If we are not using colorized output, or if we do not know how # to colorize the given result, we should return it unchanged. return result } function report(result, details) { if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/) { msg = ": " test_script_name add_test_result(result) } else if (result == "#") { msg = " " test_script_name ":" } else { abort("in function report()") } if (length(details)) msg = msg " " details # Output on console might be colorized. print decorate_result(result) msg # Log the result in the log file too, to help debugging (this is # especially true when said result is a TAP error or "Bail out!"). print result msg | "cat >&3"; } function testsuite_error(error_message) { report("ERROR", "- " error_message) } function handle_tap_result() { details = result_obj["number"]; if (length(result_obj["description"])) details = details " " result_obj["description"] if (plan_seen == LATE_PLAN) { details = details " # AFTER LATE PLAN"; } else if (result_obj["is_unplanned"]) { details = details " # UNPLANNED"; } else if (result_obj["number"] != testno) { details = sprintf("%s # OUT-OF-ORDER (expecting %d)", details, testno); } else if (result_obj["directive"]) { details = details " # " result_obj["directive"]; if (length(result_obj["explanation"])) details = details " " result_obj["explanation"] } report(stringify_result_obj(result_obj), details) } # `skip_reason` should be empty whenever planned > 0. function handle_tap_plan(planned, skip_reason) { planned += 0 # Avoid getting confused if, say, `planned` is "00" if (length(skip_reason) && planned > 0) abort("in function handle_tap_plan()") if (plan_seen) { # Error, only one plan per stream is acceptable. testsuite_error("multiple test plans") return; } planned_tests = planned # The TAP plan can come before or after *all* the TAP results; we speak # respectively of an "early" or a "late" plan. If we see the plan line # after at least one TAP result has been seen, assume we have a late # plan; in this case, any further test result seen after the plan will # be flagged as an error. plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN) # If testno > 0, we have an error ("too many tests run") that will be # automatically dealt with later, so do not worry about it here. If # $plan_seen is true, we have an error due to a repeated plan, and that # has already been dealt with above. Otherwise, we have a valid "plan # with SKIP" specification, and should report it as a particular kind # of SKIP result. if (planned == 0 && testno == 0) { if (length(skip_reason)) skip_reason = "- " skip_reason; report("SKIP", skip_reason); } } function extract_tap_comment(line) { if (index(line, diag_string) == 1) { # Strip leading `diag_string` from `line`. line = substr(line, length(diag_string) + 1) # And strip any leading and trailing whitespace left. sub("^[ \t]*", "", line) sub("[ \t]*$", "", line) # Return what is left (if any). return line; } return ""; } # When this function is called, we know that line is a TAP result line, # so that it matches the (perl) RE "^(not )?ok\b". function setup_result_obj(line) { # Get the result, and remove it from the line. result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0) sub("^(not )?ok[ \t]*", "", line) # If the result has an explicit number, get it and strip it; otherwise, # automatically assing the next progresive number to it. if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/) { match(line, "^[0-9]+") # The final `+ 0` is to normalize numbers with leading zeros. result_obj["number"] = substr(line, 1, RLENGTH) + 0 line = substr(line, RLENGTH + 1) } else { result_obj["number"] = testno } if (plan_seen == LATE_PLAN) # No further test results are acceptable after a "late" TAP plan # has been seen. result_obj["is_unplanned"] = 1 else if (plan_seen && testno > planned_tests) result_obj["is_unplanned"] = 1 else result_obj["is_unplanned"] = 0 # Strip trailing and leading whitespace. sub("^[ \t]*", "", line) sub("[ \t]*$", "", line) # This will have to be corrected if we have a "TODO"/"SKIP" directive. result_obj["description"] = line result_obj["directive"] = "" result_obj["explanation"] = "" if (index(line, "#") == 0) return # No possible directive, nothing more to do. # Directives are case-insensitive. rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*" # See whether we have the directive, and if yes, where. pos = match(line, rx "$") if (!pos) pos = match(line, rx "[^a-zA-Z0-9_]") # If there was no TAP directive, we have nothing more to do. if (!pos) return # Let`s now see if the TAP directive has been escaped. For example: # escaped: ok \# SKIP # not escaped: ok \\# SKIP # escaped: ok \\\\\# SKIP # not escaped: ok \ # SKIP if (substr(line, pos, 1) == "#") { bslash_count = 0 for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--) bslash_count += 1 if (bslash_count % 2) return # Directive was escaped. } # Strip the directive and its explanation (if any) from the test # description. result_obj["description"] = substr(line, 1, pos - 1) # Now remove the test description from the line, that has been dealt # with already. line = substr(line, pos) # Strip the directive, and save its value (normalized to upper case). sub("^[ \t]*#[ \t]*", "", line) result_obj["directive"] = toupper(substr(line, 1, 4)) line = substr(line, 5) # Now get the explanation for the directive (if any), with leading # and trailing whitespace removed. sub("^[ \t]*", "", line) sub("[ \t]*$", "", line) result_obj["explanation"] = line } function get_test_exit_message(status) { if (status == 0) return "" if (status !~ /^[1-9][0-9]*$/) abort("getting exit status") if (status < 127) exit_details = "" else if (status == 127) exit_details = " (command not found?)" else if (status >= 128 && status <= 255) exit_details = sprintf(" (terminated by signal %d?)", status - 128) else if (status > 256 && status <= 384) # We used to report an "abnormal termination" here, but some Korn # shells, when a child process die due to signal number n, can leave # in $? an exit status of 256+n instead of the more standard 128+n. # Apparently, both behaviours are allowed by POSIX (2008), so be # prepared to handle them both. See also Austing Group report ID # 0000051 exit_details = sprintf(" (terminated by signal %d?)", status - 256) else # Never seen in practice. exit_details = " (abnormal termination)" return sprintf("exited with status %d%s", status, exit_details) } function write_test_results() { print ":global-test-result: " get_global_test_result() > trs_file print ":recheck: " yn(must_recheck()) > trs_file print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file for (i = 0; i < test_results_index; i += 1) print ":test-result: " test_results_list[i] > trs_file close(trs_file); } BEGIN { ## ------- ## ## SETUP ## ## ------- ## '"$init_colors"' # Properly initialized once the TAP plan is seen. planned_tests = 0 COOKED_PASS = expect_failure ? "XPASS": "PASS"; COOKED_FAIL = expect_failure ? "XFAIL": "FAIL"; # Enumeration-like constants to remember which kind of plan (if any) # has been seen. It is important that NO_PLAN evaluates "false" as # a boolean. NO_PLAN = 0 EARLY_PLAN = 1 LATE_PLAN = 2 testno = 0 # Number of test results seen so far. bailed_out = 0 # Whether a "Bail out!" directive has been seen. # Whether the TAP plan has been seen or not, and if yes, which kind # it is ("early" is seen before any test result, "late" otherwise). plan_seen = NO_PLAN ## --------- ## ## PARSING ## ## --------- ## is_first_read = 1 while (1) { # Involutions required so that we are able to read the exit status # from the last input line. st = getline if (st < 0) # I/O error. fatal("I/O error while reading from input stream") else if (st == 0) # End-of-input { if (is_first_read) abort("in input loop: only one input line") break } if (is_first_read) { is_first_read = 0 nextline = $0 continue } else { curline = nextline nextline = $0 $0 = curline } # Copy any input line verbatim into the log file. print | "cat >&3" # Parsing of TAP input should stop after a "Bail out!" directive. if (bailed_out) continue # TAP test result. if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/) { testno += 1 setup_result_obj($0) handle_tap_result() } # TAP plan (normal or "SKIP" without explanation). else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/) { # The next two lines will put the number of planned tests in $0. sub("^1\\.\\.", "") sub("[^0-9]*$", "") handle_tap_plan($0, "") continue } # TAP "SKIP" plan, with an explanation. else if ($0 ~ /^1\.\.0+[ \t]*#/) { # The next lines will put the skip explanation in $0, stripping # any leading and trailing whitespace. This is a little more # tricky in truth, since we want to also strip a potential leading # "SKIP" string from the message. sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "") sub("[ \t]*$", ""); handle_tap_plan(0, $0) } # "Bail out!" magic. # Older versions of prove and TAP::Harness (e.g., 3.17) did not # recognize a "Bail out!" directive when preceded by leading # whitespace, but more modern versions (e.g., 3.23) do. So we # emulate the latter, "more modern" behaviour. else if ($0 ~ /^[ \t]*Bail out!/) { bailed_out = 1 # Get the bailout message (if any), with leading and trailing # whitespace stripped. The message remains stored in `$0`. sub("^[ \t]*Bail out![ \t]*", ""); sub("[ \t]*$", ""); # Format the error message for the bailout_message = "Bail out!" if (length($0)) bailout_message = bailout_message " " $0 testsuite_error(bailout_message) } # Maybe we have too look for dianogtic comments too. else if (comments != 0) { comment = extract_tap_comment($0); if (length(comment)) report("#", comment); } } ## -------- ## ## FINISH ## ## -------- ## # A "Bail out!" directive should cause us to ignore any following TAP # error, as well as a non-zero exit status from the TAP producer. if (!bailed_out) { if (!plan_seen) { testsuite_error("missing test plan") } else if (planned_tests != testno) { bad_amount = testno > planned_tests ? "many" : "few" testsuite_error(sprintf("too %s tests run (expected %d, got %d)", bad_amount, planned_tests, testno)) } if (!ignore_exit) { # Fetch exit status from the last line. exit_message = get_test_exit_message(nextline) if (exit_message) testsuite_error(exit_message) } } write_test_results() exit 0 } # End of "BEGIN" block. ' # TODO: document that we consume the file descriptor 3 :-( } 3>"$log_file" test $? -eq 0 || fatal "I/O or internal error" # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/build-aux/git-version-gen0000755000000000000000000001776614406334420015613 0ustar0000000000000000#!/bin/sh # Print a version string. scriptversion=2022-03-25.09; # UTC # Copyright (C) 2007-2019 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, see . # This script is derived from GIT-VERSION-GEN from GIT: https://git-scm.com/. # It may be run two ways: # - from a git repository in which the "git describe" command below # produces useful output (thus requiring at least one signed tag) # - from a non-git-repo directory containing a .tarball-version file, which # presumes this script is invoked like "./git-version-gen .tarball-version". # In order to use intra-version strings in your project, you will need two # separate generated version string files: # # .tarball-version - present only in a distribution tarball, and not in # a checked-out repository. Created with contents that were learned at # the last time autoconf was run, and used by git-version-gen. Must not # be present in either $(srcdir) or $(builddir) for git-version-gen to # give accurate answers during normal development with a checked out tree, # but must be present in a tarball when there is no version control system. # Therefore, it cannot be used in any dependencies. GNUmakefile has # hooks to force a reconfigure at distribution time to get the value # correct, without penalizing normal development with extra reconfigures. # # .version - present in a checked-out repository and in a distribution # tarball. Usable in dependencies, particularly for files that don't # want to depend on config.h but do want to track version changes. # Delete this file prior to any autoconf run where you want to rebuild # files to pick up a version string change; and leave it stale to # minimize rebuild time after unrelated changes to configure sources. # # As with any generated file in a VC'd directory, you should add # /.version to .gitignore, so that you don't accidentally commit it. # .tarball-version is never generated in a VC'd directory, so needn't # be listed there. # # Use the following line in your configure.ac, so that $(VERSION) will # automatically be up-to-date each time configure is run (and note that # since configure.ac no longer includes a version string, Makefile rules # should not depend on configure.ac for version updates). # # AC_INIT([GNU project], # m4_esyscmd([build-aux/git-version-gen .tarball-version]), # [bug-project@example]) # # Then use the following lines in your Makefile.am, so that .version # will be present for dependencies, and so that .version and # .tarball-version will exist in distribution tarballs. # # EXTRA_DIST = $(top_srcdir)/.version # BUILT_SOURCES = $(top_srcdir)/.version # $(top_srcdir)/.version: # echo $(VERSION) > $@-t && mv $@-t $@ # dist-hook: # echo $(VERSION) > $(distdir)/.tarball-version me=$0 year=`expr "$scriptversion" : '\([^-]*\)'` version="git-version-gen $scriptversion Copyright $year Free Software Foundation, Inc. There is NO warranty. You may redistribute this software under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING." usage="\ Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT] Print a version string. Options: --prefix PREFIX prefix of git tags (default 'v') --fallback VERSION fallback version to use if \"git --version\" fails --help display this help and exit --version output version information and exit Running without arguments will suffice in most cases." prefix=v fallback= while test $# -gt 0; do case $1 in --help) echo "$usage"; exit 0;; --version) echo "$version"; exit 0;; --prefix) shift; prefix=${1?};; --fallback) shift; fallback=${1?};; -*) echo "$0: Unknown option '$1'." >&2 echo "$0: Try '--help' for more information." >&2 exit 1;; *) if test "x$tarball_version_file" = x; then tarball_version_file="$1" elif test "x$tag_sed_script" = x; then tag_sed_script="$1" else echo "$0: extra non-option argument '$1'." >&2 exit 1 fi;; esac shift done if test "x$tarball_version_file" = x; then echo "$usage" exit 1 fi tag_sed_script="${tag_sed_script:-s/x/x/}" nl=' ' # Avoid meddling by environment variable of the same name. v= v_from_git= # First see if there is a tarball-only version file. # then try "git describe", then default. if test -f $tarball_version_file then v=`cat $tarball_version_file` || v= case $v in *$nl*) v= ;; # reject multi-line output esac test "x$v" = x \ && echo "$0: WARNING: $tarball_version_file is damaged" 1>&2 fi if test "x$v" != x then : # use $v # Otherwise, if there is at least one git commit involving the working # directory, and "git describe" output looks sensible, use that to # derive a version string. elif test "`git log -1 --pretty=format:x . 2>&1`" = x \ && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \ || git describe --abbrev=4 HEAD 2>/dev/null` \ && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \ && case $v in $prefix[0-9]*) ;; *) (exit 1) ;; esac then # Is this a new git that lists number of commits since the last # tag or the previous older version that did not? # Newer: v6.10-77-g0f8faeb # Older: v6.10-g0f8faeb vprefix=`expr "X$v" : 'X\(.*\)-g[^-]*$'` || vprefix=$v case $vprefix in *-*) : git describe is probably okay three part flavor ;; *) : git describe is older two part flavor # Recreate the number of commits and rewrite such that the # result is the same as if we were using the newer version # of git describe. vtag=`echo "$v" | sed 's/-.*//'` commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \ || { commit_list=failed; echo "$0: WARNING: git rev-list failed" 1>&2; } numcommits=`echo "$commit_list" | wc -l` v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; test "$commit_list" = failed && v=UNKNOWN ;; esac # Change the penultimate "-" to ".", for version-comparing tools. # Remove the "g" to save a byte. # Prepend a bunch of '.0', so that the version comparison doesn't # conflict with a released version. v=`echo "$v" | sed 's/-\([^-]*\)-g\([^-]*\)$/.0.0.0.\1-\2/'`; v_from_git=1 elif test "x$fallback" = x || git --version >/dev/null 2>&1; then v=UNKNOWN else v=$fallback fi v=`echo "$v" |sed "s/^$prefix//"` # Test whether to append the "-dirty" suffix only if the version # string we're using came from git. I.e., skip the test if it's "UNKNOWN" # or if it came from .tarball-version. if test "x$v_from_git" != x; then # Don't declare a version "dirty" merely because a timestamp has changed. git update-index --refresh > /dev/null 2>&1 dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty= case "$dirty" in '') ;; *) # Append the suffix only if there isn't one already. case $v in *-dirty) ;; *) v="$v-dirty" ;; esac ;; esac fi # Omit the trailing newline, so that m4_esyscmd can use the result directly. printf %s "$v" # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/lua/0000755000000000000000000000000014656670213011530 5ustar0000000000000000crun-1.16.1/lua/lua_crun.c0000644000000000000000000007251214504567214013511 0ustar0000000000000000/* *crun - OCI runtime written in C * *Copyright (C) Rubicon Rowe *crun is free software; you can redistribute it and/or modify *it under the terms of the GNU Lesser General Public License as published by *the Free Software Foundation; either version 2.1 of the License, or *(at your option) any later version. * *crun 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 crun. If not, see . */ /* This library is a bare libcrun interface and can be further wrapped by other libraries. * * There are some problems still and the API is a subject to change. */ #include #include #include #include #include #include #include #include #include #include static const char *LUA_CRUN_TAG_CTX = "crun-ctx"; static const char *LUA_CRUN_TAG_CONT = "crun-container"; static const char *LUA_CRUN_TAG_CONTS_ITER = "crun-containers-iterator"; #define luacrunL_optboolean(L, n, d) luaL_opt (S, lua_toboolean, n, d) // Soft error = return an error. // When `expr` is false, run `onfailed` and push the string from `crun_err`. // Return `addret + 1`. #define luacrun_SoftErrIf(S, expr, crun_err, onfailed, addret) \ if (expr) \ { \ onfailed; \ return luacrun_error (S, crun_err) + addret; \ } #if __STDC_VERSION__ < 201112L # define LUACRUN_NoRet #elif __STDC_VERSION__ < 202300L # define LUACRUN_NoRet _Noreturn #else # define LUACRUN_NoRet [[noreturn]] #endif extern LUACRUN_NoRet int lua_error (lua_State *L); extern LUACRUN_NoRet int luaL_error (lua_State *L, const char *fmt, ...); /* Build the error string, push onto stack. */ LUA_API int luacrun_error (lua_State *S, libcrun_error_t *err) { luaL_checkstack (S, 1, NULL); if (*err == NULL) { lua_pushstring (S, "the error is NULL, this may be a bug in luacrun"); return 1; } if ((*err)->status == 0) { lua_pushfstring (S, "crun: %s", (*err)->msg); } else { lua_pushfstring (S, "crun: %s(%s)", (*err)->msg, strerror ((*err)->status)); } libcrun_error_release (err); return 1; } LUA_API LUACRUN_NoRet void luacrun_set_error (lua_State *S, libcrun_error_t *err) { luacrun_error (S, err); lua_error (S); } /* This is a custom version of `xstrdup`(in src/libcrun/utils.h), return a Lua userdata. * Push the userdata onto stack, or nil if `s` is `NULL`. * This function does not check stack. * -0, +1, - */ static char * luacrun_xstrdup (lua_State *S, const char *s) { if (s != NULL) { size_t size = strlen (s) + 1; char *ret = lua_newuserdata (S, size); /* `lua_newuserdatauv` always returns a valid address, no need to check if the allocation is success */ memcpy (ret, s, size); return ret; } else { lua_pushnil (S); return NULL; } } struct luacrun_args_holder { const char **argv; int argc; }; /* uservalues used by the ctx, the index + 1 is the uservalue idx. the definition here is not stable. */ const char *luacrun_ctx_uservalues[] = { "state_root", "id", "bundle", "console_socket", "pid_file", "notify_socket", "handler", "args", // argv and argc }; #define luacrun_CtxSetupStringField(S, ret, ctxidx, tabidx, field_name, name, uvalidx) \ ret = lua_getfield (S, tabidx, field_name); \ if (ret == LUA_TSTRING) \ { \ ctx->name = luacrun_xstrdup (S, lua_tostring (S, -1)); \ } \ else if (ret == LUA_TNIL) \ { \ lua_pushnil (S); \ ctx->name = NULL; \ } \ else \ { \ lua_pop (S, 1); \ luaL_error (S, "unknown type %s for field \"%s\"", lua_typename (S, ret), field_name); \ } \ lua_setiuservalue (S, ctxidx, uvalidx); \ lua_pop (S, 1) #define luacrun_CtxSetupBoolField(S, ret, ctxidx, tabidx, field_name, name) \ ret = lua_getfield (S, tab_idx, field_name); \ if (ret == LUA_TBOOLEAN) \ { \ ctx->name = lua_toboolean (S, -1); \ } \ else if (ret != LUA_TNIL) \ { \ lua_pop (S, 1); \ luaL_error (S, "unknown type %s for field \"%s\"", lua_typename (S, ret), field_name); \ } \ lua_pop (S, 1) /* Setup context_t by a table. The table must be the stack top. [-0, +0] */ static void luacrun_ctx_setup (lua_State *S, int ctxidx, int tab_idx) { libcrun_context_t *ctx = lua_touserdata (S, ctxidx); int ret; luacrun_CtxSetupStringField (S, ret, ctxidx, tab_idx, "state_root", state_root, 1); luacrun_CtxSetupStringField (S, ret, ctxidx, tab_idx, "id", id, 2); luacrun_CtxSetupStringField (S, ret, ctxidx, tab_idx, "bundle", bundle, 3); luacrun_CtxSetupStringField (S, ret, ctxidx, tab_idx, "console_socket", console_socket, 4); luacrun_CtxSetupStringField (S, ret, ctxidx, tab_idx, "pid_file", pid_file, 5); luacrun_CtxSetupStringField (S, ret, ctxidx, tab_idx, "notify_socket", notify_socket, 6); luacrun_CtxSetupStringField (S, ret, ctxidx, tab_idx, "handler", handler, 7); luacrun_CtxSetupBoolField (S, ret, ctxidx, tabidx, "systemd_cgroup", systemd_cgroup); luacrun_CtxSetupBoolField (S, ret, ctxidx, tabidx, "detach", detach); ret = lua_getfield (S, tab_idx, "args"); if (ret == LUA_TTABLE) { lua_Integer length = luaL_len (S, -1); if (length < 0 || length > (INT_MAX - 1)) { /* A userdata can have INT_MAX uservalues */ luaL_error (S, "field \"args\": length should be <= %d and > 0", INT_MAX - 1); } int argc = (int) length; const char **argv = lua_newuserdatauv (S, sizeof (char *) * argc, argc); int argv_idx = lua_gettop (S); for (int i = argc; i > 0; i--) { lua_geti (S, tab_idx, i); const char *arg = luaL_tolstring (S, -1, NULL); if (arg != NULL) { const char *copy = luacrun_xstrdup (S, arg); argv[i] = copy; lua_setiuservalue (S, argv_idx, i); lua_pop (S, 2); /* pop arg and result from lua_geti */ } else { luaL_error (S, "field \"args\": failed to convert value (index %d) to string", i); } } /* Stack top: argv */ struct luacrun_args_holder *args = lua_newuserdatauv (S, sizeof (struct luacrun_args_holder), 1); int args_idx = lua_gettop (S); args->argc = argc; args->argv = argv; lua_pushvalue (S, argv_idx); lua_setiuservalue (S, args_idx, 1); /* Stack top: args */ lua_setiuservalue (S, ctxidx, 8); /* -1 */ lua_pop (S, 1); } else if (ret != LUA_TNIL) { lua_pop (S, 1); luaL_error (S, "unknown type %s for field \"%s\"", lua_typename (S, ret), "args"); } lua_pop (S, 1); } /* Create a crun context. */ LUA_API int luacrun_new_ctx (lua_State *S) { if (! (lua_isnil (S, 1) || lua_istable (S, 1))) { luaL_typeerror (S, 1, "table or nil"); } luaL_checkstack (S, 1, NULL); /* Lua does not guarantee that string addresses will be valid for the lifetime of libcrun_context_t, * but we must respect the memory management function set by the user in lua_State. * (For the string memory guarantees: https://www.lua.org/manual/5.4/manual.html#4.1.3) * * - Use userdata as string to ensure it will not be moved. * ("Lua ensures that this address is valid as long as the corresponding userdata is alive": * https://www.lua.org/manual/5.4/manual.html#lua_newuserdatauv) * - Use uservalue to prevent being collected by GC. * */ libcrun_context_t *ctx = lua_newuserdatauv (S, sizeof (libcrun_context_t), 8); int ctx_idx = lua_gettop (S); memset (ctx, 0, sizeof (libcrun_context_t)); ctx->fifo_exec_wait_fd = -1; if (lua_istable (S, 1)) { luacrun_ctx_setup (S, ctx_idx, 1); } else if (!lua_isnoneornil(S, 1)) { luaL_argerror(S, 1, "expect table, nil or none"); } luaL_setmetatable (S, LUA_CRUN_TAG_CTX); return 1; } /*Grab a basic container spec.*/ LUA_API int luacrun_container_spec (lua_State *S) { bool rootless = luacrunL_optboolean (S, 1, true); libcrun_error_t crun_err = NULL; luaL_checkstack (S, 1, NULL); char buf[4096] = {}; FILE *memfile = fmemopen (buf, 4095, "w"); int ret = libcrun_container_spec (rootless, memfile, &crun_err); fclose (memfile); luacrun_SoftErrIf (S, ret < 0, &crun_err, lua_pushnil (S), 1); lua_pushlstring (S, buf, ret); return 1; } LUA_API int luacrun_new_container_from_string (lua_State *S) { libcrun_error_t crun_err = NULL; const char *def = luaL_checkstring (S, 1); libcrun_container_t **cont = lua_newuserdata (S, sizeof (libcrun_container_t *)); luaL_setmetatable (S, LUA_CRUN_TAG_CONT); *cont = libcrun_container_load_from_memory (def, &crun_err); if (*cont == NULL) { lua_pushnil (S); return luacrun_error (S, &crun_err) + 1; } return 1; } LUA_API int luacrun_new_container_from_file (lua_State *S) { libcrun_error_t crun_err = NULL; const char *path = luaL_checkstring (S, 1); libcrun_container_t **cont = lua_newuserdata (S, sizeof (libcrun_container_t *)); luaL_setmetatable (S, LUA_CRUN_TAG_CONT); // create the userdata before calling crun, so we don't need to clean up when Lua failed *cont = libcrun_container_load_from_file (path, &crun_err); if (*cont == NULL) { lua_pushnil (S); return luacrun_error (S, &crun_err) + 1; } return 1; } /*Release resource linked with container userdata. Double use is supported.*/ LUA_API int luacrun_container_finalizer (lua_State *S) { libcrun_container_t **cont = luaL_checkudata (S, 1, LUA_CRUN_TAG_CONT); if (*cont != NULL) { free_runtime_spec_schema_config_schema ((*cont)->container_def); *cont = NULL; } return 0; } LUA_API int luacrun_set_verbosity (lua_State *S) { lua_Integer verbosity = luaL_checkinteger (S, 1); if (verbosity >= INT_MIN && verbosity <= INT_MAX) { libcrun_set_verbosity (verbosity); } else { luaL_error (S, "verbosity should be >= %d and <= %d", INT_MIN, INT_MAX); } return 0; } LUA_API int luacrun_get_verbosity (lua_State *S) { int verbosity = libcrun_get_verbosity (); lua_pushinteger (S, verbosity); return 1; } static unsigned int luacrun_build_run_flags (lua_State *S, int idx) { luaL_checktype (S, idx, LUA_TTABLE); lua_getfield (S, idx, "prefork"); bool prefork = lua_toboolean (S, -1); lua_pop (S, 1); return (prefork ? LIBCRUN_RUN_OPTIONS_PREFORK : 0) | 0; } LUA_API int luacrun_ctx_run (lua_State *S) { libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); libcrun_container_t **cont = luaL_checkudata (S, 2, LUA_CRUN_TAG_CONT); unsigned int flags = luaL_opt (S, luacrun_build_run_flags, 3, 0); libcrun_error_t crun_err = NULL; luaL_checkstack (S, 1, NULL); int ret = libcrun_container_run (ctx, *cont, flags, &crun_err); if (ret < 0) { if (crun_err != NULL) { lua_pushnil (S); return luacrun_error (S, &crun_err) + 1; } else { luaL_error(S, "failed to run container"); } } else { lua_pushinteger (S, ret); return 1; } } LUA_API int luacrun_ctx_create_container (lua_State *S) { libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); libcrun_container_t **cont = luaL_checkudata (S, 2, LUA_CRUN_TAG_CONT); unsigned int flags = luaL_opt (S, luacrun_build_run_flags, 3, LIBCRUN_RUN_OPTIONS_PREFORK); libcrun_error_t crun_err = NULL; luaL_checkstack (S, 1, NULL); int ret = libcrun_container_create (ctx, *cont, flags, &crun_err); if (ret < 0) { lua_pushnil (S); return luacrun_error (S, &crun_err) + 1; } else { lua_pushinteger (S, ret); return 1; } } LUA_API int luacrun_ctx_delete_container (lua_State *S) { libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); const char *id = luaL_checkstring (S, 2); bool force = luaL_opt (S, lua_toboolean, 3, false); libcrun_error_t crun_err = NULL; luaL_checkstack (S, 1, NULL); int ret = libcrun_container_delete (ctx, NULL, id, force, &crun_err); bool has_error = ret < 0 && crun_err != NULL; luacrun_SoftErrIf (S, has_error, &crun_err, lua_pushboolean (S, false), 1); lua_pushboolean (S, ret >= 0); // false if failed to read the exec.fifo in the state dir return 1; } LUA_API int luacrun_ctx_kill_container (lua_State *S) { libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); const char *id = luaL_checkstring (S, 2); const char *signame = luaL_checkstring (S, 3); libcrun_error_t crun_err = NULL; luaL_checkstack (S, 1, NULL); int ret = libcrun_container_kill (ctx, id, signame, &crun_err); luacrun_SoftErrIf (S, ret < 0, &crun_err, lua_pushboolean (S, false), 1); lua_pushboolean (S, true); return 1; } /* Get the container status. (ctx: userdata, id: string) [-0, +1, -] This function is a rewrite of `libcrun_container_state` for Lua. `libcrun_container_state` receives `FILE*` and writes JSON. We could not use `fmemopen` like `luacrun_container_spec` since the final size of the string is 100% unpredictable. */ LUA_API int luacrun_ctx_status_container (lua_State *S) { libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); const char *id = luaL_checkstring (S, 2); luaL_checkstack (S, 3, NULL); libcrun_error_t crun_err = NULL; int ret; lua_createtable (S, 0, 0); int tabidx = lua_gettop (S); // We know there are two frames available on the stack from this point. lua_pushstring (S, "1.0.0"); lua_setfield (S, tabidx, "ociVersion"); lua_pushvalue (S, 2); lua_setfield (S, tabidx, "id"); libcrun_container_status_t status = {}; const char *state_root = ctx->state_root; ret = libcrun_read_container_status (&status, state_root, id, &crun_err); luacrun_SoftErrIf (S, ret < 0, &crun_err, lua_pushnil (S), 1); const char *container_status = NULL; int running; ret = libcrun_get_container_state_string (id, &status, state_root, &container_status, &running, &crun_err); luacrun_SoftErrIf (S, ret < 0 && crun_err != NULL, &crun_err, lua_pushnil (S), 1); if (ret < 0) { // Failed to read the exec.fifo in the state dir lua_pushnil(S); lua_pushstring(S, "failed to read state"); return 2; } lua_pushinteger (S, running ? status.pid : 0); lua_setfield (S, tabidx, "pid"); struct luacrun_string_pair { const char *k; const char *v; }; const struct luacrun_string_pair values[] = { { "status", container_status }, { "bundle", status.bundle }, { "rootfs", status.rootfs }, { "created", status.created }, { "systemd-scope", status.scope }, /* maybe NULL*/ { "owner", status.owner }, /* maybe NULL */ { NULL, NULL }, }; for (int i = 0; values[i].k != NULL; i++) { const struct luacrun_string_pair p = values[i]; if (p.v != NULL) { lua_pushstring (S, p.v); lua_setfield (S, tabidx, p.k); } } { cleanup_container libcrun_container_t *container = NULL; cleanup_free char *dir = NULL; dir = libcrun_get_state_directory (state_root, id); if (dir == NULL) { lua_pushnil (S); lua_pushstring (S, "cannot get state directory"); return 2; } const char *config_file = lua_pushfstring (S, "%s/%s", dir, "config.json"); container = libcrun_container_load_from_file (config_file, &crun_err); lua_pop (S, 1); if (container == NULL) { lua_pushnil (S); lua_pushstring (S, "error loading config.json"); return 2; } if (container->container_def->annotations && container->container_def->annotations->len) { /* Check stack again, we need three available frames here. */ luaL_checkstack (S, 3, NULL); lua_createtable (S, 0, container->container_def->annotations->len); for (size_t i = 0; i < container->container_def->annotations->len; i++) { const char *key = container->container_def->annotations->keys[i]; const char *val = container->container_def->annotations->values[i]; lua_pushstring (S, val); lua_setfield (S, tabidx, key); } lua_setfield (S, tabidx, "annotations"); } } return 1; } LUA_API int luacrun_ctx_start_container (lua_State *S) { libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); const char *id = luaL_checkstring (S, 2); libcrun_error_t crun_err = NULL; luaL_checkstack (S, 2, NULL); int ret = libcrun_container_start (ctx, id, &crun_err); luacrun_SoftErrIf (S, ret < 0, &crun_err, lua_pushboolean (S, false), 1); lua_pushboolean (S, true); return 1; } struct luacrun_ctx_containers_iterator { bool closed; // flag for if the libcrun_container_list_t free'd libcrun_container_list_t *start; libcrun_container_list_t *curr; lua_Integer counter; }; static int luacrun_ctx_containers_iteratorf (lua_State *S) { // params: userdata integer luaL_checktype (S, 1, LUA_TUSERDATA); struct luacrun_ctx_containers_iterator *it = lua_touserdata (S, 1); luaL_checkstack (S, 2, NULL); if (it->curr != NULL) { lua_pushinteger (S, ++(it->counter)); lua_pushstring (S, it->curr->name); it->curr = it->curr->next; return 2; } else { it->closed = true; libcrun_free_containers_list (it->start); lua_pushnil (S); return 1; } } static int luacrun_ctx_containers_finalizer (lua_State *S) { luaL_checktype (S, 1, LUA_TUSERDATA); struct luacrun_ctx_containers_iterator *iter = lua_touserdata (S, 1); if (! iter->closed) { libcrun_free_containers_list (iter->start); } return 0; } static const luaL_Reg luacrun_ctx_containers_iterator_metamethods[] = { { "__gc", &luacrun_ctx_containers_finalizer }, { NULL, NULL }, }; static int luacrun_setup_ctx_iter_metatable (lua_State *S) { luaL_newmetatable (S, LUA_CRUN_TAG_CONTS_ITER); luaL_setfuncs (S, luacrun_ctx_containers_iterator_metamethods, 0); lua_pop (S, 1); return 0; } LUA_API int luacrun_ctx_iter_containers (lua_State *S) { libcrun_error_t crun_err = NULL; libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); luaL_checkstack (S, 4, NULL); lua_pushcfunction (S, &luacrun_ctx_containers_iteratorf); libcrun_container_list_t *containers; int ret = libcrun_get_containers_list (&containers, ctx->state_root, &crun_err); if (ret < 0 && crun_err != NULL) luacrun_set_error (S, &crun_err); // ret < 0 && crun_err == NULL: the status file does not exists // The `containers` is still NULL, // the iterator function knows how to handle the situation struct luacrun_ctx_containers_iterator *it = lua_newuserdata (S, sizeof (struct luacrun_ctx_containers_iterator)); *it = (struct luacrun_ctx_containers_iterator){ .closed = false, .counter = 0, .curr = containers, .start = containers, }; luaL_setmetatable (S, LUA_CRUN_TAG_CONTS_ITER); lua_pushinteger (S, it->counter); lua_pushnil (S); return 4; } LUA_API int luacrun_ctx_update_container (lua_State *S) { libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); const char *id = luaL_checkstring (S, 2); const char *content = luaL_checkstring (S, 3); luaL_checkstack (S, 2, NULL); char errbuf[1024] = {}; yajl_val parsed_json = yajl_tree_parse (content, errbuf, sizeof (errbuf)); if (parsed_json == NULL) { lua_pushboolean (S, false); lua_pushfstring (S, "cannot parse the data: \"%s\"", errbuf); return 2; } struct parser_context parser_ctx = { .options = 0, .errfile = stderr }; runtime_spec_schema_config_schema_process *rt_spec_process; parser_error p_err = NULL; rt_spec_process = make_runtime_spec_schema_config_schema_process (parsed_json, &parser_ctx, &p_err); yajl_tree_free (parsed_json); if (rt_spec_process == NULL) { lua_pushboolean (S, false); lua_pushfstring (S, "cannot parse process: \"%s\"", p_err); free (p_err); return 2; } libcrun_error_t crun_err = NULL; int ret = libcrun_container_exec (ctx, id, rt_spec_process, &crun_err); free_runtime_spec_schema_config_schema_process (rt_spec_process); luacrun_SoftErrIf (S, ret < 0, &crun_err, lua_pushboolean (S, false), 1); lua_pushboolean (S, true); return 1; } #define luacrun_CtxStringAccessor(name, uval_idx) \ LUA_API int luacrun_ctx_get_##name (lua_State *S) \ { \ libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); \ if (ctx->name != NULL) \ { \ luaL_checkstack (S, 1, NULL); \ lua_pushstring (S, ctx->name); \ return 1; \ } \ else \ { \ return 0; \ } \ } \ LUA_API int luacrun_ctx_set_##name (lua_State *S) \ { \ libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); \ const char *val = luaL_optstring (S, 2, NULL); \ luaL_checkstack (S, 2, NULL); \ if (ctx->name != NULL) \ { \ lua_pushstring (S, ctx->name); \ } \ else \ { \ lua_pushnil (S); \ } \ const char *copy = luacrun_xstrdup (S, val); \ ctx->name = copy; \ lua_setiuservalue (S, 1, uval_idx); \ return 1; \ } #define luacrun_CtxBoolAccessor(name) \ LUA_API int luacrun_ctx_get_##name (lua_State *S) \ { \ libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); \ luaL_checkstack (S, 1, NULL); \ lua_pushboolean (S, ctx->name); \ return 1; \ } \ LUA_API int luacrun_ctx_set_##name (lua_State *S) \ { \ libcrun_context_t *ctx = luaL_checkudata (S, 1, LUA_CRUN_TAG_CTX); \ luaL_checktype (S, 2, LUA_TBOOLEAN); \ luaL_checkstack (S, 1, NULL); \ bool oldval = ctx->name; \ ctx->name = lua_toboolean (S, 2); \ lua_pushboolean (S, oldval); \ return 1; \ } luacrun_CtxStringAccessor (state_root, 1); luacrun_CtxStringAccessor (id, 2); luacrun_CtxStringAccessor (bundle, 3); luacrun_CtxStringAccessor (console_socket, 4); luacrun_CtxStringAccessor (pid_file, 5); luacrun_CtxStringAccessor (notify_socket, 6); luacrun_CtxStringAccessor (handler, 7); luacrun_CtxBoolAccessor (systemd_cgroup); #define luacrun_RegAddCtxAccessor(method_name, name) \ { method_name, &luacrun_ctx_get_##name }, \ { \ "set_" method_name, &luacrun_ctx_set_##name \ } static const luaL_Reg luacrun_ctx_index[] = { { "run", &luacrun_ctx_run }, { "create", &luacrun_ctx_create_container }, { "delete", &luacrun_ctx_delete_container }, { "kill", &luacrun_ctx_kill_container }, { "start", &luacrun_ctx_start_container }, { "status", &luacrun_ctx_status_container }, { "iter_names", &luacrun_ctx_iter_containers }, { "update", &luacrun_ctx_update_container }, luacrun_RegAddCtxAccessor ("state_root", state_root), luacrun_RegAddCtxAccessor ("id", id), luacrun_RegAddCtxAccessor ("bundle", bundle), luacrun_RegAddCtxAccessor ("console_socket", console_socket), luacrun_RegAddCtxAccessor ("pid_file", pid_file), luacrun_RegAddCtxAccessor ("notify_socket", notify_socket), luacrun_RegAddCtxAccessor ("handler", handler), luacrun_RegAddCtxAccessor ("systemd_cgroup", systemd_cgroup), { NULL, NULL }, }; LUA_API int luacrun_setup_ctx_metatable (lua_State *S) { luaL_checkstack (S, 3, NULL); luaL_newmetatable (S, LUA_CRUN_TAG_CTX); int mtab_idx = lua_gettop (S); lua_newtable (S); luaL_setfuncs (S, luacrun_ctx_index, 0); lua_setfield (S, mtab_idx, "__index"); lua_pop (S, 1); return 0; } LUA_API int luacrun_setup_cont_metatable (lua_State *S) { luaL_checkstack (S, 2, NULL); luaL_newmetatable (S, LUA_CRUN_TAG_CONT); int mtab_idx = lua_gettop (S); lua_pushcfunction (S, &luacrun_container_finalizer); lua_setfield (S, mtab_idx, "__gc"); // Can we do better than a finalizer? // Indirect pointer and wild memory make // Lua GC could not recognize the memory usage. lua_pop (S, 1); return 0; } static const luaL_Reg luacrun_library_reg[] = { { .name = "new_ctx", .func = &luacrun_new_ctx }, { .name = "container_spec", .func = &luacrun_container_spec }, { .name = "new_container_from_string", .func = &luacrun_new_container_from_string }, { .name = "new_container_from_file", .func = &luacrun_new_container_from_file }, { .name = "get_verbosity", .func = &luacrun_get_verbosity }, { .name = "set_verbosity", .func = &luacrun_set_verbosity }, { .name = "run", .func = &luacrun_ctx_run }, { .name = "create_container", .func = &luacrun_ctx_create_container }, { .name = "delete_container", .func = &luacrun_ctx_delete_container }, { .name = "kill_container", .func = &luacrun_ctx_kill_container }, { .name = "start_container", .func = &luacrun_ctx_start_container }, { .name = "status_container", .func = &luacrun_ctx_status_container }, { .name = "iter_container_names", .func = &luacrun_ctx_iter_containers }, { .name = "update_container", .func = &luacrun_ctx_update_container }, { NULL, NULL }, }; LUA_API int luaopen_luacrun (lua_State *S) { luaL_checkstack (S, 2, NULL); luaL_newlib (S, luacrun_library_reg); int libtab_idx = lua_gettop (S); lua_pushinteger (S, LIBCRUN_VERBOSITY_ERROR); lua_setfield (S, libtab_idx, "VERBOSITY_ERROR"); lua_pushinteger (S, LIBCRUN_VERBOSITY_WARNING); lua_setfield (S, libtab_idx, "VERBOSITY_WARNING"); luacrun_setup_ctx_metatable (S); luacrun_setup_cont_metatable (S); luacrun_setup_ctx_iter_metatable (S); return 1; } crun-1.16.1/lua/luacrun.rockspec0000644000000000000000000000242214504567214014732 0ustar0000000000000000--[[ This file is part of crun. SPDX: GPL-2.0-or-later Please don't use this rockspec to make source rocks. The generated rocks does not include files for a success build. Use `make dist-luarock` instead. ]] rockspec_format = "3.0" package = "luacrun" version = "@CLEANVERSION" source = { url = "https://github.com/containers/crun/releases/download/@RELEASEVERSION/crun-@RELEASEVERSION.tar.gz", } supported_platforms = {'linux'} description = { summary = "A Lua binding for libcrun, a fast and lightweight fully featured OCI runtime and C library for running containers.", detailed = [[ libcrun is a fast and low-memory footprint OCI container runtime. This library bundles the binding for libcrun and a working libcrun. ]], homepage = "http://github.com/containers/crun/", license = "GPL-2.0-or-later" } dependencies = {"lua >= 5.4"} build = { type = "command", build_command = [[ rm -rf libocispec/yajl/src/api && ln -s ./headers/yajl libocispec/yajl/src/api && ./configure --prefix=$(PREFIX) --libdir=$(LIBDIR) --disable-lua-path-guessing --disable-crun --disable-libcrun --enable-shared --with-lua-bindings --enable-embedded-yajl LUA=$(LUA) LUA_INCLUDE=-I$(LUA_INCDIR) && make -j]], install_command = "make install", } crun-1.16.1/m4/0000755000000000000000000000000014656670213011267 5ustar0000000000000000crun-1.16.1/m4/ax_lua.m40000644000000000000000000006425014406334420012777 0ustar0000000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_lua.html # =========================================================================== # # SYNOPSIS # # AX_PROG_LUA[([MINIMUM-VERSION], [TOO-BIG-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])] # AX_LUA_HEADERS[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])] # AX_LUA_LIBS[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])] # AX_LUA_READLINE[([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])] # # DESCRIPTION # # Detect a Lua interpreter, optionally specifying a minimum and maximum # version number. Set up important Lua paths, such as the directories in # which to install scripts and modules (shared libraries). # # Also detect Lua headers and libraries. The Lua version contained in the # header is checked to match the Lua interpreter version exactly. When # searching for Lua libraries, the version number is used as a suffix. # This is done with the goal of supporting multiple Lua installs (5.1, # 5.2, and 5.3 side-by-side). # # A note on compatibility with previous versions: This file has been # mostly rewritten for serial 18. Most developers should be able to use # these macros without needing to modify configure.ac. Care has been taken # to preserve each macro's behavior, but there are some differences: # # 1) AX_WITH_LUA is deprecated; it now expands to the exact same thing as # AX_PROG_LUA with no arguments. # # 2) AX_LUA_HEADERS now checks that the version number defined in lua.h # matches the interpreter version. AX_LUA_HEADERS_VERSION is therefore # unnecessary, so it is deprecated and does not expand to anything. # # 3) The configure flag --with-lua-suffix no longer exists; the user # should instead specify the LUA precious variable on the command line. # See the AX_PROG_LUA description for details. # # Please read the macro descriptions below for more information. # # This file was inspired by Andrew Dalke's and James Henstridge's # python.m4 and Tom Payne's, Matthieu Moy's, and Reuben Thomas's ax_lua.m4 # (serial 17). Basically, this file is a mash-up of those two files. I # like to think it combines the best of the two! # # AX_PROG_LUA: Search for the Lua interpreter, and set up important Lua # paths. Adds precious variable LUA, which may contain the path of the Lua # interpreter. If LUA is blank, the user's path is searched for an # suitable interpreter. # # If MINIMUM-VERSION is supplied, then only Lua interpreters with a # version number greater or equal to MINIMUM-VERSION will be accepted. If # TOO-BIG-VERSION is also supplied, then only Lua interpreters with a # version number greater or equal to MINIMUM-VERSION and less than # TOO-BIG-VERSION will be accepted. # # The Lua version number, LUA_VERSION, is found from the interpreter, and # substituted. LUA_PLATFORM is also found, but not currently supported (no # standard representation). # # Finally, the macro finds four paths: # # luadir Directory to install Lua scripts. # pkgluadir $luadir/$PACKAGE # luaexecdir Directory to install Lua modules. # pkgluaexecdir $luaexecdir/$PACKAGE # # These paths are found based on $prefix, $exec_prefix, Lua's # package.path, and package.cpath. The first path of package.path # beginning with $prefix is selected as luadir. The first path of # package.cpath beginning with $exec_prefix is used as luaexecdir. This # should work on all reasonable Lua installations. If a path cannot be # determined, a default path is used. Of course, the user can override # these later when invoking make. # # luadir Default: $prefix/share/lua/$LUA_VERSION # luaexecdir Default: $exec_prefix/lib/lua/$LUA_VERSION # # These directories can be used by Automake as install destinations. The # variable name minus 'dir' needs to be used as a prefix to the # appropriate Automake primary, e.g. lua_SCRIPS or luaexec_LIBRARIES. # # If an acceptable Lua interpreter is found, then ACTION-IF-FOUND is # performed, otherwise ACTION-IF-NOT-FOUND is preformed. If ACTION-IF-NOT- # FOUND is blank, then it will default to printing an error. To prevent # the default behavior, give ':' as an action. # # AX_LUA_HEADERS: Search for Lua headers. Requires that AX_PROG_LUA be # expanded before this macro. Adds precious variable LUA_INCLUDE, which # may contain Lua specific include flags, e.g. -I/usr/include/lua5.1. If # LUA_INCLUDE is blank, then this macro will attempt to find suitable # flags. # # LUA_INCLUDE can be used by Automake to compile Lua modules or # executables with embedded interpreters. The *_CPPFLAGS variables should # be used for this purpose, e.g. myprog_CPPFLAGS = $(LUA_INCLUDE). # # This macro searches for the header lua.h (and others). The search is # performed with a combination of CPPFLAGS, CPATH, etc, and LUA_INCLUDE. # If the search is unsuccessful, then some common directories are tried. # If the headers are then found, then LUA_INCLUDE is set accordingly. # # The paths automatically searched are: # # * /usr/include/luaX.Y # * /usr/include/lua/X.Y # * /usr/include/luaXY # * /usr/local/include/luaX.Y # * /usr/local/include/lua-X.Y # * /usr/local/include/lua/X.Y # * /usr/local/include/luaXY # # (Where X.Y is the Lua version number, e.g. 5.1.) # # The Lua version number found in the headers is always checked to match # the Lua interpreter's version number. Lua headers with mismatched # version numbers are not accepted. # # If headers are found, then ACTION-IF-FOUND is performed, otherwise # ACTION-IF-NOT-FOUND is performed. If ACTION-IF-NOT-FOUND is blank, then # it will default to printing an error. To prevent the default behavior, # set the action to ':'. # # AX_LUA_LIBS: Search for Lua libraries. Requires that AX_PROG_LUA be # expanded before this macro. Adds precious variable LUA_LIB, which may # contain Lua specific linker flags, e.g. -llua5.1. If LUA_LIB is blank, # then this macro will attempt to find suitable flags. # # LUA_LIB can be used by Automake to link Lua modules or executables with # embedded interpreters. The *_LIBADD and *_LDADD variables should be used # for this purpose, e.g. mymod_LIBADD = $(LUA_LIB). # # This macro searches for the Lua library. More technically, it searches # for a library containing the function lua_load. The search is performed # with a combination of LIBS, LIBRARY_PATH, and LUA_LIB. # # If the search determines that some linker flags are missing, then those # flags will be added to LUA_LIB. # # If libraries are found, then ACTION-IF-FOUND is performed, otherwise # ACTION-IF-NOT-FOUND is performed. If ACTION-IF-NOT-FOUND is blank, then # it will default to printing an error. To prevent the default behavior, # set the action to ':'. # # AX_LUA_READLINE: Search for readline headers and libraries. Requires the # AX_LIB_READLINE macro, which is provided by ax_lib_readline.m4 from the # Autoconf Archive. # # If a readline compatible library is found, then ACTION-IF-FOUND is # performed, otherwise ACTION-IF-NOT-FOUND is performed. # # LICENSE # # Copyright (c) 2015 Reuben Thomas # Copyright (c) 2014 Tim Perkins # Copyright (c) Rubicon Rowe # # 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, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. # # Changelog # * Supported Lua 5.4 (Rubicon Rowe) #serial 42 dnl ========================================================================= dnl AX_PROG_LUA([MINIMUM-VERSION], [TOO-BIG-VERSION], dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ========================================================================= AC_DEFUN([AX_PROG_LUA], [ dnl Check for required tools. AC_REQUIRE([AC_PROG_GREP]) AC_REQUIRE([AC_PROG_SED]) dnl Make LUA a precious variable. AC_ARG_VAR([LUA], [The Lua interpreter, e.g. /usr/bin/lua5.1]) dnl Find a Lua interpreter. m4_define_default([_AX_LUA_INTERPRETER_LIST], [lua lua5.4 lua54 lua5.3 lua53 lua5.2 lua52 lua5.1 lua51 lua50]) m4_if([$1], [], [ dnl No version check is needed. Find any Lua interpreter. AS_IF([test "x$LUA" = 'x'], [AC_PATH_PROGS([LUA], [_AX_LUA_INTERPRETER_LIST], [:])]) ax_display_LUA='lua' AS_IF([test "x$LUA" != 'x:'], [ dnl At least check if this is a Lua interpreter. AC_MSG_CHECKING([if $LUA is a Lua interpreter]) _AX_LUA_CHK_IS_INTRP([$LUA], [AC_MSG_RESULT([yes])], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([not a Lua interpreter]) ]) ]) ], [ dnl A version check is needed. AS_IF([test "x$LUA" != 'x'], [ dnl Check if this is a Lua interpreter. AC_MSG_CHECKING([if $LUA is a Lua interpreter]) _AX_LUA_CHK_IS_INTRP([$LUA], [AC_MSG_RESULT([yes])], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([not a Lua interpreter]) ]) dnl Check the version. m4_if([$2], [], [_ax_check_text="whether $LUA version >= $1"], [_ax_check_text="whether $LUA version >= $1, < $2"]) AC_MSG_CHECKING([$_ax_check_text]) _AX_LUA_CHK_VER([$LUA], [$1], [$2], [AC_MSG_RESULT([yes])], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([version is out of range for specified LUA])]) ax_display_LUA=$LUA ], [ dnl Try each interpreter until we find one that satisfies VERSION. m4_if([$2], [], [_ax_check_text="for a Lua interpreter with version >= $1"], [_ax_check_text="for a Lua interpreter with version >= $1, < $2"]) AC_CACHE_CHECK([$_ax_check_text], [ax_cv_pathless_LUA], [ for ax_cv_pathless_LUA in _AX_LUA_INTERPRETER_LIST none; do test "x$ax_cv_pathless_LUA" = 'xnone' && break _AX_LUA_CHK_IS_INTRP([$ax_cv_pathless_LUA], [], [continue]) _AX_LUA_CHK_VER([$ax_cv_pathless_LUA], [$1], [$2], [break]) done ]) dnl Set $LUA to the absolute path of $ax_cv_pathless_LUA. AS_IF([test "x$ax_cv_pathless_LUA" = 'xnone'], [LUA=':'], [AC_PATH_PROG([LUA], [$ax_cv_pathless_LUA])]) ax_display_LUA=$ax_cv_pathless_LUA ]) ]) AS_IF([test "x$LUA" = 'x:'], [ dnl Run any user-specified action, or abort. m4_default([$4], [AC_MSG_ERROR([cannot find suitable Lua interpreter])]) ], [ dnl Query Lua for its version number. AC_CACHE_CHECK([for $ax_display_LUA version], [ax_cv_lua_version], [ dnl Get the interpreter version in X.Y format. This should work for dnl interpreters version 5.0 and beyond. ax_cv_lua_version=[`$LUA -e ' -- return a version number in X.Y format local _, _, ver = string.find(_VERSION, "^Lua (%d+%.%d+)") print(ver)'`] ]) AS_IF([test "x$ax_cv_lua_version" = 'x'], [AC_MSG_ERROR([invalid Lua version number])]) AC_SUBST([LUA_VERSION], [$ax_cv_lua_version]) AC_SUBST([LUA_SHORT_VERSION], [`echo "$LUA_VERSION" | $SED 's|\.||'`]) dnl The following check is not supported: dnl At times (like when building shared libraries) you may want to know dnl which OS platform Lua thinks this is. AC_CACHE_CHECK([for $ax_display_LUA platform], [ax_cv_lua_platform], [ax_cv_lua_platform=[`$LUA -e 'print("unknown")'`]]) AC_SUBST([LUA_PLATFORM], [$ax_cv_lua_platform]) dnl Use the values of $prefix and $exec_prefix for the corresponding dnl values of LUA_PREFIX and LUA_EXEC_PREFIX. These are made distinct dnl variables so they can be overridden if need be. However, the general dnl consensus is that you shouldn't need this ability. AC_SUBST([LUA_PREFIX], ['${prefix}']) AC_SUBST([LUA_EXEC_PREFIX], ['${exec_prefix}']) dnl Lua provides no way to query the script directory, and instead dnl provides LUA_PATH. However, we should be able to make a safe educated dnl guess. If the built-in search path contains a directory which is dnl prefixed by $prefix, then we can store scripts there. The first dnl matching path will be used. AC_CACHE_CHECK([for $ax_display_LUA script directory], [ax_cv_lua_luadir], [ AS_IF([test "x$prefix" = 'xNONE'], [ax_lua_prefix=$ac_default_prefix], [ax_lua_prefix=$prefix]) dnl Initialize to the default path. ax_cv_lua_luadir="$LUA_PREFIX/share/lua/$LUA_VERSION" dnl Try to find a path with the prefix. _AX_LUA_FND_PRFX_PTH([$LUA], [$ax_lua_prefix], [script]) AS_IF([test "x$ax_lua_prefixed_path" != 'x'], [ dnl Fix the prefix. _ax_strip_prefix=`echo "$ax_lua_prefix" | $SED 's|.|.|g'` ax_cv_lua_luadir=`echo "$ax_lua_prefixed_path" | \ $SED "s|^$_ax_strip_prefix|$LUA_PREFIX|"` ]) ]) AC_SUBST([luadir], [$ax_cv_lua_luadir]) AC_SUBST([pkgluadir], [\${luadir}/$PACKAGE]) dnl Lua provides no way to query the module directory, and instead dnl provides LUA_PATH. However, we should be able to make a safe educated dnl guess. If the built-in search path contains a directory which is dnl prefixed by $exec_prefix, then we can store modules there. The first dnl matching path will be used. AC_CACHE_CHECK([for $ax_display_LUA module directory], [ax_cv_lua_luaexecdir], [ AS_IF([test "x$exec_prefix" = 'xNONE'], [ax_lua_exec_prefix=$ax_lua_prefix], [ax_lua_exec_prefix=$exec_prefix]) dnl Initialize to the default path. ax_cv_lua_luaexecdir="$LUA_EXEC_PREFIX/lib/lua/$LUA_VERSION" dnl Try to find a path with the prefix. _AX_LUA_FND_PRFX_PTH([$LUA], [$ax_lua_exec_prefix], [module]) AS_IF([test "x$ax_lua_prefixed_path" != 'x'], [ dnl Fix the prefix. _ax_strip_prefix=`echo "$ax_lua_exec_prefix" | $SED 's|.|.|g'` ax_cv_lua_luaexecdir=`echo "$ax_lua_prefixed_path" | \ $SED "s|^$_ax_strip_prefix|$LUA_EXEC_PREFIX|"` ]) ]) AC_SUBST([luaexecdir], [$ax_cv_lua_luaexecdir]) AC_SUBST([pkgluaexecdir], [\${luaexecdir}/$PACKAGE]) dnl Run any user specified action. $3 ]) ]) dnl AX_WITH_LUA is now the same thing as AX_PROG_LUA. AC_DEFUN([AX_WITH_LUA], [ AC_MSG_WARN([[$0 is deprecated, please use AX_PROG_LUA instead]]) AX_PROG_LUA ]) dnl ========================================================================= dnl _AX_LUA_CHK_IS_INTRP(PROG, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) dnl ========================================================================= AC_DEFUN([_AX_LUA_CHK_IS_INTRP], [ dnl A minimal Lua factorial to prove this is an interpreter. This should work dnl for Lua interpreters version 5.0 and beyond. _ax_lua_factorial=[`$1 2>/dev/null -e ' -- a simple factorial function fact (n) if n == 0 then return 1 else return n * fact(n-1) end end print("fact(5) is " .. fact(5))'`] AS_IF([test "$_ax_lua_factorial" = 'fact(5) is 120'], [$2], [$3]) ]) dnl ========================================================================= dnl _AX_LUA_CHK_VER(PROG, MINIMUM-VERSION, [TOO-BIG-VERSION], dnl [ACTION-IF-TRUE], [ACTION-IF-FALSE]) dnl ========================================================================= AC_DEFUN([_AX_LUA_CHK_VER], [ dnl Check that the Lua version is within the bounds. Only the major and minor dnl version numbers are considered. This should work for Lua interpreters dnl version 5.0 and beyond. _ax_lua_good_version=[`$1 -e ' -- a script to compare versions function verstr2num(verstr) local _, _, majorver, minorver = string.find(verstr, "^(%d+)%.(%d+)") if majorver and minorver then return tonumber(majorver) * 100 + tonumber(minorver) end end local minver = verstr2num("$2") local _, _, trimver = string.find(_VERSION, "^Lua (.*)") local ver = verstr2num(trimver) local maxver = verstr2num("$3") or 1e9 if minver <= ver and ver < maxver then print("yes") else print("no") end'`] AS_IF([test "x$_ax_lua_good_version" = "xyes"], [$4], [$5]) ]) dnl ========================================================================= dnl _AX_LUA_FND_PRFX_PTH(PROG, PREFIX, SCRIPT-OR-MODULE-DIR) dnl ========================================================================= AC_DEFUN([_AX_LUA_FND_PRFX_PTH], [ dnl Get the script or module directory by querying the Lua interpreter, dnl filtering on the given prefix, and selecting the shallowest path. If no dnl path is found matching the prefix, the result will be an empty string. dnl The third argument determines the type of search, it can be 'script' or dnl 'module'. Supplying 'script' will perform the search with package.path dnl and LUA_PATH, and supplying 'module' will search with package.cpath and dnl LUA_CPATH. This is done for compatibility with Lua 5.0. ax_lua_prefixed_path=[`$1 -e ' -- get the path based on search type local searchtype = "$3" local paths = "" if searchtype == "script" then paths = (package and package.path) or LUA_PATH elseif searchtype == "module" then paths = (package and package.cpath) or LUA_CPATH end -- search for the prefix local prefix = "'$2'" local minpath = "" local mindepth = 1e9 string.gsub(paths, "(@<:@^;@:>@+)", function (path) path = string.gsub(path, "%?.*$", "") path = string.gsub(path, "/@<:@^/@:>@*$", "") if string.find(path, prefix) then local depth = string.len(string.gsub(path, "@<:@^/@:>@", "")) if depth < mindepth then minpath = path mindepth = depth end end end) print(minpath)'`] ]) dnl ========================================================================= dnl AX_LUA_HEADERS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ========================================================================= AC_DEFUN([AX_LUA_HEADERS], [ dnl Check for LUA_VERSION. AC_MSG_CHECKING([if LUA_VERSION is defined]) AS_IF([test "x$LUA_VERSION" != 'x'], [AC_MSG_RESULT([yes])], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([cannot check Lua headers without knowing LUA_VERSION]) ]) dnl Make LUA_INCLUDE a precious variable. AC_ARG_VAR([LUA_INCLUDE], [The Lua includes, e.g. -I/usr/include/lua5.1]) dnl Some default directories to search. LUA_SHORT_VERSION=`echo "$LUA_VERSION" | $SED 's|\.||'` m4_define_default([_AX_LUA_INCLUDE_LIST], [ /usr/include/lua$LUA_VERSION \ /usr/include/lua-$LUA_VERSION \ /usr/include/lua/$LUA_VERSION \ /usr/include/lua$LUA_SHORT_VERSION \ /usr/local/include/lua$LUA_VERSION \ /usr/local/include/lua-$LUA_VERSION \ /usr/local/include/lua/$LUA_VERSION \ /usr/local/include/lua$LUA_SHORT_VERSION \ ]) dnl Try to find the headers. _ax_lua_saved_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $LUA_INCLUDE" AC_CHECK_HEADERS([lua.h lualib.h lauxlib.h luaconf.h]) CPPFLAGS=$_ax_lua_saved_cppflags dnl Try some other directories if LUA_INCLUDE was not set. AS_IF([test "x$LUA_INCLUDE" = 'x' && test "x$ac_cv_header_lua_h" != 'xyes'], [ dnl Try some common include paths. for _ax_include_path in _AX_LUA_INCLUDE_LIST; do test ! -d "$_ax_include_path" && continue AC_MSG_CHECKING([for Lua headers in]) AC_MSG_RESULT([$_ax_include_path]) AS_UNSET([ac_cv_header_lua_h]) AS_UNSET([ac_cv_header_lualib_h]) AS_UNSET([ac_cv_header_lauxlib_h]) AS_UNSET([ac_cv_header_luaconf_h]) _ax_lua_saved_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$_ax_include_path" AC_CHECK_HEADERS([lua.h lualib.h lauxlib.h luaconf.h]) CPPFLAGS=$_ax_lua_saved_cppflags AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'], [ LUA_INCLUDE="-I$_ax_include_path" break ]) done ]) AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'], [ dnl Make a program to print LUA_VERSION defined in the header. dnl TODO It would be really nice if we could do this without compiling a dnl program, then it would work when cross compiling. But I'm not sure how dnl to do this reliably. For now, assume versions match when cross compiling. AS_IF([test "x$cross_compiling" != 'xyes'], [ AC_CACHE_CHECK([for Lua header version], [ax_cv_lua_header_version], [ _ax_lua_saved_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $LUA_INCLUDE" AC_COMPUTE_INT(ax_cv_lua_header_version_major,[LUA_VERSION_NUM/100],[AC_INCLUDES_DEFAULT #include ],[ax_cv_lua_header_version_major=unknown]) AC_COMPUTE_INT(ax_cv_lua_header_version_minor,[LUA_VERSION_NUM%100],[AC_INCLUDES_DEFAULT #include ],[ax_cv_lua_header_version_minor=unknown]) AS_IF([test "x$ax_cv_lua_header_version_major" = xunknown || test "x$ax_cv_lua_header_version_minor" = xunknown],[ ax_cv_lua_header_version=unknown ],[ ax_cv_lua_header_version="$ax_cv_lua_header_version_major.$ax_cv_lua_header_version_minor" ]) CPPFLAGS=$_ax_lua_saved_cppflags ]) dnl Compare this to the previously found LUA_VERSION. AC_MSG_CHECKING([if Lua header version matches $LUA_VERSION]) AS_IF([test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"], [ AC_MSG_RESULT([yes]) ax_header_version_match='yes' ], [ AC_MSG_RESULT([no]) ax_header_version_match='no' ]) ], [ AC_MSG_WARN([cross compiling so assuming header version number matches]) ax_header_version_match='yes' ]) ]) dnl Was LUA_INCLUDE specified? AS_IF([test "x$ax_header_version_match" != 'xyes' && test "x$LUA_INCLUDE" != 'x'], [AC_MSG_ERROR([cannot find headers for specified LUA_INCLUDE])]) dnl Test the final result and run user code. AS_IF([test "x$ax_header_version_match" = 'xyes'], [$1], [m4_default([$2], [AC_MSG_ERROR([cannot find Lua includes])])]) ]) dnl AX_LUA_HEADERS_VERSION no longer exists, use AX_LUA_HEADERS. AC_DEFUN([AX_LUA_HEADERS_VERSION], [ AC_MSG_WARN([[$0 is deprecated, please use AX_LUA_HEADERS instead]]) ]) dnl ========================================================================= dnl AX_LUA_LIBS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ========================================================================= AC_DEFUN([AX_LUA_LIBS], [ dnl TODO Should this macro also check various -L flags? dnl Check for LUA_VERSION. AC_MSG_CHECKING([if LUA_VERSION is defined]) AS_IF([test "x$LUA_VERSION" != 'x'], [AC_MSG_RESULT([yes])], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([cannot check Lua libs without knowing LUA_VERSION]) ]) dnl Make LUA_LIB a precious variable. AC_ARG_VAR([LUA_LIB], [The Lua library, e.g. -llua5.1]) AS_IF([test "x$LUA_LIB" != 'x'], [ dnl Check that LUA_LIBS works. _ax_lua_saved_libs=$LIBS LIBS="$LIBS $LUA_LIB" AC_SEARCH_LIBS([lua_load], [], [_ax_found_lua_libs='yes'], [_ax_found_lua_libs='no']) LIBS=$_ax_lua_saved_libs dnl Check the result. AS_IF([test "x$_ax_found_lua_libs" != 'xyes'], [AC_MSG_ERROR([cannot find libs for specified LUA_LIB])]) ], [ dnl First search for extra libs. _ax_lua_extra_libs='' _ax_lua_saved_libs=$LIBS LIBS="$LIBS $LUA_LIB" AC_SEARCH_LIBS([exp], [m]) AC_SEARCH_LIBS([dlopen], [dl]) LIBS=$_ax_lua_saved_libs AS_IF([test "x$ac_cv_search_exp" != 'xno' && test "x$ac_cv_search_exp" != 'xnone required'], [_ax_lua_extra_libs="$_ax_lua_extra_libs $ac_cv_search_exp"]) AS_IF([test "x$ac_cv_search_dlopen" != 'xno' && test "x$ac_cv_search_dlopen" != 'xnone required'], [_ax_lua_extra_libs="$_ax_lua_extra_libs $ac_cv_search_dlopen"]) dnl Try to find the Lua libs. _ax_lua_saved_libs=$LIBS LIBS="$LIBS $LUA_LIB" AC_SEARCH_LIBS([lua_load], [ lua$LUA_VERSION \ lua$LUA_SHORT_VERSION \ lua-$LUA_VERSION \ lua-$LUA_SHORT_VERSION \ lua \ ], [_ax_found_lua_libs='yes'], [_ax_found_lua_libs='no'], [$_ax_lua_extra_libs]) LIBS=$_ax_lua_saved_libs AS_IF([test "x$ac_cv_search_lua_load" != 'xno' && test "x$ac_cv_search_lua_load" != 'xnone required'], [LUA_LIB="$ac_cv_search_lua_load $_ax_lua_extra_libs"]) ]) dnl Test the result and run user code. AS_IF([test "x$_ax_found_lua_libs" = 'xyes'], [$1], [m4_default([$2], [AC_MSG_ERROR([cannot find Lua libs])])]) ]) dnl ========================================================================= dnl AX_LUA_READLINE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ========================================================================= AC_DEFUN([AX_LUA_READLINE], [ AX_LIB_READLINE AS_IF([test "x$ac_cv_header_readline_readline_h" != 'x' && test "x$ac_cv_header_readline_history_h" != 'x'], [ LUA_LIBS_CFLAGS="-DLUA_USE_READLINE $LUA_LIBS_CFLAGS" $1 ], [$2]) ]) crun-1.16.1/m4/libtool.m40000644000000000000000000112530614656670152013207 0ustar0000000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ]) # serial 58 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS crun-1.16.1/m4/ltoptions.m40000644000000000000000000003426214656670152013575 0ustar0000000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) crun-1.16.1/m4/ltsugar.m40000644000000000000000000001044014656670152013213 0ustar0000000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) crun-1.16.1/m4/ltversion.m40000644000000000000000000000127314656670152013563 0ustar0000000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) crun-1.16.1/m4/lt~obsolete.m40000644000000000000000000001377414656670152014121 0ustar0000000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) crun-1.16.1/python/0000755000000000000000000000000014656670213012270 5ustar0000000000000000crun-1.16.1/python/crun_python.c0000644000000000000000000003176614614667631015025 0ustar0000000000000000/* *crun - OCI runtime written in C * *Copyright (C) 2018, 2019 Giuseppe Scrivano *crun is free software; you can redistribute it and/or modify *it under the terms of the GNU Lesser General Public License as published by *the Free Software Foundation; either version 2.1 of the License, or *(at your option) any later version. * *crun 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 crun. If not, see . */ /* An example of using this module: import python_crun import json spec = json.loads(python_crun.spec()) spec['root']['path'] = '/path/to/the/rootfs' spec['process']['args'] = ['/bin/echo', 'hello from a container'] ctr = python_crun.load_from_memory(json.dumps(spec)) ctx = python_crun.make_context("test-container") python_crun.set_verbosity(python_crun.VERBOSITY_ERROR) python_crun.run(ctx, ctr) */ #include #include #include #include #include #include #define CONTEXT_OBJ_TAG "crun-context" #define CONTAINER_OBJ_TAG "crun-container" static PyObject * set_error (libcrun_error_t *err) { if ((*err)->status == 0) PyErr_SetString (PyExc_RuntimeError, (*err)->msg); else { cleanup_free char *msg = NULL; int ret; ret = asprintf (&msg, "%s: %s", (*err)->msg, strerror ((*err)->status)); if (LIKELY (ret >= 0)) PyErr_SetString (PyExc_RuntimeError, msg); } libcrun_error_release (err); return NULL; } static void free_container (PyObject *ptr) { libcrun_container_t *ctr = PyCapsule_GetPointer (ptr, CONTAINER_OBJ_TAG); free_runtime_spec_schema_config_schema (ctr->container_def); } static PyObject * container_load_from_file (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; const char *path; libcrun_container_t *ctr; if (!PyArg_ParseTuple (args, "s", &path)) return NULL; ctr = libcrun_container_load_from_file (path, &err); if (ctr == NULL) return set_error (&err); return PyCapsule_New (ctr, CONTAINER_OBJ_TAG, free_container); } static PyObject * container_load_from_memory (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; const char *def; libcrun_container_t *ctr; if (!PyArg_ParseTuple (args, "s", &def)) return NULL; ctr = libcrun_container_load_from_memory (def, &err); if (ctr == NULL) return set_error (&err); return PyCapsule_New (ctr, CONTAINER_OBJ_TAG, free_container); } static void free_context (void *ptr) { libcrun_context_t *ctx = ptr; char *id = (char *) ctx->id; free (ctx->state_root); free (ctx->notify_socket); free (id); free (ctx); } static PyObject * make_context (PyObject *self arg_unused, PyObject *args, PyObject *kwargs) { char *id = NULL; char *bundle = NULL; char *state_root = NULL; char *notify_socket = NULL; static char *kwlist[] = { "id", "bundle", "state_root", "systemd_cgroup", "notify_socket", "detach", "no_new_keyring", "force_no_cgroup", "no_pivot", NULL }; libcrun_context_t *ctx = malloc (sizeof (*ctx)); if (ctx == NULL) return NULL; memset (ctx, 0, sizeof (*ctx)); ctx->fifo_exec_wait_fd = -1; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s|ssbsbbbb", kwlist, &id, &bundle, &state_root, &ctx->systemd_cgroup, ¬ify_socket, &ctx->detach, &ctx->no_new_keyring, &ctx->force_no_cgroup, &ctx->no_pivot)) return NULL; ctx->id = xstrdup (id); ctx->bundle = xstrdup (bundle ? bundle : "."); ctx->state_root = xstrdup (state_root); ctx->notify_socket = xstrdup (notify_socket); return PyCapsule_New (ctx, CONTEXT_OBJ_TAG, NULL); } static PyObject * container_run (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; PyObject *ctx_obj = NULL; PyObject *ctr_obj = NULL; libcrun_container_t *ctr; libcrun_context_t *ctx; int ret; if (!PyArg_ParseTuple (args, "OO", &ctx_obj, &ctr_obj)) return NULL; ctx = PyCapsule_GetPointer (ctx_obj, CONTEXT_OBJ_TAG); if (ctx == NULL) return NULL; ctr = PyCapsule_GetPointer (ctr_obj, CONTAINER_OBJ_TAG); if (ctr == NULL) return NULL; Py_BEGIN_ALLOW_THREADS; ret = libcrun_container_run (ctx, ctr, 0, &err); Py_END_ALLOW_THREADS; if (ret < 0) return set_error (&err); return PyLong_FromLong (ret); } static PyObject * container_create (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; PyObject *ctx_obj = NULL; PyObject *ctr_obj = NULL; libcrun_container_t *ctr; libcrun_context_t *ctx; int ret; if (!PyArg_ParseTuple (args, "OO", &ctx_obj, &ctr_obj)) return NULL; ctx = PyCapsule_GetPointer (ctx_obj, CONTEXT_OBJ_TAG); if (ctx == NULL) return NULL; ctr = PyCapsule_GetPointer (ctr_obj, CONTAINER_OBJ_TAG); if (ctr == NULL) return NULL; Py_BEGIN_ALLOW_THREADS; ret = libcrun_container_create (ctx, ctr, LIBCRUN_CREATE_OPTIONS_PREFORK, &err); Py_END_ALLOW_THREADS; if (ret < 0) return set_error (&err); return PyLong_FromLong (ret); } static PyObject * container_delete (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; PyObject *ctx_obj = NULL; char *id = NULL; bool force; libcrun_context_t *ctx; int ret; if (!PyArg_ParseTuple (args, "Osb", &ctx_obj, &id, &force)) return NULL; ctx = PyCapsule_GetPointer (ctx_obj, CONTEXT_OBJ_TAG); if (ctx == NULL) return NULL; Py_BEGIN_ALLOW_THREADS; ret = libcrun_container_delete (ctx, NULL, id, force, &err); Py_END_ALLOW_THREADS; if (ret < 0) return set_error (&err); Py_RETURN_NONE; } static PyObject * container_kill (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; PyObject *ctx_obj = NULL; char *id = NULL; char *signal; libcrun_context_t *ctx; int ret; if (!PyArg_ParseTuple (args, "Oss", &ctx_obj, &id, &signal)) return NULL; ctx = PyCapsule_GetPointer (ctx_obj, CONTEXT_OBJ_TAG); if (ctx == NULL) return NULL; Py_BEGIN_ALLOW_THREADS; ret = libcrun_container_kill (ctx, id, signal, &err); Py_END_ALLOW_THREADS; if (ret < 0) return set_error (&err); Py_RETURN_NONE; } static PyObject * container_start (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; PyObject *ctx_obj = NULL; char *id = NULL; libcrun_context_t *ctx; int ret; if (!PyArg_ParseTuple (args, "Os", &ctx_obj, &id)) return NULL; ctx = PyCapsule_GetPointer (ctx_obj, CONTEXT_OBJ_TAG); if (ctx == NULL) return NULL; Py_BEGIN_ALLOW_THREADS; ret = libcrun_container_start (ctx, id, &err); Py_END_ALLOW_THREADS; if (ret < 0) return set_error (&err); return PyLong_FromLong (ret); } static PyObject * containers_list (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; PyObject *ctx_obj = NULL; libcrun_context_t *ctx; libcrun_container_list_t *containers, *it; PyObject *retobj; Py_ssize_t i = 0; int ret; if (!PyArg_ParseTuple (args, "O", &ctx_obj)) return NULL; ctx = PyCapsule_GetPointer (ctx_obj, CONTEXT_OBJ_TAG); if (ctx == NULL) return NULL; Py_BEGIN_ALLOW_THREADS; ret = libcrun_get_containers_list (&containers, ctx->state_root, &err); Py_END_ALLOW_THREADS; if (ret < 0) return set_error (&err); i = 0; for (it = containers; it; it = it->next) i++; retobj = PyList_New (i); if (retobj == NULL) return NULL; i = 0; for (it = containers; it; it = it->next) PyList_SetItem (retobj, i++, PyUnicode_FromString (it->name)); libcrun_free_containers_list (containers); return retobj; } static PyObject * container_status (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; PyObject *ctx_obj = NULL; libcrun_context_t *ctx; char *id = NULL; libcrun_container_status_t status; cleanup_free char *buffer = NULL; FILE *memfile; int ret; if (!PyArg_ParseTuple (args, "Os", &ctx_obj, &id)) return NULL; ctx = PyCapsule_GetPointer (ctx_obj, CONTEXT_OBJ_TAG); if (ctx == NULL) return NULL; buffer = malloc (4096); if (buffer == NULL) return NULL; /* A bit silly (and expensive), libcrun_container_state needs a refactoring to make this nicer. */ memset (buffer, 0, 4096); memfile = fmemopen (buffer, 4095, "w"); Py_BEGIN_ALLOW_THREADS; ret = libcrun_container_state (ctx, id, memfile, &err); Py_END_ALLOW_THREADS; if (ret < 0) return set_error (&err); fclose (memfile); return PyUnicode_FromString (buffer); } static int load_json_file (yajl_val *out, const char *jsondata, struct parser_context *ctx arg_unused, libcrun_error_t *err) { char errbuf[1024]; *err = NULL; *out = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (*out == NULL) return libcrun_make_error (err, 0, "cannot parse the data: `%s`", errbuf); return 0; } static PyObject * container_update (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; PyObject *ctx_obj = NULL; libcrun_context_t *ctx; char *id = NULL; char *content = NULL; yajl_val tree = NULL; int ret; parser_error parser_err = NULL; struct parser_context parser_ctx = { 0, stderr }; runtime_spec_schema_config_schema_process *process = NULL; if (!PyArg_ParseTuple (args, "Oss", &ctx_obj, &id, &content)) return NULL; ctx = PyCapsule_GetPointer (ctx_obj, CONTEXT_OBJ_TAG); if (ctx == NULL) return NULL; ret = load_json_file (&tree, content, &parser_ctx, &err); if (UNLIKELY (ret < 0)) return set_error (&err); process = make_runtime_spec_schema_config_schema_process (tree, &parser_ctx, &parser_err); yajl_tree_free (tree); if (process == NULL) { cleanup_free char *msg = NULL; ret = asprintf (&msg, "cannot parse process: %s", parser_err); if (LIKELY (ret >= 0)) PyErr_SetString (PyExc_RuntimeError, msg); free (parser_err); return NULL; } Py_BEGIN_ALLOW_THREADS; ret = libcrun_container_exec (ctx, id, process, &err); Py_END_ALLOW_THREADS; free_runtime_spec_schema_config_schema_process (process); if (ret < 0) return set_error (&err); Py_RETURN_NONE; } static PyObject * container_spec (PyObject *self arg_unused, PyObject *args arg_unused) { libcrun_error_t err; PyObject *ctx_obj = NULL; libcrun_context_t *ctx; char *id = NULL; libcrun_container_status_t status; cleanup_free char *buffer = NULL; FILE *memfile; int ret; buffer = malloc (4096); if (buffer == NULL) return NULL; memfile = fmemopen (buffer, 4095, "w"); Py_BEGIN_ALLOW_THREADS; ret = libcrun_container_spec (geteuid () == 0, memfile, &err); Py_END_ALLOW_THREADS; if (ret < 0) return set_error (&err); buffer[ret] = '\0'; fclose (memfile); return PyUnicode_FromString (buffer); } static PyObject * get_verbosity (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; PyObject *ctx_obj = NULL; libcrun_context_t *ctx; int verbosity; if (!PyArg_ParseTuple (args, "i", &verbosity)) return NULL; return PyLong_FromLong (libcrun_get_verbosity (verbosity)); } static PyObject * set_verbosity (PyObject *self arg_unused, PyObject *args) { libcrun_error_t err; PyObject *ctx_obj = NULL; libcrun_context_t *ctx; int verbosity; if (!PyArg_ParseTuple (args, "i", &verbosity)) return NULL; libcrun_set_verbosity (verbosity); Py_RETURN_NONE; } static PyMethodDef CrunMethods[] = { {"load_from_file", container_load_from_file, METH_VARARGS, "Load an OCI container from file."}, {"load_from_memory", container_load_from_memory, METH_VARARGS, "Load an OCI container from memory."}, {"run", container_run, METH_VARARGS, "Run a container."}, {"create", container_create, METH_VARARGS, "Create a container."}, {"delete", container_delete, METH_VARARGS, "Delete a container."}, {"kill", container_kill, METH_VARARGS, "Kill a container."}, {"list", containers_list, METH_VARARGS, "List the containers."}, {"status", container_status, METH_VARARGS, "Get the status of a container."}, {"update", container_update, METH_VARARGS, "Update the constraints of a container."}, {"spec", container_spec, METH_VARARGS, "Generate a new configuration file."}, {"make_context", (PyCFunction) make_context, METH_VARARGS | METH_KEYWORDS, "Create a context object."}, {"set_verbosity", set_verbosity, METH_VARARGS, "Set the logging verbosity."}, {"get_verbosity", get_verbosity, METH_VARARGS, "Get the logging verbosity."}, {"spec", container_spec, METH_VARARGS, "Generate a new configuration file."}, {NULL, NULL, 0, NULL} }; struct PyModuleDef crun_mod = { PyModuleDef_HEAD_INIT, "python_crun", NULL, 0, CrunMethods, }; PyMODINIT_FUNC PyInit_python_crun (void) { PyObject *ret; ret = PyModule_Create (&crun_mod); if (ret == NULL) return ret; (void) PyModule_AddIntConstant (ret, "VERBOSITY_ERROR", LIBCRUN_VERBOSITY_ERROR); (void) PyModule_AddIntConstant (ret, "VERBOSITY_WARNING", LIBCRUN_VERBOSITY_WARNING); return ret; } crun-1.16.1/rpm/0000755000000000000000000000000014656670213011545 5ustar0000000000000000crun-1.16.1/rpm/crun.spec0000644000000000000000000000715414654642544013403 0ustar0000000000000000%global krun_opts %{nil} %global wasmedge_opts %{nil} # krun and wasm[edge,time] support only on aarch64 and x86_64 %ifarch aarch64 || x86_64 %global wasm_support 1 %if %{defined copr_username} %define copr_build 1 %endif # Disable wasmedge on rhel 10 until EPEL10 is in place, otherwise it causes # build issues on copr %if %{defined fedora} || (%{defined %copr_build} && %{defined rhel} && 0%{?rhel} < 10) %global wasmedge_support 1 %global wasmedge_opts --with-wasmedge %endif # krun only exists on fedora %if %{defined fedora} %global krun_support 1 %global krun_opts --with-libkrun %endif %endif Summary: OCI runtime written in C Name: crun %if %{defined copr_build} Epoch: 102 %endif # DO NOT TOUCH the Version string! # The TRUE source of this specfile is: # https://github.com/containers/crun/blob/main/rpm/crun.spec # If that's what you're reading, Version must be 0, and will be updated by Packit for # copr and koji builds. # If you're reading this on dist-git, the version is automatically filled in by Packit. Version: 0 Release: %autorelease URL: https://github.com/containers/%{name} Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.zst License: GPL-2.0-only %if %{defined golang_arches_future} ExclusiveArch: %{golang_arches_future} %else ExclusiveArch: aarch64 ppc64le riscv64 s390x x86_64 %endif BuildRequires: autoconf BuildRequires: automake BuildRequires: gcc BuildRequires: git-core BuildRequires: gperf BuildRequires: libcap-devel %if %{defined krun_support} BuildRequires: libkrun-devel %endif BuildRequires: systemd-devel BuildRequires: yajl-devel BuildRequires: libseccomp-devel BuildRequires: python3-libmount BuildRequires: libtool BuildRequires: protobuf-c-devel BuildRequires: criu-devel >= 3.17.1-2 Recommends: criu >= 3.17.1 Recommends: criu-libs %if %{defined wasmedge_support} BuildRequires: wasmedge-devel %endif BuildRequires: python Provides: oci-runtime %description %{name} is a OCI runtime %if %{defined krun_support} %package krun Summary: %{name} with libkrun support Requires: libkrun Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} Provides: krun = %{?epoch:%{epoch}:}%{version}-%{release} %description krun krun is a symlink to the %{name} binary, with libkrun as an additional dependency. %endif %if %{defined wasm_support} %package wasm Summary: %{name} with wasm support Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} # The hard dep on wasm-library is causing trouble in internal testing farm # with RHEL. %if %{defined fedora} Requires: wasm-library %else Recommends: wasm-library %endif Recommends: wasmedge %description wasm %{name}-wasm is a symlink to the %{name} binary, with wasm as an additional dependency. %endif %prep %autosetup -Sgit -n %{name}-%{version} %build ./autogen.sh ./configure --disable-silent-rules %{krun_opts} %{wasmedge_opts} %make_build %install %make_install prefix=%{_prefix} rm -rf %{buildroot}%{_prefix}/lib* %if %{defined wasm_support} ln -s %{name} %{buildroot}%{_bindir}/%{name}-wasm %endif %files %license COPYING %{_bindir}/%{name} %{_mandir}/man1/%{name}.1.gz %if %{defined krun_support} %files krun %license COPYING %{_bindir}/krun %{_mandir}/man1/krun.1.gz %endif %if %{defined wasm_support} %files wasm %license COPYING %{_bindir}/%{name}-wasm %endif %changelog %if %{defined autochangelog} %autochangelog %else # NOTE: This changelog will be visible on CentOS 8 Stream builds # Other envs are capable of handling autochangelog * Tue Jun 13 2023 RH Container Bot - Placeholder changelog for envs that are not autochangelog-ready. - Contact upstream if you need to report an issue with the build. %endif crun-1.16.1/src/0000755000000000000000000000000014656670213011536 5ustar0000000000000000crun-1.16.1/src/libcrun/0000755000000000000000000000000014656670213013174 5ustar0000000000000000crun-1.16.1/src/libcrun/blake3/0000755000000000000000000000000014656670213014335 5ustar0000000000000000crun-1.16.1/src/libcrun/blake3/blake3.c0000644000000000000000000006565614654642544015670 0ustar0000000000000000#include #include #include #include "blake3.h" #include "blake3_impl.h" const char *blake3_version(void) { return BLAKE3_VERSION_STRING; } INLINE void chunk_state_init(blake3_chunk_state *self, const uint32_t key[8], uint8_t flags) { memcpy(self->cv, key, BLAKE3_KEY_LEN); self->chunk_counter = 0; memset(self->buf, 0, BLAKE3_BLOCK_LEN); self->buf_len = 0; self->blocks_compressed = 0; self->flags = flags; } INLINE void chunk_state_reset(blake3_chunk_state *self, const uint32_t key[8], uint64_t chunk_counter) { memcpy(self->cv, key, BLAKE3_KEY_LEN); self->chunk_counter = chunk_counter; self->blocks_compressed = 0; memset(self->buf, 0, BLAKE3_BLOCK_LEN); self->buf_len = 0; } INLINE size_t chunk_state_len(const blake3_chunk_state *self) { return (BLAKE3_BLOCK_LEN * (size_t)self->blocks_compressed) + ((size_t)self->buf_len); } INLINE size_t chunk_state_fill_buf(blake3_chunk_state *self, const uint8_t *input, size_t input_len) { size_t take = BLAKE3_BLOCK_LEN - ((size_t)self->buf_len); if (take > input_len) { take = input_len; } uint8_t *dest = self->buf + ((size_t)self->buf_len); memcpy(dest, input, take); self->buf_len += (uint8_t)take; return take; } INLINE uint8_t chunk_state_maybe_start_flag(const blake3_chunk_state *self) { if (self->blocks_compressed == 0) { return CHUNK_START; } else { return 0; } } typedef struct { uint32_t input_cv[8]; uint64_t counter; uint8_t block[BLAKE3_BLOCK_LEN]; uint8_t block_len; uint8_t flags; } output_t; INLINE output_t make_output(const uint32_t input_cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags) { output_t ret; memcpy(ret.input_cv, input_cv, 32); memcpy(ret.block, block, BLAKE3_BLOCK_LEN); ret.block_len = block_len; ret.counter = counter; ret.flags = flags; return ret; } // Chaining values within a given chunk (specifically the compress_in_place // interface) are represented as words. This avoids unnecessary bytes<->words // conversion overhead in the portable implementation. However, the hash_many // interface handles both user input and parent node blocks, so it accepts // bytes. For that reason, chaining values in the CV stack are represented as // bytes. INLINE void output_chaining_value(const output_t *self, uint8_t cv[32]) { uint32_t cv_words[8]; memcpy(cv_words, self->input_cv, 32); blake3_compress_in_place(cv_words, self->block, self->block_len, self->counter, self->flags); store_cv_words(cv, cv_words); } INLINE void output_root_bytes(const output_t *self, uint64_t seek, uint8_t *out, size_t out_len) { uint64_t output_block_counter = seek / 64; size_t offset_within_block = seek % 64; uint8_t wide_buf[64]; while (out_len > 0) { blake3_compress_xof(self->input_cv, self->block, self->block_len, output_block_counter, self->flags | ROOT, wide_buf); size_t available_bytes = 64 - offset_within_block; size_t memcpy_len; if (out_len > available_bytes) { memcpy_len = available_bytes; } else { memcpy_len = out_len; } memcpy(out, wide_buf + offset_within_block, memcpy_len); out += memcpy_len; out_len -= memcpy_len; output_block_counter += 1; offset_within_block = 0; } } INLINE void chunk_state_update(blake3_chunk_state *self, const uint8_t *input, size_t input_len) { if (self->buf_len > 0) { size_t take = chunk_state_fill_buf(self, input, input_len); input += take; input_len -= take; if (input_len > 0) { blake3_compress_in_place( self->cv, self->buf, BLAKE3_BLOCK_LEN, self->chunk_counter, self->flags | chunk_state_maybe_start_flag(self)); self->blocks_compressed += 1; self->buf_len = 0; memset(self->buf, 0, BLAKE3_BLOCK_LEN); } } while (input_len > BLAKE3_BLOCK_LEN) { blake3_compress_in_place(self->cv, input, BLAKE3_BLOCK_LEN, self->chunk_counter, self->flags | chunk_state_maybe_start_flag(self)); self->blocks_compressed += 1; input += BLAKE3_BLOCK_LEN; input_len -= BLAKE3_BLOCK_LEN; } size_t take = chunk_state_fill_buf(self, input, input_len); input += take; input_len -= take; } INLINE output_t chunk_state_output(const blake3_chunk_state *self) { uint8_t block_flags = self->flags | chunk_state_maybe_start_flag(self) | CHUNK_END; return make_output(self->cv, self->buf, self->buf_len, self->chunk_counter, block_flags); } INLINE output_t parent_output(const uint8_t block[BLAKE3_BLOCK_LEN], const uint32_t key[8], uint8_t flags) { return make_output(key, block, BLAKE3_BLOCK_LEN, 0, flags | PARENT); } // Given some input larger than one chunk, return the number of bytes that // should go in the left subtree. This is the largest power-of-2 number of // chunks that leaves at least 1 byte for the right subtree. INLINE size_t left_len(size_t content_len) { // Subtract 1 to reserve at least one byte for the right side. content_len // should always be greater than BLAKE3_CHUNK_LEN. size_t full_chunks = (content_len - 1) / BLAKE3_CHUNK_LEN; return round_down_to_power_of_2(full_chunks) * BLAKE3_CHUNK_LEN; } // Use SIMD parallelism to hash up to MAX_SIMD_DEGREE chunks at the same time // on a single thread. Write out the chunk chaining values and return the // number of chunks hashed. These chunks are never the root and never empty; // those cases use a different codepath. INLINE size_t compress_chunks_parallel(const uint8_t *input, size_t input_len, const uint32_t key[8], uint64_t chunk_counter, uint8_t flags, uint8_t *out) { #if defined(BLAKE3_TESTING) assert(0 < input_len); assert(input_len <= MAX_SIMD_DEGREE * BLAKE3_CHUNK_LEN); #endif const uint8_t *chunks_array[MAX_SIMD_DEGREE] = {0, }; size_t input_position = 0; size_t chunks_array_len = 0; while (input_len - input_position >= BLAKE3_CHUNK_LEN) { chunks_array[chunks_array_len] = &input[input_position]; input_position += BLAKE3_CHUNK_LEN; chunks_array_len += 1; } blake3_hash_many(chunks_array, chunks_array_len, BLAKE3_CHUNK_LEN / BLAKE3_BLOCK_LEN, key, chunk_counter, true, flags, CHUNK_START, CHUNK_END, out); // Hash the remaining partial chunk, if there is one. Note that the empty // chunk (meaning the empty message) is a different codepath. if (input_len > input_position) { uint64_t counter = chunk_counter + (uint64_t)chunks_array_len; blake3_chunk_state chunk_state; chunk_state_init(&chunk_state, key, flags); chunk_state.chunk_counter = counter; chunk_state_update(&chunk_state, &input[input_position], input_len - input_position); output_t output = chunk_state_output(&chunk_state); output_chaining_value(&output, &out[chunks_array_len * BLAKE3_OUT_LEN]); return chunks_array_len + 1; } else { return chunks_array_len; } } // Use SIMD parallelism to hash up to MAX_SIMD_DEGREE parents at the same time // on a single thread. Write out the parent chaining values and return the // number of parents hashed. (If there's an odd input chaining value left over, // return it as an additional output.) These parents are never the root and // never empty; those cases use a different codepath. INLINE size_t compress_parents_parallel(const uint8_t *child_chaining_values, size_t num_chaining_values, const uint32_t key[8], uint8_t flags, uint8_t *out) { #if defined(BLAKE3_TESTING) assert(2 <= num_chaining_values); assert(num_chaining_values <= 2 * MAX_SIMD_DEGREE_OR_2); #endif const uint8_t *parents_array[MAX_SIMD_DEGREE_OR_2]; size_t parents_array_len = 0; while (num_chaining_values - (2 * parents_array_len) >= 2) { parents_array[parents_array_len] = &child_chaining_values[2 * parents_array_len * BLAKE3_OUT_LEN]; parents_array_len += 1; } blake3_hash_many(parents_array, parents_array_len, 1, key, 0, // Parents always use counter 0. false, flags | PARENT, 0, // Parents have no start flags. 0, // Parents have no end flags. out); // If there's an odd child left over, it becomes an output. if (num_chaining_values > 2 * parents_array_len) { memcpy(&out[parents_array_len * BLAKE3_OUT_LEN], &child_chaining_values[2 * parents_array_len * BLAKE3_OUT_LEN], BLAKE3_OUT_LEN); return parents_array_len + 1; } else { return parents_array_len; } } // The wide helper function returns (writes out) an array of chaining values // and returns the length of that array. The number of chaining values returned // is the dynamically detected SIMD degree, at most MAX_SIMD_DEGREE. Or fewer, // if the input is shorter than that many chunks. The reason for maintaining a // wide array of chaining values going back up the tree, is to allow the // implementation to hash as many parents in parallel as possible. // // As a special case when the SIMD degree is 1, this function will still return // at least 2 outputs. This guarantees that this function doesn't perform the // root compression. (If it did, it would use the wrong flags, and also we // wouldn't be able to implement extendable output.) Note that this function is // not used when the whole input is only 1 chunk long; that's a different // codepath. // // Why not just have the caller split the input on the first update(), instead // of implementing this special rule? Because we don't want to limit SIMD or // multi-threading parallelism for that update(). static size_t blake3_compress_subtree_wide(const uint8_t *input, size_t input_len, const uint32_t key[8], uint64_t chunk_counter, uint8_t flags, uint8_t *out) { // Note that the single chunk case does *not* bump the SIMD degree up to 2 // when it is 1. If this implementation adds multi-threading in the future, // this gives us the option of multi-threading even the 2-chunk case, which // can help performance on smaller platforms. if (input_len <= blake3_simd_degree() * BLAKE3_CHUNK_LEN) { return compress_chunks_parallel(input, input_len, key, chunk_counter, flags, out); } // With more than simd_degree chunks, we need to recurse. Start by dividing // the input into left and right subtrees. (Note that this is only optimal // as long as the SIMD degree is a power of 2. If we ever get a SIMD degree // of 3 or something, we'll need a more complicated strategy.) size_t left_input_len = left_len(input_len); size_t right_input_len = input_len - left_input_len; const uint8_t *right_input = &input[left_input_len]; uint64_t right_chunk_counter = chunk_counter + (uint64_t)(left_input_len / BLAKE3_CHUNK_LEN); // Make space for the child outputs. Here we use MAX_SIMD_DEGREE_OR_2 to // account for the special case of returning 2 outputs when the SIMD degree // is 1. uint8_t cv_array[2 * MAX_SIMD_DEGREE_OR_2 * BLAKE3_OUT_LEN]; size_t degree = blake3_simd_degree(); if (left_input_len > BLAKE3_CHUNK_LEN && degree == 1) { // The special case: We always use a degree of at least two, to make // sure there are two outputs. Except, as noted above, at the chunk // level, where we allow degree=1. (Note that the 1-chunk-input case is // a different codepath.) degree = 2; } uint8_t *right_cvs = &cv_array[degree * BLAKE3_OUT_LEN]; // Recurse! If this implementation adds multi-threading support in the // future, this is where it will go. size_t left_n = blake3_compress_subtree_wide(input, left_input_len, key, chunk_counter, flags, cv_array); size_t right_n = blake3_compress_subtree_wide( right_input, right_input_len, key, right_chunk_counter, flags, right_cvs); // The special case again. If simd_degree=1, then we'll have left_n=1 and // right_n=1. Rather than compressing them into a single output, return // them directly, to make sure we always have at least two outputs. if (left_n == 1) { memcpy(out, cv_array, 2 * BLAKE3_OUT_LEN); return 2; } // Otherwise, do one layer of parent node compression. size_t num_chaining_values = left_n + right_n; return compress_parents_parallel(cv_array, num_chaining_values, key, flags, out); } // Hash a subtree with compress_subtree_wide(), and then condense the resulting // list of chaining values down to a single parent node. Don't compress that // last parent node, however. Instead, return its message bytes (the // concatenated chaining values of its children). This is necessary when the // first call to update() supplies a complete subtree, because the topmost // parent node of that subtree could end up being the root. It's also necessary // for extended output in the general case. // // As with compress_subtree_wide(), this function is not used on inputs of 1 // chunk or less. That's a different codepath. INLINE void compress_subtree_to_parent_node( const uint8_t *input, size_t input_len, const uint32_t key[8], uint64_t chunk_counter, uint8_t flags, uint8_t out[2 * BLAKE3_OUT_LEN]) { #if defined(BLAKE3_TESTING) assert(input_len > BLAKE3_CHUNK_LEN); #endif uint8_t cv_array[MAX_SIMD_DEGREE_OR_2 * BLAKE3_OUT_LEN]; size_t num_cvs = blake3_compress_subtree_wide(input, input_len, key, chunk_counter, flags, cv_array); assert(num_cvs <= MAX_SIMD_DEGREE_OR_2); // If MAX_SIMD_DEGREE is greater than 2 and there's enough input, // compress_subtree_wide() returns more than 2 chaining values. Condense // them into 2 by forming parent nodes repeatedly. uint8_t out_array[MAX_SIMD_DEGREE_OR_2 * BLAKE3_OUT_LEN / 2]; // The second half of this loop condition is always true, and we just // asserted it above. But GCC can't tell that it's always true, and if NDEBUG // is set on platforms where MAX_SIMD_DEGREE_OR_2 == 2, GCC emits spurious // warnings here. GCC 8.5 is particularly sensitive, so if you're changing // this code, test it against that version. while (num_cvs > 2 && num_cvs <= MAX_SIMD_DEGREE_OR_2) { num_cvs = compress_parents_parallel(cv_array, num_cvs, key, flags, out_array); memcpy(cv_array, out_array, num_cvs * BLAKE3_OUT_LEN); } memcpy(out, cv_array, 2 * BLAKE3_OUT_LEN); } INLINE void hasher_init_base(blake3_hasher *self, const uint32_t key[8], uint8_t flags) { memcpy(self->key, key, BLAKE3_KEY_LEN); chunk_state_init(&self->chunk, key, flags); self->cv_stack_len = 0; } void blake3_hasher_init(blake3_hasher *self) { hasher_init_base(self, IV, 0); } void blake3_hasher_init_keyed(blake3_hasher *self, const uint8_t key[BLAKE3_KEY_LEN]) { uint32_t key_words[8]; load_key_words(key, key_words); hasher_init_base(self, key_words, KEYED_HASH); } void blake3_hasher_init_derive_key_raw(blake3_hasher *self, const void *context, size_t context_len) { blake3_hasher context_hasher; hasher_init_base(&context_hasher, IV, DERIVE_KEY_CONTEXT); blake3_hasher_update(&context_hasher, context, context_len); uint8_t context_key[BLAKE3_KEY_LEN]; blake3_hasher_finalize(&context_hasher, context_key, BLAKE3_KEY_LEN); uint32_t context_key_words[8]; load_key_words(context_key, context_key_words); hasher_init_base(self, context_key_words, DERIVE_KEY_MATERIAL); } void blake3_hasher_init_derive_key(blake3_hasher *self, const char *context) { blake3_hasher_init_derive_key_raw(self, context, strlen(context)); } // As described in hasher_push_cv() below, we do "lazy merging", delaying // merges until right before the next CV is about to be added. This is // different from the reference implementation. Another difference is that we // aren't always merging 1 chunk at a time. Instead, each CV might represent // any power-of-two number of chunks, as long as the smaller-above-larger stack // order is maintained. Instead of the "count the trailing 0-bits" algorithm // described in the spec, we use a "count the total number of 1-bits" variant // that doesn't require us to retain the subtree size of the CV on top of the // stack. The principle is the same: each CV that should remain in the stack is // represented by a 1-bit in the total number of chunks (or bytes) so far. INLINE void hasher_merge_cv_stack(blake3_hasher *self, uint64_t total_len) { size_t post_merge_stack_len = (size_t)popcnt(total_len); while (self->cv_stack_len > post_merge_stack_len) { uint8_t *parent_node = &self->cv_stack[(self->cv_stack_len - 2) * BLAKE3_OUT_LEN]; output_t output = parent_output(parent_node, self->key, self->chunk.flags); output_chaining_value(&output, parent_node); self->cv_stack_len -= 1; } } // In reference_impl.rs, we merge the new CV with existing CVs from the stack // before pushing it. We can do that because we know more input is coming, so // we know none of the merges are root. // // This setting is different. We want to feed as much input as possible to // compress_subtree_wide(), without setting aside anything for the chunk_state. // If the user gives us 64 KiB, we want to parallelize over all 64 KiB at once // as a single subtree, if at all possible. // // This leads to two problems: // 1) This 64 KiB input might be the only call that ever gets made to update. // In this case, the root node of the 64 KiB subtree would be the root node // of the whole tree, and it would need to be ROOT finalized. We can't // compress it until we know. // 2) This 64 KiB input might complete a larger tree, whose root node is // similarly going to be the the root of the whole tree. For example, maybe // we have 196 KiB (that is, 128 + 64) hashed so far. We can't compress the // node at the root of the 256 KiB subtree until we know how to finalize it. // // The second problem is solved with "lazy merging". That is, when we're about // to add a CV to the stack, we don't merge it with anything first, as the // reference impl does. Instead we do merges using the *previous* CV that was // added, which is sitting on top of the stack, and we put the new CV // (unmerged) on top of the stack afterwards. This guarantees that we never // merge the root node until finalize(). // // Solving the first problem requires an additional tool, // compress_subtree_to_parent_node(). That function always returns the top // *two* chaining values of the subtree it's compressing. We then do lazy // merging with each of them separately, so that the second CV will always // remain unmerged. (That also helps us support extendable output when we're // hashing an input all-at-once.) INLINE void hasher_push_cv(blake3_hasher *self, uint8_t new_cv[BLAKE3_OUT_LEN], uint64_t chunk_counter) { hasher_merge_cv_stack(self, chunk_counter); memcpy(&self->cv_stack[self->cv_stack_len * BLAKE3_OUT_LEN], new_cv, BLAKE3_OUT_LEN); self->cv_stack_len += 1; } void blake3_hasher_update(blake3_hasher *self, const void *input, size_t input_len) { // Explicitly checking for zero avoids causing UB by passing a null pointer // to memcpy. This comes up in practice with things like: // std::vector v; // blake3_hasher_update(&hasher, v.data(), v.size()); if (input_len == 0) { return; } const uint8_t *input_bytes = (const uint8_t *)input; // If we have some partial chunk bytes in the internal chunk_state, we need // to finish that chunk first. if (chunk_state_len(&self->chunk) > 0) { size_t take = BLAKE3_CHUNK_LEN - chunk_state_len(&self->chunk); if (take > input_len) { take = input_len; } chunk_state_update(&self->chunk, input_bytes, take); input_bytes += take; input_len -= take; // If we've filled the current chunk and there's more coming, finalize this // chunk and proceed. In this case we know it's not the root. if (input_len > 0) { output_t output = chunk_state_output(&self->chunk); uint8_t chunk_cv[32]; output_chaining_value(&output, chunk_cv); hasher_push_cv(self, chunk_cv, self->chunk.chunk_counter); chunk_state_reset(&self->chunk, self->key, self->chunk.chunk_counter + 1); } else { return; } } // Now the chunk_state is clear, and we have more input. If there's more than // a single chunk (so, definitely not the root chunk), hash the largest whole // subtree we can, with the full benefits of SIMD (and maybe in the future, // multi-threading) parallelism. Two restrictions: // - The subtree has to be a power-of-2 number of chunks. Only subtrees along // the right edge can be incomplete, and we don't know where the right edge // is going to be until we get to finalize(). // - The subtree must evenly divide the total number of chunks up until this // point (if total is not 0). If the current incomplete subtree is only // waiting for 1 more chunk, we can't hash a subtree of 4 chunks. We have // to complete the current subtree first. // Because we might need to break up the input to form powers of 2, or to // evenly divide what we already have, this part runs in a loop. while (input_len > BLAKE3_CHUNK_LEN) { size_t subtree_len = round_down_to_power_of_2(input_len); uint64_t count_so_far = self->chunk.chunk_counter * BLAKE3_CHUNK_LEN; // Shrink the subtree_len until it evenly divides the count so far. We know // that subtree_len itself is a power of 2, so we can use a bitmasking // trick instead of an actual remainder operation. (Note that if the caller // consistently passes power-of-2 inputs of the same size, as is hopefully // typical, this loop condition will always fail, and subtree_len will // always be the full length of the input.) // // An aside: We don't have to shrink subtree_len quite this much. For // example, if count_so_far is 1, we could pass 2 chunks to // compress_subtree_to_parent_node. Since we'll get 2 CVs back, we'll still // get the right answer in the end, and we might get to use 2-way SIMD // parallelism. The problem with this optimization, is that it gets us // stuck always hashing 2 chunks. The total number of chunks will remain // odd, and we'll never graduate to higher degrees of parallelism. See // https://github.com/BLAKE3-team/BLAKE3/issues/69. while ((((uint64_t)(subtree_len - 1)) & count_so_far) != 0) { subtree_len /= 2; } // The shrunken subtree_len might now be 1 chunk long. If so, hash that one // chunk by itself. Otherwise, compress the subtree into a pair of CVs. uint64_t subtree_chunks = subtree_len / BLAKE3_CHUNK_LEN; if (subtree_len <= BLAKE3_CHUNK_LEN) { blake3_chunk_state chunk_state; chunk_state_init(&chunk_state, self->key, self->chunk.flags); chunk_state.chunk_counter = self->chunk.chunk_counter; chunk_state_update(&chunk_state, input_bytes, subtree_len); output_t output = chunk_state_output(&chunk_state); uint8_t cv[BLAKE3_OUT_LEN]; output_chaining_value(&output, cv); hasher_push_cv(self, cv, chunk_state.chunk_counter); } else { // This is the high-performance happy path, though getting here depends // on the caller giving us a long enough input. uint8_t cv_pair[2 * BLAKE3_OUT_LEN]; compress_subtree_to_parent_node(input_bytes, subtree_len, self->key, self->chunk.chunk_counter, self->chunk.flags, cv_pair); hasher_push_cv(self, cv_pair, self->chunk.chunk_counter); hasher_push_cv(self, &cv_pair[BLAKE3_OUT_LEN], self->chunk.chunk_counter + (subtree_chunks / 2)); } self->chunk.chunk_counter += subtree_chunks; input_bytes += subtree_len; input_len -= subtree_len; } // If there's any remaining input less than a full chunk, add it to the chunk // state. In that case, also do a final merge loop to make sure the subtree // stack doesn't contain any unmerged pairs. The remaining input means we // know these merges are non-root. This merge loop isn't strictly necessary // here, because hasher_push_chunk_cv already does its own merge loop, but it // simplifies blake3_hasher_finalize below. if (input_len > 0) { chunk_state_update(&self->chunk, input_bytes, input_len); hasher_merge_cv_stack(self, self->chunk.chunk_counter); } } void blake3_hasher_finalize(const blake3_hasher *self, uint8_t *out, size_t out_len) { blake3_hasher_finalize_seek(self, 0, out, out_len); } void blake3_hasher_finalize_seek(const blake3_hasher *self, uint64_t seek, uint8_t *out, size_t out_len) { // Explicitly checking for zero avoids causing UB by passing a null pointer // to memcpy. This comes up in practice with things like: // std::vector v; // blake3_hasher_finalize(&hasher, v.data(), v.size()); if (out_len == 0) { return; } // If the subtree stack is empty, then the current chunk is the root. if (self->cv_stack_len == 0) { output_t output = chunk_state_output(&self->chunk); output_root_bytes(&output, seek, out, out_len); return; } // If there are any bytes in the chunk state, finalize that chunk and do a // roll-up merge between that chunk hash and every subtree in the stack. In // this case, the extra merge loop at the end of blake3_hasher_update // guarantees that none of the subtrees in the stack need to be merged with // each other first. Otherwise, if there are no bytes in the chunk state, // then the top of the stack is a chunk hash, and we start the merge from // that. output_t output; size_t cvs_remaining; if (chunk_state_len(&self->chunk) > 0) { cvs_remaining = self->cv_stack_len; output = chunk_state_output(&self->chunk); } else { // There are always at least 2 CVs in the stack in this case. cvs_remaining = self->cv_stack_len - 2; output = parent_output(&self->cv_stack[cvs_remaining * 32], self->key, self->chunk.flags); } while (cvs_remaining > 0) { cvs_remaining -= 1; uint8_t parent_block[BLAKE3_BLOCK_LEN]; memcpy(parent_block, &self->cv_stack[cvs_remaining * 32], 32); output_chaining_value(&output, &parent_block[32]); output = parent_output(parent_block, self->key, self->chunk.flags); } output_root_bytes(&output, seek, out, out_len); } void blake3_hasher_reset(blake3_hasher *self) { chunk_state_reset(&self->chunk, self->key, 0); self->cv_stack_len = 0; } crun-1.16.1/src/libcrun/blake3/blake3_portable.c0000644000000000000000000001340114554235516017531 0ustar0000000000000000#include "blake3_impl.h" #include INLINE uint32_t rotr32(uint32_t w, uint32_t c) { return (w >> c) | (w << (32 - c)); } INLINE void g(uint32_t *state, size_t a, size_t b, size_t c, size_t d, uint32_t x, uint32_t y) { state[a] = state[a] + state[b] + x; state[d] = rotr32(state[d] ^ state[a], 16); state[c] = state[c] + state[d]; state[b] = rotr32(state[b] ^ state[c], 12); state[a] = state[a] + state[b] + y; state[d] = rotr32(state[d] ^ state[a], 8); state[c] = state[c] + state[d]; state[b] = rotr32(state[b] ^ state[c], 7); } INLINE void round_fn(uint32_t state[16], const uint32_t *msg, size_t round) { // Select the message schedule based on the round. const uint8_t *schedule = MSG_SCHEDULE[round]; // Mix the columns. g(state, 0, 4, 8, 12, msg[schedule[0]], msg[schedule[1]]); g(state, 1, 5, 9, 13, msg[schedule[2]], msg[schedule[3]]); g(state, 2, 6, 10, 14, msg[schedule[4]], msg[schedule[5]]); g(state, 3, 7, 11, 15, msg[schedule[6]], msg[schedule[7]]); // Mix the rows. g(state, 0, 5, 10, 15, msg[schedule[8]], msg[schedule[9]]); g(state, 1, 6, 11, 12, msg[schedule[10]], msg[schedule[11]]); g(state, 2, 7, 8, 13, msg[schedule[12]], msg[schedule[13]]); g(state, 3, 4, 9, 14, msg[schedule[14]], msg[schedule[15]]); } INLINE void compress_pre(uint32_t state[16], const uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags) { uint32_t block_words[16]; block_words[0] = load32(block + 4 * 0); block_words[1] = load32(block + 4 * 1); block_words[2] = load32(block + 4 * 2); block_words[3] = load32(block + 4 * 3); block_words[4] = load32(block + 4 * 4); block_words[5] = load32(block + 4 * 5); block_words[6] = load32(block + 4 * 6); block_words[7] = load32(block + 4 * 7); block_words[8] = load32(block + 4 * 8); block_words[9] = load32(block + 4 * 9); block_words[10] = load32(block + 4 * 10); block_words[11] = load32(block + 4 * 11); block_words[12] = load32(block + 4 * 12); block_words[13] = load32(block + 4 * 13); block_words[14] = load32(block + 4 * 14); block_words[15] = load32(block + 4 * 15); state[0] = cv[0]; state[1] = cv[1]; state[2] = cv[2]; state[3] = cv[3]; state[4] = cv[4]; state[5] = cv[5]; state[6] = cv[6]; state[7] = cv[7]; state[8] = IV[0]; state[9] = IV[1]; state[10] = IV[2]; state[11] = IV[3]; state[12] = counter_low(counter); state[13] = counter_high(counter); state[14] = (uint32_t)block_len; state[15] = (uint32_t)flags; round_fn(state, &block_words[0], 0); round_fn(state, &block_words[0], 1); round_fn(state, &block_words[0], 2); round_fn(state, &block_words[0], 3); round_fn(state, &block_words[0], 4); round_fn(state, &block_words[0], 5); round_fn(state, &block_words[0], 6); } void blake3_compress_in_place_portable(uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags) { uint32_t state[16]; compress_pre(state, cv, block, block_len, counter, flags); cv[0] = state[0] ^ state[8]; cv[1] = state[1] ^ state[9]; cv[2] = state[2] ^ state[10]; cv[3] = state[3] ^ state[11]; cv[4] = state[4] ^ state[12]; cv[5] = state[5] ^ state[13]; cv[6] = state[6] ^ state[14]; cv[7] = state[7] ^ state[15]; } void blake3_compress_xof_portable(const uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags, uint8_t out[64]) { uint32_t state[16]; compress_pre(state, cv, block, block_len, counter, flags); store32(&out[0 * 4], state[0] ^ state[8]); store32(&out[1 * 4], state[1] ^ state[9]); store32(&out[2 * 4], state[2] ^ state[10]); store32(&out[3 * 4], state[3] ^ state[11]); store32(&out[4 * 4], state[4] ^ state[12]); store32(&out[5 * 4], state[5] ^ state[13]); store32(&out[6 * 4], state[6] ^ state[14]); store32(&out[7 * 4], state[7] ^ state[15]); store32(&out[8 * 4], state[8] ^ cv[0]); store32(&out[9 * 4], state[9] ^ cv[1]); store32(&out[10 * 4], state[10] ^ cv[2]); store32(&out[11 * 4], state[11] ^ cv[3]); store32(&out[12 * 4], state[12] ^ cv[4]); store32(&out[13 * 4], state[13] ^ cv[5]); store32(&out[14 * 4], state[14] ^ cv[6]); store32(&out[15 * 4], state[15] ^ cv[7]); } INLINE void hash_one_portable(const uint8_t *input, size_t blocks, const uint32_t key[8], uint64_t counter, uint8_t flags, uint8_t flags_start, uint8_t flags_end, uint8_t out[BLAKE3_OUT_LEN]) { uint32_t cv[8]; memcpy(cv, key, BLAKE3_KEY_LEN); uint8_t block_flags = flags | flags_start; while (blocks > 0) { if (blocks == 1) { block_flags |= flags_end; } blake3_compress_in_place_portable(cv, input, BLAKE3_BLOCK_LEN, counter, block_flags); input = &input[BLAKE3_BLOCK_LEN]; blocks -= 1; block_flags = flags; } store_cv_words(out, cv); } void blake3_hash_many_portable(const uint8_t *const *inputs, size_t num_inputs, size_t blocks, const uint32_t key[8], uint64_t counter, bool increment_counter, uint8_t flags, uint8_t flags_start, uint8_t flags_end, uint8_t *out) { while (num_inputs > 0) { hash_one_portable(inputs[0], blocks, key, counter, flags, flags_start, flags_end, out); if (increment_counter) { counter += 1; } inputs += 1; num_inputs -= 1; out = &out[BLAKE3_OUT_LEN]; } } crun-1.16.1/src/libcrun/blake3/blake3_impl.h0000644000000000000000000002503714554235516016677 0ustar0000000000000000#ifndef BLAKE3_IMPL_H #define BLAKE3_IMPL_H #include #include #include #include #include #include "blake3.h" /* libcrun specific code. Always force the portable implementation as it is fast enough for us. */ #define blake3_compress_in_place_portable blake3_compress_in_place #define blake3_compress_xof_portable blake3_compress_xof #define blake3_simd_degree_portable blake3_simd_degree #define blake3_compress_subtree_wide_portable blake3_compress_subtree_wide #define blake3_hash_many_portable blake3_hash_many static inline size_t blake3_simd_degree(void) { return 1; } // internal flags enum blake3_flags { CHUNK_START = 1 << 0, CHUNK_END = 1 << 1, PARENT = 1 << 2, ROOT = 1 << 3, KEYED_HASH = 1 << 4, DERIVE_KEY_CONTEXT = 1 << 5, DERIVE_KEY_MATERIAL = 1 << 6, }; // This C implementation tries to support recent versions of GCC, Clang, and // MSVC. #if defined(_MSC_VER) #define INLINE static __forceinline #else #define INLINE static inline __attribute__((always_inline)) #endif #if defined(__x86_64__) || defined(_M_X64) #define IS_X86 #define IS_X86_64 #endif #if defined(__i386__) || defined(_M_IX86) #define IS_X86 #define IS_X86_32 #endif #if defined(__aarch64__) || defined(_M_ARM64) #define IS_AARCH64 #endif #if defined(IS_X86) #if defined(_MSC_VER) #include #endif #endif #if !defined(BLAKE3_USE_NEON) // If BLAKE3_USE_NEON not manually set, autodetect based on AArch64ness #if defined(IS_AARCH64) #if defined(__ARM_BIG_ENDIAN) #define BLAKE3_USE_NEON 0 #else #define BLAKE3_USE_NEON 1 #endif #else #define BLAKE3_USE_NEON 0 #endif #endif #if defined(IS_X86) #define MAX_SIMD_DEGREE 16 #elif BLAKE3_USE_NEON == 1 #define MAX_SIMD_DEGREE 4 #else #define MAX_SIMD_DEGREE 1 #endif // There are some places where we want a static size that's equal to the // MAX_SIMD_DEGREE, but also at least 2. #define MAX_SIMD_DEGREE_OR_2 (MAX_SIMD_DEGREE > 2 ? MAX_SIMD_DEGREE : 2) static const uint32_t IV[8] = {0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL, 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL}; static const uint8_t MSG_SCHEDULE[7][16] = { {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, {2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8}, {3, 4, 10, 12, 13, 2, 7, 14, 6, 5, 9, 0, 11, 15, 8, 1}, {10, 7, 12, 9, 14, 3, 13, 15, 4, 0, 11, 2, 5, 8, 1, 6}, {12, 13, 9, 11, 15, 10, 14, 8, 7, 2, 5, 3, 0, 1, 6, 4}, {9, 14, 11, 5, 8, 12, 15, 1, 13, 3, 0, 10, 2, 6, 4, 7}, {11, 15, 5, 0, 1, 9, 8, 6, 14, 10, 2, 12, 3, 4, 7, 13}, }; /* Find index of the highest set bit */ /* x is assumed to be nonzero. */ static unsigned int highest_one(uint64_t x) { #if defined(__GNUC__) || defined(__clang__) return 63 ^ (unsigned int)__builtin_clzll(x); #elif defined(_MSC_VER) && defined(IS_X86_64) unsigned long index; _BitScanReverse64(&index, x); return index; #elif defined(_MSC_VER) && defined(IS_X86_32) if(x >> 32) { unsigned long index; _BitScanReverse(&index, (unsigned long)(x >> 32)); return 32 + index; } else { unsigned long index; _BitScanReverse(&index, (unsigned long)x); return index; } #else unsigned int c = 0; if(x & 0xffffffff00000000ULL) { x >>= 32; c += 32; } if(x & 0x00000000ffff0000ULL) { x >>= 16; c += 16; } if(x & 0x000000000000ff00ULL) { x >>= 8; c += 8; } if(x & 0x00000000000000f0ULL) { x >>= 4; c += 4; } if(x & 0x000000000000000cULL) { x >>= 2; c += 2; } if(x & 0x0000000000000002ULL) { c += 1; } return c; #endif } // Count the number of 1 bits. INLINE unsigned int popcnt(uint64_t x) { #if defined(__GNUC__) || defined(__clang__) return (unsigned int)__builtin_popcountll(x); #else unsigned int count = 0; while (x != 0) { count += 1; x &= x - 1; } return count; #endif } // Largest power of two less than or equal to x. As a special case, returns 1 // when x is 0. INLINE uint64_t round_down_to_power_of_2(uint64_t x) { return 1ULL << highest_one(x | 1); } INLINE uint32_t counter_low(uint64_t counter) { return (uint32_t)counter; } INLINE uint32_t counter_high(uint64_t counter) { return (uint32_t)(counter >> 32); } INLINE uint32_t load32(const void *src) { const uint8_t *p = (const uint8_t *)src; return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) | ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24); } INLINE void load_key_words(const uint8_t key[BLAKE3_KEY_LEN], uint32_t key_words[8]) { key_words[0] = load32(&key[0 * 4]); key_words[1] = load32(&key[1 * 4]); key_words[2] = load32(&key[2 * 4]); key_words[3] = load32(&key[3 * 4]); key_words[4] = load32(&key[4 * 4]); key_words[5] = load32(&key[5 * 4]); key_words[6] = load32(&key[6 * 4]); key_words[7] = load32(&key[7 * 4]); } INLINE void store32(void *dst, uint32_t w) { uint8_t *p = (uint8_t *)dst; p[0] = (uint8_t)(w >> 0); p[1] = (uint8_t)(w >> 8); p[2] = (uint8_t)(w >> 16); p[3] = (uint8_t)(w >> 24); } INLINE void store_cv_words(uint8_t bytes_out[32], uint32_t cv_words[8]) { store32(&bytes_out[0 * 4], cv_words[0]); store32(&bytes_out[1 * 4], cv_words[1]); store32(&bytes_out[2 * 4], cv_words[2]); store32(&bytes_out[3 * 4], cv_words[3]); store32(&bytes_out[4 * 4], cv_words[4]); store32(&bytes_out[5 * 4], cv_words[5]); store32(&bytes_out[6 * 4], cv_words[6]); store32(&bytes_out[7 * 4], cv_words[7]); } void blake3_compress_in_place(uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags); void blake3_compress_xof(const uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags, uint8_t out[64]); void blake3_hash_many(const uint8_t *const *inputs, size_t num_inputs, size_t blocks, const uint32_t key[8], uint64_t counter, bool increment_counter, uint8_t flags, uint8_t flags_start, uint8_t flags_end, uint8_t *out); size_t blake3_simd_degree(void); // Declarations for implementation-specific functions. void blake3_compress_in_place_portable(uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags); void blake3_compress_xof_portable(const uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags, uint8_t out[64]); void blake3_hash_many_portable(const uint8_t *const *inputs, size_t num_inputs, size_t blocks, const uint32_t key[8], uint64_t counter, bool increment_counter, uint8_t flags, uint8_t flags_start, uint8_t flags_end, uint8_t *out); #if defined(IS_X86) #if !defined(BLAKE3_NO_SSE2) void blake3_compress_in_place_sse2(uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags); void blake3_compress_xof_sse2(const uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags, uint8_t out[64]); void blake3_hash_many_sse2(const uint8_t *const *inputs, size_t num_inputs, size_t blocks, const uint32_t key[8], uint64_t counter, bool increment_counter, uint8_t flags, uint8_t flags_start, uint8_t flags_end, uint8_t *out); #endif #if !defined(BLAKE3_NO_SSE41) void blake3_compress_in_place_sse41(uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags); void blake3_compress_xof_sse41(const uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags, uint8_t out[64]); void blake3_hash_many_sse41(const uint8_t *const *inputs, size_t num_inputs, size_t blocks, const uint32_t key[8], uint64_t counter, bool increment_counter, uint8_t flags, uint8_t flags_start, uint8_t flags_end, uint8_t *out); #endif #if !defined(BLAKE3_NO_AVX2) void blake3_hash_many_avx2(const uint8_t *const *inputs, size_t num_inputs, size_t blocks, const uint32_t key[8], uint64_t counter, bool increment_counter, uint8_t flags, uint8_t flags_start, uint8_t flags_end, uint8_t *out); #endif #if !defined(BLAKE3_NO_AVX512) void blake3_compress_in_place_avx512(uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags); void blake3_compress_xof_avx512(const uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags, uint8_t out[64]); void blake3_hash_many_avx512(const uint8_t *const *inputs, size_t num_inputs, size_t blocks, const uint32_t key[8], uint64_t counter, bool increment_counter, uint8_t flags, uint8_t flags_start, uint8_t flags_end, uint8_t *out); #endif #endif #if BLAKE3_USE_NEON == 1 void blake3_hash_many_neon(const uint8_t *const *inputs, size_t num_inputs, size_t blocks, const uint32_t key[8], uint64_t counter, bool increment_counter, uint8_t flags, uint8_t flags_start, uint8_t flags_end, uint8_t *out); #endif #endif /* BLAKE3_IMPL_H */ crun-1.16.1/src/libcrun/blake3/blake3.h0000644000000000000000000000522314554235516015651 0ustar0000000000000000#ifndef BLAKE3_H #define BLAKE3_H #include #include #if !defined(BLAKE3_API) # if defined(_WIN32) || defined(__CYGWIN__) # if defined(BLAKE3_DLL) # if defined(BLAKE3_DLL_EXPORTS) # define BLAKE3_API __declspec(dllexport) # else # define BLAKE3_API __declspec(dllimport) # endif # define BLAKE3_PRIVATE # else # define BLAKE3_API # define BLAKE3_PRIVATE # endif # elif __GNUC__ >= 4 # define BLAKE3_API __attribute__((visibility("default"))) # define BLAKE3_PRIVATE __attribute__((visibility("hidden"))) # else # define BLAKE3_API # define BLAKE3_PRIVATE # endif #endif #ifdef __cplusplus extern "C" { #endif #define BLAKE3_VERSION_STRING "1.5.0" #define BLAKE3_KEY_LEN 32 #define BLAKE3_OUT_LEN 32 #define BLAKE3_BLOCK_LEN 64 #define BLAKE3_CHUNK_LEN 1024 #define BLAKE3_MAX_DEPTH 54 // This struct is a private implementation detail. It has to be here because // it's part of blake3_hasher below. typedef struct { uint32_t cv[8]; uint64_t chunk_counter; uint8_t buf[BLAKE3_BLOCK_LEN]; uint8_t buf_len; uint8_t blocks_compressed; uint8_t flags; } blake3_chunk_state; typedef struct { uint32_t key[8]; blake3_chunk_state chunk; uint8_t cv_stack_len; // The stack size is MAX_DEPTH + 1 because we do lazy merging. For example, // with 7 chunks, we have 3 entries in the stack. Adding an 8th chunk // requires a 4th entry, rather than merging everything down to 1, because we // don't know whether more input is coming. This is different from how the // reference implementation does things. uint8_t cv_stack[(BLAKE3_MAX_DEPTH + 1) * BLAKE3_OUT_LEN]; } blake3_hasher; BLAKE3_API const char *blake3_version(void); BLAKE3_API void blake3_hasher_init(blake3_hasher *self); BLAKE3_API void blake3_hasher_init_keyed(blake3_hasher *self, const uint8_t key[BLAKE3_KEY_LEN]); BLAKE3_API void blake3_hasher_init_derive_key(blake3_hasher *self, const char *context); BLAKE3_API void blake3_hasher_init_derive_key_raw(blake3_hasher *self, const void *context, size_t context_len); BLAKE3_API void blake3_hasher_update(blake3_hasher *self, const void *input, size_t input_len); BLAKE3_API void blake3_hasher_finalize(const blake3_hasher *self, uint8_t *out, size_t out_len); BLAKE3_API void blake3_hasher_finalize_seek(const blake3_hasher *self, uint64_t seek, uint8_t *out, size_t out_len); BLAKE3_API void blake3_hasher_reset(blake3_hasher *self); #ifdef __cplusplus } #endif #endif /* BLAKE3_H */ crun-1.16.1/src/libcrun/handlers/0000755000000000000000000000000014656670213014774 5ustar0000000000000000crun-1.16.1/src/libcrun/handlers/handler-utils.c0000644000000000000000000000526114504567214017715 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "../container.h" #include "../utils.h" #include "handler-utils.h" int wasm_can_handle_container (libcrun_container_t *container, libcrun_error_t *err arg_unused) { const char *annotation; const char *entrypoint_executable; if (container->container_def->process == NULL || container->container_def->process->args == NULL) return 0; entrypoint_executable = container->container_def->process->args[0]; annotation = find_annotation (container, "run.oci.handler"); if (annotation) { /* wasm-smart: annotation is a smart switch which only toggles wasm if it's necessary, following annotation is very useful for cases where users intend to run wasm workload on kubernetes cluster but workload also contains side-cars which could execute non-wasm workload. Example: Kubernetes clusters with service-mesh such as istio, linkerd etc */ if (strcmp (annotation, "wasm-smart") == 0) { return ((has_suffix (entrypoint_executable, ".wat") > 0) || (has_suffix (entrypoint_executable, ".wasm") > 0)) ? 1 : 0; } return strcmp (annotation, "wasm") == 0 ? 1 : 0; } annotation = find_annotation (container, "module.wasm.image/variant"); if (annotation) { /* compat-smart: annotation is a smart switch which only toggles wasm if it's necessary, following annotation is very useful for cases where users intend to run wasm workload on kubernetes cluster but workload also contains side-cars which could execute non-wasm workload. Example: Kubernetes clusters with service-mesh such as istio, linkerd etc */ if (strcmp (annotation, "compat-smart") == 0) { return ((has_suffix (entrypoint_executable, ".wat") > 0) || (has_suffix (entrypoint_executable, ".wasm") > 0)) ? 1 : 0; } return strcmp (annotation, "compat") == 0 ? 1 : 0; } return 0; } crun-1.16.1/src/libcrun/handlers/krun.c0000644000000000000000000002714414551252466016127 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2020, 2021 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "../custom-handler.h" #include "../container.h" #include "../utils.h" #include "../linux.h" #include #include #include #include #include #include #include #include #include #ifdef HAVE_DLOPEN # include #endif #ifdef HAVE_LIBKRUN # include #endif /* libkrun has a hard-limit of 8 vCPUs per microVM. */ #define LIBKRUN_MAX_VCPUS 8 struct krun_config { void *handle; void *handle_sev; bool sev; }; /* libkrun handler. */ #if HAVE_DLOPEN && HAVE_LIBKRUN static int libkrun_exec (void *cookie, libcrun_container_t *container, const char *pathname, char *const argv[]) { runtime_spec_schema_config_schema *def = container->container_def; int32_t (*krun_set_log_level) (uint32_t level); int32_t (*krun_create_ctx) (); int (*krun_start_enter) (uint32_t ctx_id); int32_t (*krun_set_vm_config) (uint32_t ctx_id, uint8_t num_vcpus, uint32_t ram_mib); int32_t (*krun_set_root) (uint32_t ctx_id, const char *root_path); int32_t (*krun_set_root_disk) (uint32_t ctx_id, const char *disk_path); int32_t (*krun_set_workdir) (uint32_t ctx_id, const char *workdir_path); int32_t (*krun_set_exec) (uint32_t ctx_id, const char *exec_path, char *const argv[], char *const envp[]); int32_t (*krun_set_tee_config_file) (uint32_t ctx_id, const char *file_path); struct krun_config *kconf = (struct krun_config *) cookie; void *handle; uint32_t num_vcpus, ram_mib; int32_t ctx_id, ret; cpu_set_t set; char *const envp[] = { 0 }; if (access ("/krun-sev.json", F_OK) == 0) { if (kconf->handle_sev == NULL) error (EXIT_FAILURE, 0, "the container requires libkrun-sev but it's not available"); handle = kconf->handle_sev; kconf->sev = true; } else { if (kconf->handle == NULL) error (EXIT_FAILURE, 0, "the container requires libkrun but it's not available"); handle = kconf->handle; kconf->sev = false; } krun_set_log_level = dlsym (handle, "krun_set_log_level"); krun_create_ctx = dlsym (handle, "krun_create_ctx"); krun_start_enter = dlsym (handle, "krun_start_enter"); if (krun_set_log_level == NULL || krun_create_ctx == NULL || krun_start_enter == NULL) error (EXIT_FAILURE, 0, "could not find symbol in `libkrun.so`"); /* Set log level to "error" */ krun_set_log_level (1); ctx_id = krun_create_ctx (); if (UNLIKELY (ctx_id < 0)) error (EXIT_FAILURE, -ctx_id, "could not create krun context"); if (kconf->sev) { krun_set_root_disk = dlsym (handle, "krun_set_root_disk"); krun_set_tee_config_file = dlsym (handle, "krun_set_tee_config_file"); if (krun_set_root_disk == NULL || krun_set_tee_config_file == NULL) error (EXIT_FAILURE, 0, "could not find symbol in `libkrun-sev.so`"); ret = krun_set_root_disk (ctx_id, "/disk.img"); if (UNLIKELY (ret < 0)) error (EXIT_FAILURE, -ret, "could not set root disk"); ret = krun_set_tee_config_file (ctx_id, "/krun-sev.json"); if (UNLIKELY (ret < 0)) error (EXIT_FAILURE, -ret, "could not set krun tee config file"); } else { /* If sched_getaffinity fails, default to 1 vcpu. */ num_vcpus = 1; /* If no memory limit is specified, default to 2G. */ ram_mib = 2 * 1024; if (def && def->linux && def->linux->resources && def->linux->resources->memory && def->linux->resources->memory->limit_present) ram_mib = def->linux->resources->memory->limit / (1024 * 1024); CPU_ZERO (&set); if (sched_getaffinity (getpid (), sizeof (set), &set) == 0) num_vcpus = MIN (CPU_COUNT (&set), LIBKRUN_MAX_VCPUS); krun_set_vm_config = dlsym (handle, "krun_set_vm_config"); krun_set_root = dlsym (handle, "krun_set_root"); krun_set_workdir = dlsym (handle, "krun_set_workdir"); krun_set_exec = dlsym (handle, "krun_set_exec"); if (krun_set_vm_config == NULL || krun_set_root == NULL || krun_set_exec == NULL) error (EXIT_FAILURE, 0, "could not find symbol in `libkrun.so`"); ret = krun_set_vm_config (ctx_id, num_vcpus, ram_mib); if (UNLIKELY (ret < 0)) error (EXIT_FAILURE, -ret, "could not set krun vm configuration"); ret = krun_set_root (ctx_id, "/"); if (UNLIKELY (ret < 0)) error (EXIT_FAILURE, -ret, "could not set krun root"); if (krun_set_workdir && def && def->process && def->process->cwd) { ret = krun_set_workdir (ctx_id, def->process->cwd); if (UNLIKELY (ret < 0)) error (EXIT_FAILURE, -ret, "could not set krun working directory"); } ret = krun_set_exec (ctx_id, pathname, &argv[1], &envp[0]); if (UNLIKELY (ret < 0)) error (EXIT_FAILURE, -ret, "could not set krun executable"); } return krun_start_enter (ctx_id); } /* libkrun_create_kvm_device: explicitly adds kvm device. */ static int libkrun_configure_container (void *cookie, enum handler_configure_phase phase, libcrun_context_t *context, libcrun_container_t *container, const char *rootfs, libcrun_error_t *err) { int ret, rootfsfd; size_t i; struct krun_config *kconf = (struct krun_config *) cookie; struct device_s kvm_device = { "/dev/kvm", "c", 10, 232, 0666, 0, 0 }; struct device_s sev_device = { "/dev/sev", "c", 10, 124, 0666, 0, 0 }; cleanup_close int devfd = -1; cleanup_close int rootfsfd_cleanup = -1; runtime_spec_schema_config_schema *def = container->container_def; bool is_user_ns; bool create_sev; if (rootfs == NULL) rootfsfd = AT_FDCWD; else { rootfsfd = rootfsfd_cleanup = open (rootfs, O_PATH | O_CLOEXEC); if (UNLIKELY (rootfsfd < 0)) return crun_make_error (err, errno, "open `%s`", rootfs); } if (phase == HANDLER_CONFIGURE_BEFORE_MOUNTS) { cleanup_free char *origin_config_path = NULL; cleanup_free char *state_dir = NULL; cleanup_free char *config = NULL; size_t config_size; state_dir = libcrun_get_state_directory (context->state_root, context->id); if (UNLIKELY (state_dir == NULL)) return crun_make_error (err, 0, "could not retrieve the state directory"); ret = append_paths (&origin_config_path, err, state_dir, "config.json", NULL); if (UNLIKELY (ret < 0)) return ret; ret = read_all_file (origin_config_path, &config, &config_size, err); if (UNLIKELY (ret < 0)) return ret; ret = write_file_at (rootfsfd, ".krun_config.json", config, config_size, err); if (UNLIKELY (ret < 0)) return ret; } if (phase != HANDLER_CONFIGURE_AFTER_MOUNTS) return 0; /* Do nothing if /dev/kvm is already present in spec */ for (i = 0; i < def->linux->devices_len; i++) { if (strcmp (def->linux->devices[i]->path, "/dev/kvm") == 0) return 0; } if (kconf->handle_sev != NULL) { create_sev = true; for (i = 0; i < def->linux->devices_len; i++) { if (strcmp (def->linux->devices[i]->path, "/dev/sev") == 0) create_sev = false; } } devfd = openat (rootfsfd, "dev", O_RDONLY | O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (devfd < 0)) return crun_make_error (err, errno, "open /dev directory in `%s`", rootfs); ret = check_running_in_user_namespace (err); if (UNLIKELY (ret < 0)) return ret; is_user_ns = ret; ret = libcrun_create_dev (container, devfd, -1, &kvm_device, is_user_ns, true, err); if (UNLIKELY (ret < 0)) return ret; if (create_sev) { ret = libcrun_create_dev (container, devfd, -1, &sev_device, is_user_ns, true, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int libkrun_load (void **cookie, libcrun_error_t *err) { struct krun_config *kconf; void *handle; const char *libkrun_so = "libkrun.so.1"; const char *libkrun_sev_so = "libkrun-sev.so.1"; kconf = malloc (sizeof (struct krun_config)); if (kconf == NULL) return crun_make_error (err, 0, "could not allocate memory for krun_config"); kconf->handle = dlopen (libkrun_so, RTLD_NOW); kconf->handle_sev = dlopen (libkrun_sev_so, RTLD_NOW); if (kconf->handle == NULL && kconf->handle_sev == NULL) { free (kconf); return crun_make_error (err, 0, "failed to open `%s` and `%s` for krun_config", libkrun_so, libkrun_sev_so); } kconf->sev = false; *cookie = kconf; return 0; } static int libkrun_unload (void *cookie, libcrun_error_t *err) { int r; if (cookie) { r = dlclose (cookie); if (UNLIKELY (r < 0)) return crun_make_error (err, 0, "could not unload handle: `%s`", dlerror ()); } return 0; } static runtime_spec_schema_defs_linux_device_cgroup * make_oci_spec_dev (const char *type, dev_t device, bool allow, const char *access) { runtime_spec_schema_defs_linux_device_cgroup *dev = xmalloc0 (sizeof (*dev)); dev->allow = allow; dev->allow_present = 1; dev->type = xstrdup (type); dev->major = major (device); dev->major_present = 1; dev->minor = minor (device); dev->minor_present = 1; dev->access = xstrdup (access); return dev; } static int libkrun_modify_oci_configuration (void *cookie arg_unused, libcrun_context_t *context arg_unused, runtime_spec_schema_config_schema *def, libcrun_error_t *err) { const size_t device_size = sizeof (runtime_spec_schema_defs_linux_device_cgroup); struct stat st_kvm, st_sev; bool has_sev = true; size_t len; int ret; if (def->linux == NULL || def->linux->resources == NULL || def->linux->resources->devices == NULL) return 0; /* Always allow the /dev/kvm device. */ ret = stat ("/dev/kvm", &st_kvm); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "stat `/dev/kvm`"); ret = stat ("/dev/sev", &st_sev); if (UNLIKELY (ret < 0)) { if (errno != ENOENT) return crun_make_error (err, errno, "stat `/dev/sev`"); has_sev = false; } len = def->linux->resources->devices_len; def->linux->resources->devices = xrealloc (def->linux->resources->devices, device_size * (len + 2 + (has_sev ? 1 : 0))); def->linux->resources->devices[len] = make_oci_spec_dev ("a", st_kvm.st_rdev, true, "rwm"); if (has_sev) def->linux->resources->devices[len + 1] = make_oci_spec_dev ("a", st_sev.st_rdev, true, "rwm"); def->linux->resources->devices_len += has_sev ? 2 : 1; return 0; } struct custom_handler_s handler_libkrun = { .name = "krun", .alias = NULL, .feature_string = "LIBKRUN", .load = libkrun_load, .unload = libkrun_unload, .run_func = libkrun_exec, .configure_container = libkrun_configure_container, .modify_oci_configuration = libkrun_modify_oci_configuration, }; #endif crun-1.16.1/src/libcrun/handlers/mono.c0000644000000000000000000001072514504567214016113 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2020, 2021 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "../custom-handler.h" #include "../container.h" #include "../utils.h" #include "../linux.h" #include #include #include #include #include #include #ifdef HAVE_DLOPEN # include #endif #ifdef HAVE_MONO # include # include # include # include #endif #if HAVE_DLOPEN && HAVE_MONO static int mono_exec (void *cookie arg_unused, libcrun_container_t *container arg_unused, const char *pathname, char *const argv[] arg_unused) { MonoDomain *domain; char *path = (char *) pathname; int argc = 2; char *argv_mono[] = { path, path, NULL }; const char *file; int retval; file = argv_mono[1]; MonoAllocatorVTable mem_vtable = { MONO_ALLOCATOR_VTABLE_VERSION, xmalloc, NULL, NULL, NULL }; mono_set_allocator_vtable (&mem_vtable); /* * Load the default Mono configuration file, this is needed * if you are planning on using the dllmaps defined on the * system configuration */ mono_config_parse (NULL); /* * mono_jit_init() creates a domain: each assembly is * loaded and run in a MonoDomain. */ domain = mono_jit_init (file); /* * We add our special internal call, so that C# code * can call us back. */ MonoAssembly *assembly; assembly = mono_domain_assembly_open (domain, file); if (! assembly) exit (EXIT_FAILURE); /* * mono_jit_exec() will run the Main() method in the assembly. * The return value needs to be looked up from * System.Environment.ExitCode. */ mono_jit_exec (domain, assembly, argc - 1, argv_mono + 1); retval = mono_environment_exitcode_get (); mono_jit_cleanup (domain); return 0; } static int mono_load (void **cookie, libcrun_error_t *err) { void *handle; handle = dlopen ("libmono-native.so", RTLD_NOW); if (handle == NULL) return crun_make_error (err, 0, "could not load `libmono-2.0.so`: `%s`", dlerror ()); *cookie = handle; return 0; } static int mono_configure_container (void *cookie arg_unused, enum handler_configure_phase phase, libcrun_context_t *context arg_unused, libcrun_container_t *container, const char *rootfs arg_unused, libcrun_error_t *err) { int ret; if (phase != HANDLER_CONFIGURE_MOUNTS) return 0; char *options[] = { "ro", "rprivate", "nosuid", "nodev", "rbind" }; ret = libcrun_container_do_bind_mount (container, "/etc/mono", "/etc/mono", options, 5, err); if (ret != 0) return ret; ret = libcrun_container_do_bind_mount (container, "/usr/lib/mono", "/usr/lib/mono", options, 5, err); if (ret != 0) return ret; /* release any error if set since we are going to be returning from here */ crun_error_release (err); return 0; } static int mono_unload (void *cookie, libcrun_error_t *err) { int r; if (cookie) { r = dlclose (cookie); if (UNLIKELY (r < 0)) return crun_make_error (err, 0, "could not unload handle: `%s`", dlerror ()); } return 0; } static int mono_can_handle_container (libcrun_container_t *container, libcrun_error_t *err arg_unused) { const char *annotation; annotation = find_annotation (container, "run.oci.handler"); if (annotation) return strcmp (annotation, "dotnet") == 0 ? 1 : 0; return 0; } struct custom_handler_s handler_mono = { .name = "dotnet", .alias = NULL, .feature_string = ".NET:mono", .load = mono_load, .unload = mono_unload, .run_func = mono_exec, .can_handle_container = mono_can_handle_container, .configure_container = mono_configure_container, }; #endif crun-1.16.1/src/libcrun/handlers/spin.c0000644000000000000000000000650314551252466016115 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2023 Sven Pfennig * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "../custom-handler.h" #include "../linux.h" #include #ifdef HAVE_DLOPEN # include #endif #ifdef HAVE_SPIN #endif #if HAVE_DLOPEN && HAVE_SPIN static int spin_exec (void *cookie arg_unused, libcrun_container_t *container arg_unused, const char *pathname arg_unused, char *const argv[] arg_unused) { // wasmtime fails to determine default config path if $HOME is not set char *newenviron[] = { "HOME=/root", NULL }; char *newargv[] = { "/bin/spin", "up", "--listen", "0.0.0.0:80", NULL }; // spin up needs a /tmp folder int dir_result = mkdir ("/tmp", 0777); if (dir_result != 0 && errno != EEXIST) { error (EXIT_FAILURE, errno, "failed to execute mkdir `/tmp`"); } execve (newargv[0], newargv, newenviron); perror ("execve"); exit (EXIT_FAILURE); } static int spin_load (void **cookie arg_unused, libcrun_error_t *err) { struct stat st = { 0 }; if (stat ("/usr/local/bin/spin", &st) == -1) { return crun_make_error (err, 0, "Could not find statically linked spin cli at `/usr/local/bin/spin` on host file system"); } return 0; } static int spin_configure_container (void *cookie arg_unused, enum handler_configure_phase phase, libcrun_context_t *context arg_unused, libcrun_container_t *container, const char *rootfs arg_unused, libcrun_error_t *err) { int ret; if (phase != HANDLER_CONFIGURE_MOUNTS) return 0; char *options[] = { "ro", "rprivate", "nosuid", "nodev", "rbind" }; ret = libcrun_container_do_bind_mount (container, "/usr/local/bin/spin", "/bin/spin", options, 5, err); if (ret != 0) return ret; /* release any error if set since we are going to be returning from here */ crun_error_release (err); return 0; } static int spin_unload (void *cookie arg_unused, libcrun_error_t *err arg_unused) { return 0; } static int spin_can_handle_container (libcrun_container_t *container, libcrun_error_t *err arg_unused) { const char *entrypoint_executable; if (container->container_def->process == NULL || container->container_def->process->args == NULL) return 0; entrypoint_executable = container->container_def->process->args[0]; return strcmp (entrypoint_executable, "/") ? 0 : 1; } struct custom_handler_s handler_spin = { .name = "spin", .alias = NULL, .feature_string = "WASM:spin", .load = spin_load, .unload = spin_unload, .run_func = spin_exec, .can_handle_container = spin_can_handle_container, .configure_container = spin_configure_container, }; #endif crun-1.16.1/src/libcrun/handlers/wasmedge.c0000644000000000000000000002246314654642544016747 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2020, 2021 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "../custom-handler.h" #include "../container.h" #include "../utils.h" #include "../linux.h" #include "handler-utils.h" #include #include #include #include #include #include #ifdef HAVE_DLOPEN # include #endif #ifdef HAVE_WASMEDGE # include #endif #if HAVE_DLOPEN && HAVE_WASMEDGE static int libwasmedge_load (void **cookie, libcrun_error_t *err) { void *handle; handle = dlopen ("libwasmedge.so.0", RTLD_NOW); if (handle == NULL) return crun_make_error (err, 0, "could not load `libwasmedge.so.0`: `%s`", dlerror ()); *cookie = handle; return 0; } static int libwasmedge_unload (void *cookie, libcrun_error_t *err) { int r; if (cookie) { r = dlclose (cookie); if (UNLIKELY (r < 0)) return crun_make_error (err, 0, "could not unload handle: `%s`", dlerror ()); } return 0; } static int libwasmedge_exec (void *cookie, __attribute__ ((unused)) libcrun_container_t *container, const char *pathname, char *const argv[]) { WasmEdge_ConfigureContext *(*WasmEdge_ConfigureCreate) (void); void (*WasmEdge_ConfigureDelete) (WasmEdge_ConfigureContext *Cxt); void (*WasmEdge_ConfigureAddProposal) (WasmEdge_ConfigureContext *Cxt, const enum WasmEdge_Proposal Prop); void (*WasmEdge_ConfigureAddHostRegistration) (WasmEdge_ConfigureContext *Cxt, enum WasmEdge_HostRegistration Host); WasmEdge_VMContext *(*WasmEdge_VMCreate) (const WasmEdge_ConfigureContext *ConfCxt, WasmEdge_StoreContext *StoreCxt); void (*WasmEdge_VMDelete) (WasmEdge_VMContext *Cxt); WasmEdge_Result (*WasmEdge_VMRegisterModuleFromFile) (WasmEdge_VMContext *Cxt, WasmEdge_String ModuleName, const char *Path); WasmEdge_Result (*WasmEdge_VMRunWasmFromFile) (WasmEdge_VMContext *Cxt, const char *Path, const WasmEdge_String FuncName, const WasmEdge_Value *Params, const uint32_t ParamLen, WasmEdge_Value *Returns, const uint32_t ReturnLen); void (*WasmEdge_PluginLoadFromPath) (const char *Path); void (*WasmEdge_PluginInitWASINN) (const char *const *NNPreloads, const uint32_t PreloadsLen); bool (*WasmEdge_ResultOK) (const WasmEdge_Result Res); WasmEdge_String (*WasmEdge_StringCreateByCString) (const char *Str); uint32_t argn = 0; uint32_t envn = 0; const char *dirs[2] = { "/:/", ".:." }; WasmEdge_ConfigureContext *configure; WasmEdge_VMContext *vm; WasmEdge_Result result; WasmEdge_ModuleInstanceContext *wasi_module; WasmEdge_ModuleInstanceContext *(*WasmEdge_VMGetImportModuleContext) (WasmEdge_VMContext *Cxt, const enum WasmEdge_HostRegistration Reg); void (*WasmEdge_ModuleInstanceInitWASI) (WasmEdge_ModuleInstanceContext *Cxt, const char *const *Args, const uint32_t ArgLen, const char *const *Envs, const uint32_t EnvLen, const char *const *Dirs, const uint32_t DirLen, const char *const *Preopens, const uint32_t PreopenLen); WasmEdge_ModuleInstanceInitWASI = dlsym (cookie, "WasmEdge_ModuleInstanceInitWASI"); WasmEdge_ConfigureCreate = dlsym (cookie, "WasmEdge_ConfigureCreate"); WasmEdge_ConfigureDelete = dlsym (cookie, "WasmEdge_ConfigureDelete"); WasmEdge_ConfigureAddProposal = dlsym (cookie, "WasmEdge_ConfigureAddProposal"); WasmEdge_ConfigureAddHostRegistration = dlsym (cookie, "WasmEdge_ConfigureAddHostRegistration"); WasmEdge_VMCreate = dlsym (cookie, "WasmEdge_VMCreate"); WasmEdge_VMDelete = dlsym (cookie, "WasmEdge_VMDelete"); WasmEdge_VMRegisterModuleFromFile = dlsym (cookie, "WasmEdge_VMRegisterModuleFromFile"); WasmEdge_VMGetImportModuleContext = dlsym (cookie, "WasmEdge_VMGetImportModuleContext"); WasmEdge_VMRunWasmFromFile = dlsym (cookie, "WasmEdge_VMRunWasmFromFile"); WasmEdge_PluginLoadFromPath = dlsym (cookie, "WasmEdge_PluginLoadFromPath"); WasmEdge_PluginInitWASINN = dlsym (cookie, "WasmEdge_PluginInitWASINN"); WasmEdge_ResultOK = dlsym (cookie, "WasmEdge_ResultOK"); WasmEdge_StringCreateByCString = dlsym (cookie, "WasmEdge_StringCreateByCString"); if (WasmEdge_ConfigureCreate == NULL || WasmEdge_ConfigureDelete == NULL || WasmEdge_ConfigureAddProposal == NULL || WasmEdge_ConfigureAddHostRegistration == NULL || WasmEdge_VMCreate == NULL || WasmEdge_VMDelete == NULL || WasmEdge_VMRegisterModuleFromFile == NULL || WasmEdge_VMGetImportModuleContext == NULL || WasmEdge_ModuleInstanceInitWASI == NULL || WasmEdge_VMRunWasmFromFile == NULL || WasmEdge_ResultOK == NULL || WasmEdge_StringCreateByCString == NULL) error (EXIT_FAILURE, 0, "could not find symbol in `libwasmedge.so.0`"); configure = WasmEdge_ConfigureCreate (); if (UNLIKELY (configure == NULL)) error (EXIT_FAILURE, 0, "could not create wasmedge configure"); WasmEdge_ConfigureAddProposal (configure, WasmEdge_Proposal_BulkMemoryOperations); WasmEdge_ConfigureAddProposal (configure, WasmEdge_Proposal_ReferenceTypes); WasmEdge_ConfigureAddProposal (configure, WasmEdge_Proposal_SIMD); WasmEdge_ConfigureAddHostRegistration (configure, WasmEdge_HostRegistration_Wasi); // Check if the necessary environment variables are set const char *plugin_path_env = getenv ("WASMEDGE_PLUGIN_PATH"); if (plugin_path_env != NULL) WasmEdge_PluginLoadFromPath (plugin_path_env); const char *nnpreload_env = getenv ("WASMEDGE_WASINN_PRELOAD"); if (nnpreload_env != NULL) WasmEdge_PluginInitWASINN (&nnpreload_env, 1); vm = WasmEdge_VMCreate (configure, NULL); if (UNLIKELY (vm == NULL)) { WasmEdge_ConfigureDelete (configure); error (EXIT_FAILURE, 0, "could not create wasmedge vm"); } wasi_module = WasmEdge_VMGetImportModuleContext (vm, WasmEdge_HostRegistration_Wasi); if (UNLIKELY (wasi_module == NULL)) { WasmEdge_VMDelete (vm); WasmEdge_ConfigureDelete (configure); error (EXIT_FAILURE, 0, "could not get wasmedge wasi module context"); } for (char *const *arg = argv; *arg != NULL; ++arg, ++argn) ; extern char **environ; for (char *const *env = environ; *env != NULL; ++env, ++envn) ; WasmEdge_ModuleInstanceInitWASI (wasi_module, (const char *const *) &argv[0], argn, (const char *const *) &environ[0], envn, dirs, 1, NULL, 0); result = WasmEdge_VMRunWasmFromFile (vm, pathname, WasmEdge_StringCreateByCString ("_start"), NULL, 0, NULL, 0); if (UNLIKELY (! WasmEdge_ResultOK (result))) { WasmEdge_VMDelete (vm); WasmEdge_ConfigureDelete (configure); error (EXIT_FAILURE, 0, "could not get wasmedge result from VM"); } WasmEdge_VMDelete (vm); WasmEdge_ConfigureDelete (configure); exit (EXIT_SUCCESS); } static int wasmedge_can_handle_container (libcrun_container_t *container, libcrun_error_t *err) { return wasm_can_handle_container (container, err); } // This works only when the plugin is present in /usr/lib/wasmedge static int libwasmedge_configure_container (void *cookie arg_unused, enum handler_configure_phase phase, libcrun_context_t *context arg_unused, libcrun_container_t *container, const char *rootfs arg_unused, libcrun_error_t *err) { int ret; runtime_spec_schema_config_schema *def = container->container_def; char **container_env = def->process->env; bool has_plugin_path = false, has_preload = false; for (char **env = container_env; env && *env; env++) { if (strncmp (*env, "WASMEDGE_PLUGIN_PATH=", 21) == 0) has_plugin_path = true; else if (strncmp (*env, "WASMEDGE_WASINN_PRELOAD=", 24) == 0) has_preload = true; } if (! has_plugin_path && ! has_preload) return 0; if (phase != HANDLER_CONFIGURE_AFTER_MOUNTS) return 0; // Check if /usr/lib/wasmedge is already present in spec if (def->linux && def->mounts) { for (size_t i = 0; i < def->mounts_len; i++) { if (strcmp (def->mounts[i]->destination, "/usr/lib/wasmedge") == 0) return 0; } } // Mount the plugin folder to /usr/lib/wasmedge with specific options char *options[] = { "ro", "rprivate", "nosuid", "nodev", "rbind" }; ret = libcrun_container_do_bind_mount (container, "/usr/lib/wasmedge ", "/usr/lib/wasmedge", options, 5, err); if (ret < 0) { if (crun_error_get_errno (err) != ENOENT) return ret; crun_error_release (err); } return 0; } struct custom_handler_s handler_wasmedge = { .name = "wasmedge", .alias = "wasm", .feature_string = "WASM:wasmedge", .load = libwasmedge_load, .unload = libwasmedge_unload, .run_func = libwasmedge_exec, .can_handle_container = wasmedge_can_handle_container, .configure_container = libwasmedge_configure_container, }; #endif crun-1.16.1/src/libcrun/handlers/wasmer.c0000644000000000000000000002437614551252466016452 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2020, 2021 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "../custom-handler.h" #include "../container.h" #include "../utils.h" #include "../linux.h" #include "handler-utils.h" #include #include #include #include #include #include #ifdef HAVE_DLOPEN # include #endif #ifdef HAVE_WASMER # include #endif #if HAVE_DLOPEN && HAVE_WASMER # define WASMER_BUF_SIZE 128 static int libwasmer_exec (void *cookie, libcrun_container_t *container arg_unused, const char *pathname, char *const argv[]) { int ret; char buffer[WASMER_BUF_SIZE] = { 0 }; size_t data_read_size = WASMER_BUF_SIZE; const wasm_func_t *core_func; FILE *wat_wasm_file; size_t file_size; wasm_byte_vec_t wat; wasm_byte_vec_t binary_bytes; wasm_byte_vec_t wasm_bytes; wasm_engine_t *engine; wasm_val_t results_val[1] = { WASM_INIT_VAL }; wasm_store_t *store; wasm_module_t *module; wasm_instance_t *instance; wasm_extern_vec_t exports; size_t args_size = 0; cleanup_free char *wasi_args = NULL; wasi_config_t *config; char *const *arg; wasi_env_t *wasi_env; wasm_importtype_vec_t import_types; wasm_extern_vec_t imports; wasm_func_t *run_func; wasm_val_vec_t args = WASM_EMPTY_VEC; wasm_val_vec_t res = WASM_EMPTY_VEC; wasm_engine_t *(*wasm_engine_new) (); void (*wat2wasm) (const wasm_byte_vec_t *wat, wasm_byte_vec_t *out); wasm_module_t *(*wasm_module_new) (wasm_store_t *, const wasm_byte_vec_t *binary); wasm_store_t *(*wasm_store_new) (wasm_engine_t *); wasm_instance_t *(*wasm_instance_new) (wasm_store_t *, const wasm_module_t *, const wasm_extern_vec_t *imports, wasm_trap_t **); void (*wasm_instance_exports) (const wasm_instance_t *, wasm_extern_vec_t *out); wasm_func_t *(*wasm_extern_as_func) (wasm_extern_t *); void (*wasm_module_delete) (wasm_module_t *); void (*wasm_instance_delete) (wasm_instance_t *); void (*wasm_store_delete) (wasm_store_t *); void (*wasm_engine_delete) (wasm_engine_t *); void (*wasm_byte_vec_new) (wasm_byte_vec_t *, size_t, const char *); void (*wasm_byte_vec_delete) (wasm_byte_vec_t *); void (*wasm_importtype_vec_delete) (wasm_importtype_vec_t *); void (*wasm_extern_vec_delete) (wasm_extern_vec_t *); void (*wasm_byte_vec_new_uninitialized) (wasm_byte_vec_t *, size_t); void (*wasm_extern_vec_new_uninitialized) (wasm_extern_vec_t *, size_t); void (*wasi_config_capture_stdout) (struct wasi_config_t *); void (*wasi_config_inherit_stdout) (struct wasi_config_t *); void (*wasm_module_imports) (const wasm_module_t *, wasm_importtype_vec_t *); void (*wasm_func_delete) (wasm_func_t *); wasm_trap_t *(*wasm_func_call) (const wasm_func_t *, const wasm_val_vec_t *args, wasm_val_vec_t *results); wasi_config_t *(*wasi_config_new) (const char *); wasi_env_t *(*wasi_env_new) (wasm_store_t *, struct wasi_config_t *); bool (*wasi_get_imports) (const wasm_store_t *, const struct wasi_env_t *, const wasm_module_t *, wasm_extern_vec_t *); wasm_func_t *(*wasi_get_start_function) (wasm_instance_t *); intptr_t (*wasi_env_read_stdout) (struct wasi_env_t *, char *, uintptr_t); void (*wasi_env_delete) (struct wasi_env_t *); void (*wasi_config_arg) (struct wasi_config_t *config, const char *arg); bool (*wasi_env_initialize_instance) (struct wasi_env_t *, wasm_store_t *, wasm_instance_t *); wat2wasm = dlsym (cookie, "wat2wasm"); wasm_module_delete = dlsym (cookie, "wasm_module_delete"); wasm_instance_delete = dlsym (cookie, "wasm_instance_delete"); wasm_engine_delete = dlsym (cookie, "wasm_engine_delete"); wasm_store_delete = dlsym (cookie, "wasm_store_delete"); wasm_func_call = dlsym (cookie, "wasm_func_call"); wasm_extern_as_func = dlsym (cookie, "wasm_extern_as_func"); wasm_instance_exports = dlsym (cookie, "wasm_instance_exports"); wasm_instance_new = dlsym (cookie, "wasm_instance_new"); wasm_store_new = dlsym (cookie, "wasm_store_new"); wasm_module_new = dlsym (cookie, "wasm_module_new"); wasm_engine_new = dlsym (cookie, "wasm_engine_new"); wasm_byte_vec_new = dlsym (cookie, "wasm_byte_vec_new"); wasm_byte_vec_delete = dlsym (cookie, "wasm_byte_vec_delete"); wasm_extern_vec_delete = dlsym (cookie, "wasm_extern_vec_delete"); wasm_importtype_vec_delete = dlsym (cookie, "wasm_importtype_vec_delete"); wasm_byte_vec_new_uninitialized = dlsym (cookie, "wasm_byte_vec_new_uninitialized"); wasi_config_new = dlsym (cookie, "wasi_config_new"); wasi_config_arg = dlsym (cookie, "wasi_config_arg"); wasi_config_capture_stdout = dlsym (cookie, "wasi_config_capture_stdout"); wasi_config_inherit_stdout = dlsym (cookie, "wasi_config_inherit_stdout"); wasi_env_new = dlsym (cookie, "wasi_env_new"); wasm_module_imports = dlsym (cookie, "wasm_module_imports"); wasm_extern_vec_new_uninitialized = dlsym (cookie, "wasm_extern_vec_new_uninitialized"); wasi_get_imports = dlsym (cookie, "wasi_get_imports"); wasi_get_start_function = dlsym (cookie, "wasi_get_start_function"); wasi_env_read_stdout = dlsym (cookie, "wasi_env_read_stdout"); wasi_env_delete = dlsym (cookie, "wasi_env_delete"); wasm_func_delete = dlsym (cookie, "wasm_func_delete"); wasi_env_initialize_instance = dlsym (cookie, "wasi_env_initialize_instance"); if (wat2wasm == NULL || wasm_module_delete == NULL || wasm_instance_delete == NULL || wasm_engine_delete == NULL || wasm_store_delete == NULL || wasm_func_call == NULL || wasm_extern_as_func == NULL || wasm_instance_exports == NULL || wasm_instance_new == NULL || wasm_store_new == NULL || wasm_engine_new == NULL || wasm_byte_vec_new == NULL || wasm_byte_vec_delete == NULL || wasm_extern_vec_delete == NULL || wasm_byte_vec_new_uninitialized == NULL || wasi_config_new == NULL || wasi_config_capture_stdout == NULL || wasi_env_new == NULL || wasm_module_imports == NULL || wasi_env_read_stdout == NULL || wasi_env_delete == NULL || wasm_func_delete == NULL || wasm_importtype_vec_delete == NULL || wasm_extern_vec_new_uninitialized == NULL || wasi_get_imports == NULL || wasi_get_start_function == NULL || wasi_config_inherit_stdout == NULL) error (EXIT_FAILURE, 0, "could not find symbol in `libwasmer.so`"); wat_wasm_file = fopen (pathname, "rbe"); if (! wat_wasm_file) error (EXIT_FAILURE, errno, "error opening wat/wasm module"); fseek (wat_wasm_file, 0L, SEEK_END); file_size = ftell (wat_wasm_file); fseek (wat_wasm_file, 0L, SEEK_SET); wasm_byte_vec_new_uninitialized (&binary_bytes, file_size); if (fread (binary_bytes.data, file_size, 1, wat_wasm_file) != 1) error (EXIT_FAILURE, errno, "error loading wat/wasm module"); /* We can close entrypoint file. */ fclose (wat_wasm_file); /* We have received a wat file: convert wat to wasm. */ if (has_suffix (pathname, "wat") > 0) { wat2wasm (&binary_bytes, &wasm_bytes); binary_bytes = wasm_bytes; } engine = wasm_engine_new (); store = wasm_store_new (engine); module = wasm_module_new (store, &binary_bytes); if (! module) error (EXIT_FAILURE, 0, "error compiling wasm module"); config = wasi_config_new ("crun_wasi_program"); /* Count number of external arguments given. */ for (arg = argv; *arg != NULL; ++arg) args_size++; if (args_size > 1) { wasi_args = str_join_array (1, args_size, argv, " "); wasi_config_arg (config, wasi_args); } wasi_config_inherit_stdout (config); wasi_env = wasi_env_new (store, config); if (! wasi_env) { error (EXIT_FAILURE, 0, "error building wasi env"); } /* Instantiate. */ if (! wasi_get_imports (store, wasi_env, module, &imports)) error (EXIT_FAILURE, 0, "error getting WASI imports"); instance = wasm_instance_new (store, module, &imports, NULL); if (! instance) error (EXIT_FAILURE, 0, "error instantiating module"); if (! wasi_env_initialize_instance (wasi_env, store, instance)) error (EXIT_FAILURE, 0, "error init wasi env"); /* Extract export. */ wasm_instance_exports (instance, &exports); if (exports.size == 0) error (EXIT_FAILURE, 0, "error getting instance exports"); run_func = wasi_get_start_function (instance); if (run_func == NULL) error (EXIT_FAILURE, 0, "error accessing export"); if (wasm_func_call (run_func, &args, &res)) error (EXIT_FAILURE, 0, "error calling wasm function"); wasm_extern_vec_delete (&exports); wasm_extern_vec_delete (&imports); /* Shut down. */ wasm_module_delete (module); wasm_instance_delete (instance); wasm_func_delete (run_func); wasi_env_delete (wasi_env); wasm_store_delete (store); wasm_engine_delete (engine); exit (EXIT_SUCCESS); } static int libwasmer_load (void **cookie, libcrun_error_t *err) { void *handle; handle = dlopen ("libwasmer.so", RTLD_NOW); if (handle == NULL) return crun_make_error (err, 0, "could not load `libwasmer.so`: %s", dlerror ()); *cookie = handle; return 0; } static int libwasmer_unload (void *cookie, libcrun_error_t *err) { int r; if (cookie) { r = dlclose (cookie); if (UNLIKELY (r < 0)) return crun_make_error (err, 0, "could not unload handle: %s", dlerror ()); } return 0; } static int libwasmer_can_handle_container (libcrun_container_t *container, libcrun_error_t *err) { return wasm_can_handle_container (container, err); } struct custom_handler_s handler_wasmer = { .name = "wasmer", .alias = "wasm", .feature_string = "WASM:wasmer", .load = libwasmer_load, .unload = libwasmer_unload, .run_func = libwasmer_exec, .can_handle_container = libwasmer_can_handle_container, }; #endif crun-1.16.1/src/libcrun/handlers/wasmtime.c0000644000000000000000000002672014551252466016775 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2020, 2021 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "../custom-handler.h" #include "../container.h" #include "../utils.h" #include "../linux.h" #include "handler-utils.h" #include #include #include #include #include #include #include #include #include #ifdef HAVE_DLOPEN # include #endif #ifdef HAVE_WASMTIME # include # include # include #endif #if HAVE_DLOPEN && HAVE_WASMTIME static int libwasmtime_exec (void *cookie, libcrun_container_t *container arg_unused, const char *pathname, char *const argv[]) { size_t args_size = 0; char *const *arg; wasm_byte_vec_t error_message; wasm_byte_vec_t wasm_bytes; wasm_engine_t *(*wasm_engine_new) (); wasmtime_error_t *(*wasmtime_wat2wasm) (const char *wat, size_t wat_len, wasm_byte_vec_t *out); void (*wasm_engine_delete) (wasm_engine_t *); void (*wasm_byte_vec_delete) (wasm_byte_vec_t *); void (*wasm_byte_vec_new_uninitialized) (wasm_byte_vec_t *, size_t); wasi_config_t *(*wasi_config_new) (const char *); wasmtime_store_t *(*wasmtime_store_new) (wasm_engine_t *engine, void *data, void (*finalizer) (void *)); wasmtime_context_t *(*wasmtime_store_context) (wasmtime_store_t *store); wasmtime_linker_t *(*wasmtime_linker_new) (wasm_engine_t *engine); wasmtime_error_t *(*wasmtime_linker_define_wasi) (wasmtime_linker_t *linker); wasmtime_error_t *(*wasmtime_module_new) ( wasm_engine_t *engine, const uint8_t *wasm, size_t wasm_len, wasmtime_module_t **ret); void (*wasi_config_inherit_argv) (wasi_config_t *config); void (*wasi_config_inherit_env) (wasi_config_t *config); void (*wasi_config_set_argv) (wasi_config_t *config, int argc, const char *argv[]); void (*wasi_config_inherit_stdin) (wasi_config_t *config); void (*wasi_config_inherit_stdout) (wasi_config_t *config); void (*wasi_config_inherit_stderr) (wasi_config_t *config); wasmtime_error_t *(*wasmtime_context_set_wasi) (wasmtime_context_t *context, wasi_config_t *wasi); wasmtime_error_t *(*wasmtime_linker_module) ( wasmtime_linker_t *linker, wasmtime_context_t *store, const char *name, size_t name_len, const wasmtime_module_t *module); wasmtime_error_t *(*wasmtime_linker_get_default) ( const wasmtime_linker_t *linker, wasmtime_context_t *store, const char *name, size_t name_len, wasmtime_func_t *func); wasmtime_error_t *(*wasmtime_func_call) ( wasmtime_context_t *store, const wasmtime_func_t *func, const wasmtime_val_t *args, size_t nargs, wasmtime_val_t *results, size_t nresults, wasm_trap_t **trap); void (*wasmtime_module_delete) (wasmtime_module_t *m); void (*wasmtime_store_delete) (wasmtime_store_t *store); void (*wasmtime_error_message) (const wasmtime_error_t *error, wasm_name_t *message); void (*wasmtime_error_delete) (wasmtime_error_t *error); bool (*wasi_config_preopen_dir) (wasi_config_t *config, const char *path, const char *guest_path); wasmtime_wat2wasm = dlsym (cookie, "wasmtime_wat2wasm"); wasm_engine_new = dlsym (cookie, "wasm_engine_new"); wasm_engine_delete = dlsym (cookie, "wasm_engine_delete"); wasm_byte_vec_delete = dlsym (cookie, "wasm_byte_vec_delete"); wasm_byte_vec_new_uninitialized = dlsym (cookie, "wasm_byte_vec_new_uninitialized"); wasi_config_new = dlsym (cookie, "wasi_config_new"); wasi_config_set_argv = dlsym (cookie, "wasi_config_set_argv"); wasmtime_store_new = dlsym (cookie, "wasmtime_store_new"); wasmtime_store_context = dlsym (cookie, "wasmtime_store_context"); wasmtime_linker_new = dlsym (cookie, "wasmtime_linker_new"); wasmtime_linker_define_wasi = dlsym (cookie, "wasmtime_linker_define_wasi"); wasmtime_module_new = dlsym (cookie, "wasmtime_module_new"); wasi_config_inherit_argv = dlsym (cookie, "wasi_config_inherit_argv"); wasi_config_inherit_stdout = dlsym (cookie, "wasi_config_inherit_stdout"); wasi_config_inherit_stdin = dlsym (cookie, "wasi_config_inherit_stdin"); wasi_config_inherit_stderr = dlsym (cookie, "wasi_config_inherit_stderr"); wasi_config_inherit_env = dlsym (cookie, "wasi_config_inherit_env"); wasmtime_context_set_wasi = dlsym (cookie, "wasmtime_context_set_wasi"); wasmtime_linker_module = dlsym (cookie, "wasmtime_linker_module"); wasmtime_linker_get_default = dlsym (cookie, "wasmtime_linker_get_default"); wasmtime_func_call = dlsym (cookie, "wasmtime_func_call"); wasmtime_module_delete = dlsym (cookie, "wasmtime_module_delete"); wasmtime_store_delete = dlsym (cookie, "wasmtime_store_delete"); wasmtime_error_delete = dlsym (cookie, "wasmtime_error_delete"); wasmtime_error_message = dlsym (cookie, "wasmtime_error_message"); wasi_config_preopen_dir = dlsym (cookie, "wasi_config_preopen_dir"); if (wasm_engine_new == NULL || wasm_engine_delete == NULL || wasm_byte_vec_delete == NULL || wasm_byte_vec_new_uninitialized == NULL || wasi_config_new == NULL || wasmtime_store_new == NULL || wasmtime_store_context == NULL || wasmtime_linker_new == NULL || wasmtime_linker_define_wasi == NULL || wasmtime_module_new == NULL || wasi_config_inherit_argv == NULL || wasi_config_inherit_stdout == NULL || wasi_config_inherit_stdin == NULL || wasi_config_inherit_stderr == NULL || wasi_config_inherit_env == NULL || wasmtime_context_set_wasi == NULL || wasmtime_linker_module == NULL || wasmtime_linker_get_default == NULL || wasmtime_func_call == NULL || wasmtime_module_delete == NULL || wasmtime_store_delete == NULL || wasi_config_set_argv == NULL || wasmtime_error_delete == NULL || wasmtime_error_message == NULL || wasi_config_preopen_dir == NULL || wasmtime_wat2wasm == NULL) error (EXIT_FAILURE, 0, "could not find symbol in `libwasmtime.so`"); // Set up wasmtime context wasm_engine_t *engine = wasm_engine_new (); assert (engine != NULL); wasmtime_store_t *store = wasmtime_store_new (engine, NULL, NULL); assert (store != NULL); wasmtime_context_t *context = wasmtime_store_context (store); // Link with wasi functions defined wasmtime_linker_t *linker = wasmtime_linker_new (engine); wasmtime_error_t *err = wasmtime_linker_define_wasi (linker); if (err != NULL) { wasmtime_error_message (err, &error_message); wasmtime_error_delete (err); error (EXIT_FAILURE, 0, "failed to link wasi: %.*s", (int) error_message.size, error_message.data); } wasm_byte_vec_t wasm; // Load and parse container entrypoint FILE *file = fopen (pathname, "rbe"); if (! file) error (EXIT_FAILURE, 0, "error loading entrypoint"); fseek (file, 0L, SEEK_END); size_t file_size = ftell (file); wasm_byte_vec_new_uninitialized (&wasm, file_size); fseek (file, 0L, SEEK_SET); if (fread (wasm.data, file_size, 1, file) != 1) error (EXIT_FAILURE, 0, "error load"); fclose (file); // If entrypoint contains a webassembly text format // compile it on the fly and convert to equivalent // binary format. if (has_suffix (pathname, "wat") > 0) { wasmtime_error_t *err = wasmtime_wat2wasm ((char *) &wasm_bytes, file_size, &wasm); if (err != NULL) { wasmtime_error_message (err, &error_message); wasmtime_error_delete (err); error (EXIT_FAILURE, 0, "failed while compiling wat to wasm binary : %.*s", (int) error_message.size, error_message.data); } wasm = wasm_bytes; } // Compile wasm modules wasmtime_module_t *module = NULL; err = wasmtime_module_new (engine, (uint8_t *) wasm.data, wasm.size, &module); if (! module) { wasmtime_error_message (err, &error_message); wasmtime_error_delete (err); error (EXIT_FAILURE, 0, "failed to compile module: %.*s", (int) error_message.size, error_message.data); } wasm_byte_vec_delete (&wasm); // Init WASI program wasi_config_t *wasi_config = wasi_config_new ("crun_wasi_program"); assert (wasi_config); // Calculate argc for `wasi_config_set_argv` for (arg = argv; *arg != NULL; ++arg) args_size++; wasi_config_set_argv (wasi_config, args_size, (const char **) argv); wasi_config_inherit_env (wasi_config); wasi_config_inherit_stdin (wasi_config); wasi_config_inherit_stdout (wasi_config); wasi_config_inherit_stderr (wasi_config); wasi_config_preopen_dir (wasi_config, ".", "."); wasm_trap_t *trap = NULL; err = wasmtime_context_set_wasi (context, wasi_config); if (err != NULL) { wasmtime_error_message (err, &error_message); wasmtime_error_delete (err); error (EXIT_FAILURE, 0, "failed to instantiate WASI: %.*s", (int) error_message.size, error_message.data); } // Init module err = wasmtime_linker_module (linker, context, "", 0, module); if (err != NULL) { wasmtime_error_message (err, &error_message); wasmtime_error_delete (err); error (EXIT_FAILURE, 0, "failed to instantiate module: %.*s", (int) error_message.size, error_message.data); } // Actually run our .wasm wasmtime_func_t func; err = wasmtime_linker_get_default (linker, context, "", 0, &func); if (err != NULL) { wasmtime_error_message (err, &error_message); wasmtime_error_delete (err); error (EXIT_FAILURE, 0, "failed to locate default export for module %.*s", (int) error_message.size, error_message.data); } err = wasmtime_func_call (context, &func, NULL, 0, NULL, 0, &trap); if (err != NULL || trap != NULL) { wasmtime_error_message (err, &error_message); wasmtime_error_delete (err); error (EXIT_FAILURE, 0, "error calling default export: %.*s", (int) error_message.size, error_message.data); } // Clean everything wasmtime_module_delete (module); wasmtime_store_delete (store); wasm_engine_delete (engine); exit (EXIT_SUCCESS); } static int libwasmtime_load (void **cookie, libcrun_error_t *err) { void *handle; handle = dlopen ("libwasmtime.so", RTLD_NOW); if (handle == NULL) return crun_make_error (err, 0, "could not load `libwasmtime.so`: %s", dlerror ()); *cookie = handle; return 0; } static int libwasmtime_unload (void *cookie, libcrun_error_t *err) { int r; if (cookie) { r = dlclose (cookie); if (UNLIKELY (r < 0)) return crun_make_error (err, 0, "could not unload handle: %s", dlerror ()); } return 0; } static int libwasmtime_can_handle_container (libcrun_container_t *container, libcrun_error_t *err) { return wasm_can_handle_container (container, err); } struct custom_handler_s handler_wasmtime = { .name = "wasmtime", .alias = "wasm", .feature_string = "WASM:wasmtime", .load = libwasmtime_load, .unload = libwasmtime_unload, .run_func = libwasmtime_exec, .can_handle_container = libwasmtime_can_handle_container, }; #endif crun-1.16.1/src/libcrun/handlers/handler-utils.h0000644000000000000000000000167414406334420017716 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef HANDLER_UTILS_H #define HANDLER_UTILS_H #include "../container.h" #include int wasm_can_handle_container (libcrun_container_t *container, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/utils.c0000644000000000000000000016715314656670105014515 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "utils.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_LINUX_OPENAT2_H # include #endif #if HAVE_STDATOMIC_H # include #else # define atomic_long volatile long #endif #ifndef CLOSE_RANGE_CLOEXEC # define CLOSE_RANGE_CLOEXEC (1U << 2) #endif #ifndef RESOLVE_IN_ROOT # define RESOLVE_IN_ROOT 0x10 #endif #ifndef __NR_close_range # define __NR_close_range 436 #endif #ifndef __NR_openat2 # define __NR_openat2 437 #endif #define MAX_READLINKS 32 static int syscall_close_range (unsigned int fd, unsigned int max_fd, unsigned int flags) { return (int) syscall (__NR_close_range, fd, max_fd, flags); } static int syscall_openat2 (int dirfd, const char *path, uint64_t flags, uint64_t mode, uint64_t resolve) { struct openat2_open_how { uint64_t flags; uint64_t mode; uint64_t resolve; } how = { .flags = flags, .mode = mode, .resolve = resolve, }; return (int) syscall (__NR_openat2, dirfd, path, &how, sizeof (how), 0); } int crun_path_exists (const char *path, libcrun_error_t *err) { int ret = access (path, F_OK); if (ret < 0) { if (errno == ENOENT) return 0; return crun_make_error (err, errno, "access `%s`", path); } return 1; } int xasprintf (char **str, const char *fmt, ...) { int ret; va_list args_list; va_start (args_list, fmt); ret = vasprintf (str, fmt, args_list); if (UNLIKELY (ret < 0)) OOM (); va_end (args_list); return ret; } int write_file_at_with_flags (int dirfd, int flags, mode_t mode, const char *name, const void *data, size_t len, libcrun_error_t *err) { cleanup_close int fd = openat (dirfd, name, O_CLOEXEC | O_WRONLY | flags, mode); int ret = 0; if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "opening file `%s` for writing", name); if (len) { ret = TEMP_FAILURE_RETRY (write (fd, data, len)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "writing file `%s`", name); } return ret; } int write_file_at (int dirfd, const char *name, const void *data, size_t len, libcrun_error_t *err) { return write_file_at_with_flags (dirfd, O_CLOEXEC | O_CREAT | O_TRUNC, 0700, name, data, len, err); } int write_file_with_flags (const char *name, int flags, const void *data, size_t len, libcrun_error_t *err) { return write_file_at_with_flags (AT_FDCWD, flags, 0700, name, data, len, err); } int write_file (const char *name, const void *data, size_t len, libcrun_error_t *err) { return write_file_with_flags (name, O_CREAT | O_TRUNC, data, len, err); } int detach_process () { pid_t pid; if (setsid () < 0) return -1; pid = fork (); if (pid < 0) return -1; if (pid != 0) _exit (EXIT_SUCCESS); return 0; } int get_file_type_fd (int fd, mode_t *mode) { struct stat st; int ret; #ifdef HAVE_STATX struct statx stx = { 0, }; ret = statx (fd, "", AT_EMPTY_PATH | AT_STATX_DONT_SYNC, STATX_TYPE, &stx); if (UNLIKELY (ret < 0)) { if (errno == ENOSYS || errno == EINVAL) goto fallback; return ret; } *mode = stx.stx_mode; return ret; fallback: #endif ret = fstat (fd, &st); *mode = st.st_mode; return ret; } int get_file_type_at (int dirfd, mode_t *mode, bool nofollow, const char *path) { int empty_path = path == NULL ? AT_EMPTY_PATH : 0; struct stat st; int ret; #ifdef HAVE_STATX struct statx stx = { 0, }; ret = statx (dirfd, path ?: "", empty_path | (nofollow ? AT_SYMLINK_NOFOLLOW : 0) | AT_STATX_DONT_SYNC, STATX_TYPE, &stx); if (UNLIKELY (ret < 0)) { if (errno == ENOSYS || errno == EINVAL) goto fallback; return ret; } *mode = stx.stx_mode; return ret; fallback: #endif ret = fstatat (dirfd, path ?: "", &st, empty_path | (nofollow ? AT_SYMLINK_NOFOLLOW : 0)); *mode = st.st_mode; return ret; } int get_file_type (mode_t *mode, bool nofollow, const char *path) { return get_file_type_at (AT_FDCWD, mode, nofollow, path); } int create_file_if_missing_at (int dirfd, const char *file, libcrun_error_t *err) { cleanup_close int fd_write = openat (dirfd, file, O_CLOEXEC | O_CREAT | O_WRONLY, 0700); if (fd_write < 0) { mode_t mode; int ret; /* On errors, check if the file already exists. */ ret = get_file_type_at (dirfd, &mode, false, file); if (ret == 0 && S_ISREG (mode)) return 0; return crun_make_error (err, errno, "creating file `%s`", file); } return 0; } static int ensure_directory_internal_at (int dirfd, char *path, size_t len, int mode, libcrun_error_t *err) { char *it = path + len; int ret = 0; bool parent_created = false; for (;;) { ret = mkdirat (dirfd, path, mode); if (ret == 0 || errno == EEXIST) return 0; if (parent_created || errno != ENOENT) { libcrun_error_t tmp_err = NULL; /* On errors check if the directory already exists. */ ret = crun_dir_p (path, false, &tmp_err); if (ret > 0) return 0; if (ret < 0) crun_error_release (&tmp_err); return crun_make_error (err, errno, "create directory `%s`", path); } while (it > path && *it != '/') { it--; len--; } if (it == path) return 0; *it = '\0'; ret = ensure_directory_internal_at (dirfd, path, len - 1, mode, err); *it = '/'; if (UNLIKELY (ret < 0)) return ret; parent_created = true; } return ret; } int crun_ensure_directory_at (int dirfd, const char *path, int mode, bool nofollow, libcrun_error_t *err) { int ret; cleanup_free char *tmp = xstrdup (path); ret = ensure_directory_internal_at (dirfd, tmp, strlen (tmp), mode, err); if (UNLIKELY (ret < 0)) return ret; ret = crun_dir_p_at (dirfd, path, nofollow, err); if (UNLIKELY (ret < 0)) return ret; if (ret == 0) return crun_make_error (err, ENOTDIR, "the path `%s` is not a directory", path); return 0; } static int check_fd_under_path (const char *rootfs, size_t rootfslen, int fd, const char *fdname, libcrun_error_t *err) { proc_fd_path_t fdpath; char link[PATH_MAX]; int ret; get_proc_self_fd_path (fdpath, fd); ret = TEMP_FAILURE_RETRY (readlink (fdpath, link, sizeof (link))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "readlink `%s`", fdname); if (((size_t) ret) <= rootfslen || memcmp (link, rootfs, rootfslen) != 0 || link[rootfslen] != '/') return crun_make_error (err, 0, "target `%s` not under the directory `%s`", fdname, rootfs); return 0; } /* Check if *oldfd is a valid fd and close it. Then store newfd into *oldfd. */ static void close_and_replace (int *oldfd, int newfd) { if (*oldfd >= 0) TEMP_FAILURE_RETRY (close (*oldfd)); *oldfd = newfd; } /* Defined in chroot_realpath.c */ char *chroot_realpath (const char *chroot, const char *path, char resolved_path[]); static int safe_openat_fallback (int dirfd, const char *rootfs, size_t rootfs_len, const char *path, int flags, int mode, libcrun_error_t *err) { const char *path_in_chroot; cleanup_close int fd = -1; char buffer[PATH_MAX]; int ret; path_in_chroot = chroot_realpath (rootfs, path, buffer); if (path_in_chroot == NULL) return crun_make_error (err, errno, "cannot resolve `%s` under rootfs", path); path_in_chroot += rootfs_len; path_in_chroot = consume_slashes (path_in_chroot); /* If the path is empty we are at the root, dup the dirfd itself. */ if (path_in_chroot[0] == '\0') { ret = dup (dirfd); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "dup `%s`", rootfs); return ret; } ret = openat (dirfd, path_in_chroot, flags, mode); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "open `%s`", path); fd = ret; ret = check_fd_under_path (rootfs, rootfs_len, fd, path, err); if (UNLIKELY (ret < 0)) return ret; ret = fd; fd = -1; return ret; } int safe_openat (int dirfd, const char *rootfs, size_t rootfs_len, const char *path, int flags, int mode, libcrun_error_t *err) { static bool openat2_supported = true; int ret; if (openat2_supported) { repeat: ret = syscall_openat2 (dirfd, path, flags, mode, RESOLVE_IN_ROOT); if (UNLIKELY (ret < 0)) { if (errno == EINTR || errno == EAGAIN) goto repeat; if (errno == ENOSYS) openat2_supported = false; if (errno == ENOSYS || errno == EINVAL || errno == EPERM) return safe_openat_fallback (dirfd, rootfs, rootfs_len, path, flags, mode, err); return crun_make_error (err, errno, "openat2 `%s`", path); } return ret; } return safe_openat_fallback (dirfd, rootfs, rootfs_len, path, flags, mode, err); } ssize_t safe_readlinkat (int dfd, const char *name, char **buffer, ssize_t hint, libcrun_error_t *err) { ssize_t buf_size = hint > 0 ? hint + 1 : 512; cleanup_free char *tmp_buf = NULL; ssize_t size; do { if (tmp_buf != NULL) buf_size += 256; /* Allocate an extra byte so the buffer can be NUL terminated. */ tmp_buf = xrealloc (tmp_buf, buf_size + 1); size = readlinkat (dfd, name, tmp_buf, buf_size); if (UNLIKELY (size < 0)) return crun_make_error (err, errno, "readlink `%s`", name); } while (size == buf_size); /* Always NUL terminate the buffer. */ tmp_buf[size] = '\0'; /* Move ownership to BUFFER. */ *buffer = tmp_buf; tmp_buf = NULL; return size; } static int crun_safe_ensure_at (bool do_open, bool dir, int dirfd, const char *dirpath, size_t dirpath_len, const char *path, int mode, int max_readlinks, libcrun_error_t *err) { cleanup_close int wd_cleanup = -1; cleanup_free char *npath = NULL; bool last_component = false; size_t depth = 0; const char *cur; char *it; int cwd; int ret; if (max_readlinks <= 0) return crun_make_error (err, ELOOP, "resolve path `%s`", path); path = consume_slashes (path); /* Empty path, nothing to do. */ if (*path == '\0') return 0; npath = xstrdup (path); cwd = dirfd; cur = npath; it = strchr (npath, '/'); while (cur) { if (it) *it = '\0'; else last_component = true; if (cur[0] == '\0') break; if (strcmp (cur, ".") == 0) goto next; else if (strcmp (cur, "..")) depth++; else { if (depth) depth--; else { /* Start from the root. */ close_and_reset (&wd_cleanup); cwd = dirfd; goto next; } } if (last_component && ! dir) { ret = openat (cwd, cur, O_CLOEXEC | O_CREAT | O_WRONLY | O_NOFOLLOW, 0700); if (UNLIKELY (ret < 0)) { /* If the last component is a symlink, repeat the lookup with the resolved path. */ if (errno == ELOOP) { cleanup_free char *resolved_path = NULL; ret = safe_readlinkat (cwd, cur, &resolved_path, 0, err); if (LIKELY (ret >= 0)) { return crun_safe_ensure_at (do_open, dir, dirfd, dirpath, dirpath_len, resolved_path, mode, max_readlinks - 1, err); } crun_error_release (err); } /* If the previous openat fails, attempt to open the file in O_PATH mode. */ ret = openat (cwd, cur, O_CLOEXEC | O_PATH, 0); if (ret < 0) return crun_make_error (err, errno, "open `%s/%s`", dirpath, npath); } if (do_open) return ret; close_and_replace (&wd_cleanup, ret); return 0; } ret = mkdirat (cwd, cur, mode); if (ret < 0) { if (errno != EEXIST) return crun_make_error (err, errno, "mkdir `/%s`", npath); } cwd = safe_openat (dirfd, dirpath, dirpath_len, npath, (last_component ? O_PATH : 0) | O_CLOEXEC, 0, err); if (UNLIKELY (cwd < 0)) return crun_error_wrap (err, "creating `/%s`", path); if (! last_component) { mode_t st_mode; ret = get_file_type_at (cwd, &st_mode, true, NULL); if (UNLIKELY (ret < 0)) { int saved_errno = errno; close (cwd); return crun_make_error (err, saved_errno, "error stat'ing file `%s`", npath); } if ((st_mode & S_IFMT) != S_IFDIR) { close (cwd); return crun_make_error (err, ENOTDIR, "error creating directory `%s` since `%s` exists and it is not a directory", path, npath); } } close_and_replace (&wd_cleanup, cwd); next: if (it == NULL) break; cur = consume_slashes (it + 1); *it = '/'; it = strchr (cur, '/'); } if (do_open) { if (cwd == dirfd) { ret = dup (dirfd); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "dup `%s`", dirpath); return ret; } wd_cleanup = -1; return cwd; } return 0; } int crun_safe_create_and_open_ref_at (bool dir, int dirfd, const char *dirpath, size_t dirpath_len, const char *path, int mode, libcrun_error_t *err) { int fd; /* If the file/dir already exists, just open it. */ fd = safe_openat (dirfd, dirpath, dirpath_len, path, O_PATH | O_CLOEXEC, 0, err); if (LIKELY (fd >= 0)) return fd; return crun_safe_ensure_at (true, dir, dirfd, dirpath, dirpath_len, path, mode, MAX_READLINKS, err); } int crun_safe_ensure_directory_at (int dirfd, const char *dirpath, size_t dirpath_len, const char *path, int mode, libcrun_error_t *err) { return crun_safe_ensure_at (false, true, dirfd, dirpath, dirpath_len, path, mode, MAX_READLINKS, err); } int crun_safe_ensure_file_at (int dirfd, const char *dirpath, size_t dirpath_len, const char *path, int mode, libcrun_error_t *err) { return crun_safe_ensure_at (false, false, dirfd, dirpath, dirpath_len, path, mode, MAX_READLINKS, err); } int crun_ensure_directory (const char *path, int mode, bool nofollow, libcrun_error_t *err) { return crun_ensure_directory_at (AT_FDCWD, path, mode, nofollow, err); } int crun_ensure_file_at (int dirfd, const char *path, int mode, bool nofollow, libcrun_error_t *err) { cleanup_free char *tmp = xstrdup (path); size_t len = strlen (tmp); char *it = tmp + len - 1; int ret; while (*it != '/' && it > tmp) it--; if (it > tmp) { *it = '\0'; ret = crun_ensure_directory_at (dirfd, tmp, mode, nofollow, err); if (UNLIKELY (ret < 0)) return ret; *it = '/'; } return create_file_if_missing_at (dirfd, tmp, err); } int crun_ensure_file (const char *path, int mode, bool nofollow, libcrun_error_t *err) { return crun_ensure_file_at (AT_FDCWD, path, mode, nofollow, err); } static int get_file_size (int fd, off_t *size) { struct stat st; int ret; #ifdef HAVE_STATX struct statx stx = { 0, }; ret = statx (fd, "", AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC, STATX_SIZE, &stx); if (UNLIKELY (ret < 0)) { if (errno == ENOSYS || errno == EINVAL) goto fallback; return ret; } *size = stx.stx_size; return ret; fallback: #endif ret = fstat (fd, &st); *size = st.st_size; return ret; } int crun_dir_p_at (int dirfd, const char *path, bool nofollow, libcrun_error_t *err) { mode_t mode; int ret; ret = get_file_type_at (dirfd, &mode, nofollow, path); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "error stat'ing file `%s`", path); return S_ISDIR (mode); } int crun_dir_p (const char *path, bool nofollow, libcrun_error_t *err) { return crun_dir_p_at (AT_FDCWD, path, nofollow, err); } int check_running_in_user_namespace (libcrun_error_t *err) { cleanup_free char *buffer = NULL; static int run_in_userns = -1; size_t len; int ret; ret = run_in_userns; if (ret >= 0) return ret; ret = read_all_file ("/proc/self/uid_map", &buffer, &len, err); if (UNLIKELY (ret < 0)) return ret; ret = strstr (buffer, "4294967295") ? 0 : 1; run_in_userns = ret; return ret; } static size_t get_page_size () { static atomic_long cached_pagesize = 0; atomic_long pagesize = cached_pagesize; if (pagesize == 0) { pagesize = (long) sysconf (_SC_PAGESIZE); cached_pagesize = pagesize; } return (size_t) pagesize; } static int selinux_enabled = -1; static int apparmor_enabled = -1; int libcrun_initialize_selinux (libcrun_error_t *err) { cleanup_free char *out = NULL; cleanup_close int fd = -1; size_t len; int ret; if (selinux_enabled >= 0) return selinux_enabled; fd = open ("/proc/mounts", O_RDONLY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `/proc/mounts`"); ret = read_all_fd_with_size_hint (fd, "/proc/mounts", &out, &len, get_page_size (), err); if (UNLIKELY (ret < 0)) return ret; selinux_enabled = strstr (out, "selinux") ? 1 : 0; return selinux_enabled; } int libcrun_initialize_apparmor (libcrun_error_t *err) { cleanup_close int fd = -1; int size; char buf[2]; if (apparmor_enabled >= 0) return apparmor_enabled; if (crun_dir_p_at (AT_FDCWD, "/sys/kernel/security/apparmor", true, err)) { fd = open ("/sys/module/apparmor/parameters/enabled", O_RDONLY | O_CLOEXEC); if (fd == -1) return 0; size = TEMP_FAILURE_RETRY (read (fd, &buf, 2)); apparmor_enabled = size > 0 && buf[0] == 'Y' ? 1 : 0; } return apparmor_enabled; } static int libcrun_is_selinux_enabled (libcrun_error_t *err) { if (selinux_enabled < 0) return crun_make_error (err, 0, "SELinux is not initialized correctly"); return selinux_enabled; } int add_selinux_mount_label (char **retlabel, const char *data, const char *label, const char *context_type, libcrun_error_t *err) { int ret; ret = libcrun_is_selinux_enabled (err); if (UNLIKELY (ret < 0)) return ret; if (label && ret) { if (data && *data) xasprintf (retlabel, "%s,%s=\"%s\"", data, context_type, label); else xasprintf (retlabel, "%s=\"%s\"", context_type, label); return 0; } *retlabel = xstrdup (data); return 0; } static const char * lsm_attr_path (const char *lsm, const char *fname, libcrun_error_t *err) { cleanup_close int attr_dirfd = -1; cleanup_close int lsm_dirfd = -1; char *attr_path = NULL; attr_dirfd = open ("/proc/thread-self/attr", O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (attr_dirfd < 0)) { crun_make_error (err, errno, "open `/proc/thread-self/attr`"); return NULL; } // Check for newer scoped interface in /proc/thread-self/attr/ if (lsm != NULL) { lsm_dirfd = openat (attr_dirfd, lsm, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (lsm_dirfd < 0 && errno != ENOENT)) { crun_make_error (err, errno, "open `/proc/thread-self/attr/%s`", lsm); return NULL; } } // Use scoped interface if available, fall back to unscoped xasprintf (&attr_path, "/proc/thread-self/attr/%s%s%s", lsm_dirfd >= 0 ? lsm : "", lsm_dirfd >= 0 ? "/" : "", fname); return attr_path; } static int check_proc_super_magic (int fd, const char *path, libcrun_error_t *err) { struct statfs sfs; int ret = fstatfs (fd, &sfs); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "statfs `%s`", path); if (sfs.f_type != PROC_SUPER_MAGIC) return crun_make_error (err, 0, "the file `%s` is not on a `procfs` file system", path); return 0; } static int set_security_attr (const char *lsm, const char *fname, const char *data, libcrun_error_t *err) { int ret; cleanup_free const char *attr_path = lsm_attr_path (lsm, fname, err); cleanup_close int fd = -1; if (UNLIKELY (attr_path == NULL)) return -1; fd = open (attr_path, O_WRONLY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `%s`", attr_path); ret = check_proc_super_magic (fd, attr_path, err); if (UNLIKELY (ret < 0)) return ret; // Write out data ret = TEMP_FAILURE_RETRY (write (fd, data, strlen (data))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write file `%s`", attr_path); return 0; } int set_selinux_label (const char *label, bool now, libcrun_error_t *err) { int ret; ret = libcrun_is_selinux_enabled (err); if (UNLIKELY (ret < 0)) return ret; if (ret) return set_security_attr (NULL, now ? "current" : "exec", label, err); return 0; } static int libcrun_is_apparmor_enabled (libcrun_error_t *err) { if (apparmor_enabled < 0) return crun_make_error (err, 0, "AppArmor is not initialized correctly"); return apparmor_enabled; } static int is_current_process_confined (libcrun_error_t *err) { cleanup_free const char *attr_path = lsm_attr_path ("apparmor", "current", err); cleanup_close int fd = -1; char buf[256]; if (UNLIKELY (attr_path == NULL)) return -1; fd = open (attr_path, O_RDONLY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `%s`", attr_path); if (UNLIKELY (check_proc_super_magic (fd, attr_path, err))) return -1; ssize_t bytes_read = read (fd, buf, sizeof (buf) - 1); if (UNLIKELY (bytes_read < 0)) return crun_make_error (err, errno, "error reading file `%s`", attr_path); #define UNCONFINED "unconfined" #define UNCONFINED_LEN (ssize_t) (sizeof (UNCONFINED) - 1) return bytes_read >= UNCONFINED_LEN && memcmp (buf, UNCONFINED, UNCONFINED_LEN); } int set_apparmor_profile (const char *profile, bool no_new_privileges, bool now, libcrun_error_t *err) { int ret; ret = libcrun_is_apparmor_enabled (err); if (UNLIKELY (ret < 0)) return ret; if (ret) { cleanup_free char *buf = NULL; ret = is_current_process_confined (err); if (UNLIKELY (ret < 0)) return ret; // if confined only way for apparmor to allow change of profile with NNP is with stacking xasprintf (&buf, "%s %s", no_new_privileges && ret ? "stack" : now ? "changeprofile" : "exec", profile); return set_security_attr ("apparmor", now ? "current" : "exec", buf, err); } return 0; } int read_all_fd_with_size_hint (int fd, const char *description, char **out, size_t *len, size_t size_hint, libcrun_error_t *err) { cleanup_free char *buf = NULL; size_t nread, allocated; size_t pagesize = 0; off_t size = 0; int ret; if (size_hint) allocated = size_hint; else { ret = get_file_size (fd, &size); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "error stat'ing file `%s`", description); allocated = size == 0 ? 1023 : size; } /* NUL terminate the buffer. */ buf = xmalloc (allocated + 1); nread = 0; while ((size && nread < (size_t) size) || size == 0) { ret = TEMP_FAILURE_RETRY (read (fd, buf + nread, allocated - nread)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "error reading from file `%s`", description); if (ret == 0) break; nread += ret; if (nread == allocated) { if (size) break; if (pagesize == 0) pagesize = get_page_size (); allocated += pagesize; buf = xrealloc (buf, allocated + 1); } } if (nread + 1 < allocated) { /* shrink the buffer to the used size if it was allocated a bigger block. */ char *tmp = realloc (buf, nread + 1); if (tmp) buf = tmp; } buf[nread] = '\0'; *out = buf; buf = NULL; if (len) *len = nread; return 0; } int read_all_file_at (int dirfd, const char *path, char **out, size_t *len, libcrun_error_t *err) { cleanup_close int fd = -1; fd = TEMP_FAILURE_RETRY (openat (dirfd, path, O_RDONLY | O_CLOEXEC)); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "error opening file `%s`", path); return read_all_fd (fd, path, out, len, err); } int read_all_file (const char *path, char **out, size_t *len, libcrun_error_t *err) { if (strcmp (path, "-") == 0) path = "/dev/stdin"; return read_all_file_at (AT_FDCWD, path, out, len, err); } int open_unix_domain_client_socket (const char *path, int dgram, libcrun_error_t *err) { struct sockaddr_un addr = {}; int ret; proc_fd_path_t name_buf; cleanup_close int destfd = -1; cleanup_close int fd = -1; fd = socket (AF_UNIX, dgram ? SOCK_DGRAM : SOCK_STREAM, 0); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "error creating UNIX socket"); if (strlen (path) >= sizeof (addr.sun_path)) { destfd = open (path, O_PATH | O_CLOEXEC); if (UNLIKELY (destfd < 0)) return crun_make_error (err, errno, "error opening `%s`", path); get_proc_self_fd_path (name_buf, destfd); path = name_buf; } strcpy (addr.sun_path, path); addr.sun_family = AF_UNIX; ret = connect (fd, (struct sockaddr *) &addr, sizeof (addr)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "connect socket to `%s`", path); ret = fd; fd = -1; return ret; } int open_unix_domain_socket (const char *path, int dgram, libcrun_error_t *err) { struct sockaddr_un addr = {}; proc_fd_path_t name_buf; int ret; cleanup_close int fd = socket (AF_UNIX, dgram ? SOCK_DGRAM : SOCK_STREAM, 0); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "error creating UNIX socket"); if (strlen (path) >= sizeof (addr.sun_path)) { get_proc_self_fd_path (name_buf, fd); path = name_buf; } strcpy (addr.sun_path, path); addr.sun_family = AF_UNIX; ret = bind (fd, (struct sockaddr *) &addr, sizeof (addr)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "bind socket to `%s`", path); if (! dgram) { ret = listen (fd, 1); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "listen on socket"); } ret = fd; fd = -1; return ret; } int send_fd_to_socket (int server, int fd, libcrun_error_t *err) { return send_fd_to_socket_with_payload (server, fd, NULL, 0, err); } int send_fd_to_socket_with_payload (int server, int fd, const char *payload, size_t payload_len, libcrun_error_t *err) { int ret; struct cmsghdr *cmsg = NULL; struct iovec iov[2]; struct msghdr msg = {}; char ctrl_buf[CMSG_SPACE (1 + sizeof (int))] = {}; char data[1]; data[0] = ' '; iov[0].iov_base = data; iov[0].iov_len = sizeof (data); if (payload_len > 0) { iov[0].iov_base = (void *) payload; iov[0].iov_len = payload_len; } msg.msg_name = NULL; msg.msg_namelen = 0; msg.msg_iov = iov; msg.msg_iovlen = 1; msg.msg_controllen = CMSG_SPACE (sizeof (int)); msg.msg_control = ctrl_buf; cmsg = CMSG_FIRSTHDR (&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN (sizeof (int)); *((int *) CMSG_DATA (cmsg)) = fd; ret = TEMP_FAILURE_RETRY (sendmsg (server, &msg, 0)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "sendmsg"); return 0; } int receive_fd_from_socket_with_payload (int from, char *payload, size_t payload_len, libcrun_error_t *err) { cleanup_close int fd = -1; int ret; struct iovec iov[1]; struct msghdr msg = {}; char ctrl_buf[CMSG_SPACE (sizeof (int))] = {}; char data[1]; struct cmsghdr *cmsg; data[0] = ' '; iov[0].iov_base = data; iov[0].iov_len = sizeof (data); if (payload_len > 0) { iov[0].iov_base = (void *) payload; iov[0].iov_len = payload_len; } msg.msg_name = NULL; msg.msg_namelen = 0; msg.msg_iov = iov; msg.msg_iovlen = 1; msg.msg_controllen = CMSG_SPACE (sizeof (int)); msg.msg_control = ctrl_buf; ret = TEMP_FAILURE_RETRY (recvmsg (from, &msg, 0)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "recvmsg"); if (UNLIKELY (ret == 0)) return crun_make_error (err, 0, "read FD: connection closed"); cmsg = CMSG_FIRSTHDR (&msg); if (cmsg == NULL) return crun_make_error (err, 0, "no msg received"); memcpy (&fd, CMSG_DATA (cmsg), sizeof (fd)); ret = fd; fd = -1; return ret; } int receive_fd_from_socket (int from, libcrun_error_t *err) { return receive_fd_from_socket_with_payload (from, NULL, 0, err); } int create_socket_pair (int *pair, libcrun_error_t *err) { int ret = socketpair (AF_UNIX, SOCK_SEQPACKET, 0, pair); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "socketpair"); return 0; } int create_signalfd (sigset_t *mask, libcrun_error_t *err) { int ret = signalfd (-1, mask, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "signalfd"); return ret; } int epoll_helper (int *fds, int *levelfds, libcrun_error_t *err) { struct epoll_event ev; cleanup_close int epollfd = -1; int ret; int *it; epollfd = epoll_create1 (0); if (UNLIKELY (epollfd < 0)) return crun_make_error (err, errno, "epoll_create1"); for (it = fds; *it >= 0; it++) { ev.events = EPOLLIN; ev.data.fd = *it; ret = epoll_ctl (epollfd, EPOLL_CTL_ADD, *it, &ev); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "epoll_ctl add `%d`", *it); } for (it = levelfds; *it >= 0; it++) { ev.events = EPOLLIN | EPOLLET; ev.data.fd = *it; ret = epoll_ctl (epollfd, EPOLL_CTL_ADD, *it, &ev); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "epoll_ctl add `%d`", *it); } ret = epollfd; epollfd = -1; return ret; } int copy_from_fd_to_fd (int src, int dst, int consume, libcrun_error_t *err) { int ret; ssize_t nread; size_t pagesize = get_page_size (); do { cleanup_free char *buffer = NULL; ssize_t remaining; #ifdef HAVE_COPY_FILE_RANGE nread = copy_file_range (src, NULL, dst, NULL, pagesize, 0); if (nread < 0 && (errno == EINVAL || errno == EXDEV)) goto fallback; if (consume && nread < 0 && errno == EAGAIN) return 0; if (nread < 0 && errno == EIO) return 0; if (UNLIKELY (nread < 0)) return crun_make_error (err, errno, "copy_file_range"); continue; fallback: #endif buffer = xmalloc (pagesize); nread = TEMP_FAILURE_RETRY (read (src, buffer, pagesize)); if (consume && nread < 0 && errno == EAGAIN) return 0; if (nread < 0 && errno == EIO) return 0; if (UNLIKELY (nread < 0)) return crun_make_error (err, errno, "read"); remaining = nread; while (remaining) { ret = TEMP_FAILURE_RETRY (write (dst, buffer + nread - remaining, remaining)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write"); remaining -= ret; } } while (consume && nread); return 0; } int run_process (char **args, libcrun_error_t *err) { pid_t pid = fork (); if (UNLIKELY (pid < 0)) return crun_make_error (err, errno, "fork"); if (pid) { int r, status; r = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)); if (r < 0) return crun_make_error (err, errno, "waitpid"); if (WIFEXITED (status) || WIFSIGNALED (status)) return WEXITSTATUS (status); } execvp (args[0], args); _exit (EXIT_FAILURE); } #ifndef HAVE_FGETPWENT_R static unsigned atou (char **s) { unsigned x; for (x = 0; **s - '0' < 10; ++*s) x = 10 * x + (**s - '0'); return x; } int fgetpwent_r (FILE *f, struct passwd *pw, char *line, size_t size, struct passwd **res) { char *s; int rv = 0; for (;;) { line[size - 1] = '\xff'; if ((fgets (line, size, f) == NULL) || ferror (f) || line[size - 1] != '\xff') { rv = (line[size - 1] != '\xff') ? ERANGE : ENOENT; line = 0; pw = 0; break; } line[strcspn (line, "\n")] = 0; s = line; pw->pw_name = s++; if (! (s = strchr (s, ':'))) continue; *s++ = 0; pw->pw_passwd = s; if (! (s = strchr (s, ':'))) continue; *s++ = 0; pw->pw_uid = atou (&s); if (*s != ':') continue; *s++ = 0; pw->pw_gid = atou (&s); if (*s != ':') continue; *s++ = 0; pw->pw_gecos = s; if (! (s = strchr (s, ':'))) continue; *s++ = 0; pw->pw_dir = s; if (! (s = strchr (s, ':'))) continue; *s++ = 0; pw->pw_shell = s; break; } *res = pw; if (rv) errno = rv; return rv; } #endif int set_home_env (uid_t id) { struct passwd pwd; cleanup_free char *buf = NULL; long buf_size; cleanup_file FILE *stream = NULL; buf_size = sysconf (_SC_GETPW_R_SIZE_MAX); if (buf_size < 0) buf_size = 1024; buf = xmalloc (buf_size); stream = fopen ("/etc/passwd", "re"); if (stream == NULL) { if (errno == ENOENT) goto exit; return -1; } for (;;) { int ret; struct passwd *ret_pw = NULL; ret = fgetpwent_r (stream, &pwd, buf, buf_size, &ret_pw); if (UNLIKELY (ret != 0)) { if (errno == ENOENT) return 0; if (errno != ERANGE) return ret; buf_size *= 2; buf = xrealloc (buf, buf_size); continue; } if (ret_pw && ret_pw->pw_uid == id) { setenv ("HOME", ret_pw->pw_dir, 1); return 0; } } exit: /* If the user was not found, set it to something reasonable. */ setenv ("HOME", "/", 1); return 0; } /*if subuid or subgid exist, take the first range for the user */ static int getsubidrange (uid_t id, int is_uid, uint32_t *from, uint32_t *len) { cleanup_file FILE *input = NULL; cleanup_free char *lineptr = NULL; size_t lenlineptr = 0, len_name; long buf_size; cleanup_free char *buf = NULL; const char *name; struct passwd pwd; buf_size = sysconf (_SC_GETPW_R_SIZE_MAX); if (buf_size < 0) buf_size = 1024; buf = xmalloc (buf_size); for (;;) { int ret; struct passwd *ret_pw = NULL; ret = getpwuid_r (id, &pwd, buf, buf_size, &ret_pw); if (LIKELY (ret == 0)) { if (ret_pw) { name = ret_pw->pw_name; break; } return -1; } if (ret < 0 && errno != ERANGE) return ret; buf_size *= 2; buf = xrealloc (buf, buf_size); } len_name = strlen (name); input = fopen (is_uid ? "/etc/subuid" : "/etc/subgid", "re"); if (input == NULL) return -1; for (;;) { char *endptr; ssize_t read = getline (&lineptr, &lenlineptr, input); if (read < 0) return -1; if (read < (ssize_t) (len_name + 2)) continue; if (memcmp (lineptr, name, len_name) || lineptr[len_name] != ':') continue; *from = strtoull (&lineptr[len_name + 1], &endptr, 10); if (endptr >= &lineptr[read]) return -1; *len = strtoull (&endptr[1], &endptr, 10); return 0; } } #define MIN(x, y) ((x) < (y) ? (x) : (y)) size_t format_default_id_mapping (char **ret, uid_t container_id, uid_t host_uid, uid_t host_id, int is_uid) { uint32_t from, available; cleanup_free char *buffer = NULL; size_t written = 0; *ret = NULL; if (getsubidrange (host_uid, is_uid, &from, &available) < 0) return 0; /* More than enough space for all the mappings. */ buffer = xmalloc (15 * 5 * 3); if (container_id > 0) { uint32_t used = MIN (container_id, available); written += sprintf (buffer + written, "%d %d %d\n", 0, from, used); from += used; available -= used; } /* Host ID -> Container ID. */ written += sprintf (buffer + written, "%d %d 1\n", container_id, host_id); /* Last mapping: use any id that is left. */ if (available) written += sprintf (buffer + written, "%d %d %d\n", container_id + 1, from, available); *ret = buffer; buffer = NULL; return written; } static int unset_cloexec_flag (int fd) { int flags = fcntl (fd, F_GETFD); if (flags == -1) return -1; flags &= ~FD_CLOEXEC; return fcntl (fd, F_SETFD, flags); } static void __attribute__ ((__noreturn__)) run_process_child (char *path, char **args, const char *cwd, char **envp, int pipe_r, int pipe_w, int out_fd, int err_fd) { char *tmp_args[] = { path, NULL }; libcrun_error_t err = NULL; int dev_null_fd = -1; int ret; ret = mark_or_close_fds_ge_than (3, false, &err); if (UNLIKELY (ret < 0)) libcrun_fail_with_error ((err)->status, "%s", (err)->msg); if (out_fd < 0 || err_fd < 0) { dev_null_fd = open ("/dev/null", O_WRONLY | O_CLOEXEC); if (UNLIKELY (dev_null_fd < 0)) _exit (EXIT_FAILURE); } TEMP_FAILURE_RETRY (close (pipe_w)); dup2 (pipe_r, 0); TEMP_FAILURE_RETRY (close (pipe_r)); dup2 (out_fd >= 0 ? out_fd : dev_null_fd, 1); dup2 (err_fd >= 0 ? err_fd : dev_null_fd, 2); if (out_fd >= 0) unset_cloexec_flag (1); if (err_fd >= 0) unset_cloexec_flag (2); if (dev_null_fd >= 0) TEMP_FAILURE_RETRY (close (dev_null_fd)); if (out_fd >= 0) TEMP_FAILURE_RETRY (close (out_fd)); if (err_fd >= 0) TEMP_FAILURE_RETRY (close (err_fd)); if (args == NULL) args = tmp_args; if (cwd && chdir (cwd) < 0) _exit (EXIT_FAILURE); execvpe (path, args, envp); _exit (EXIT_FAILURE); } /* It changes the signals mask for the current process. */ int run_process_with_stdin_timeout_envp (char *path, char **args, const char *cwd, int timeout, char **envp, char *stdin, size_t stdin_len, int out_fd, int err_fd, libcrun_error_t *err) { int stdin_pipe[2]; pid_t pid; int ret; cleanup_close int pipe_r = -1; cleanup_close int pipe_w = -1; sigset_t oldmask, mask; int r, status; sigemptyset (&mask); ret = pipe2 (stdin_pipe, O_CLOEXEC); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "pipe"); pipe_r = stdin_pipe[0]; pipe_w = stdin_pipe[1]; if (timeout > 0) { sigaddset (&mask, SIGCHLD); ret = sigprocmask (SIG_BLOCK, &mask, &oldmask); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "sigprocmask"); } pid = fork (); if (UNLIKELY (pid < 0)) { ret = crun_make_error (err, errno, "fork"); goto restore_sig_mask_and_exit; } if (pid == 0) { /* run_process_child doesn't return. */ run_process_child (path, args, cwd, envp, pipe_r, pipe_w, out_fd, err_fd); } close_and_reset (&pipe_r); ret = TEMP_FAILURE_RETRY (write (pipe_w, stdin, stdin_len)); if (UNLIKELY (ret < 0)) { ret = crun_make_error (err, errno, "writing to pipe"); goto restore_sig_mask_and_exit; } close_and_reset (&pipe_w); if (timeout) { time_t start = time (NULL); time_t now; for (now = start; now - start < timeout; now = time (NULL)) { siginfo_t info; int elapsed = now - start; struct timespec ts_timeout = { .tv_sec = timeout - elapsed, .tv_nsec = 0 }; ret = sigtimedwait (&mask, &info, &ts_timeout); if (UNLIKELY (ret < 0 && errno != EAGAIN)) { ret = crun_make_error (err, errno, "sigtimedwait"); goto restore_sig_mask_and_exit; } if (info.si_signo == SIGCHLD && info.si_pid == pid) goto read_waitpid; if (ret < 0 && errno == EAGAIN) goto timeout; } timeout: kill (pid, SIGKILL); ret = crun_make_error (err, 0, "timeout expired for `%s`", path); goto restore_sig_mask_and_exit; } read_waitpid: r = waitpid_ignore_stopped (pid, &status, 0); if (r < 0) ret = crun_make_error (err, errno, "waitpid"); else ret = get_process_exit_status (status); /* Prevent to cleanup the pid again. */ pid = 0; restore_sig_mask_and_exit: if (timeout > 0) { /* Cleanup the zombie process. */ if (pid > 0) { kill (pid, SIGKILL); TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)); } r = sigprocmask (SIG_UNBLOCK, &oldmask, NULL); if (UNLIKELY (r < 0 && ret >= 0)) ret = crun_make_error (err, errno, "restoring signal mask with sigprocmask"); } return ret; } int mark_or_close_fds_ge_than (int n, bool close_now, libcrun_error_t *err) { cleanup_close int cfd = -1; cleanup_dir DIR *dir = NULL; int ret; int fd; struct dirent *next; ret = syscall_close_range (n, UINT_MAX, close_now ? 0 : CLOSE_RANGE_CLOEXEC); if (ret == 0) return 0; if (ret < 0 && errno != EINVAL && errno != ENOSYS && errno != EPERM) return crun_make_error (err, errno, "close_range from `%d`", n); cfd = open ("/proc/self/fd", O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (cfd < 0)) return crun_make_error (err, errno, "open `/proc/self/fd`"); ret = check_proc_super_magic (cfd, "/proc/self/fd", err); if (UNLIKELY (ret < 0)) return ret; dir = fdopendir (cfd); if (UNLIKELY (dir == NULL)) return crun_make_error (err, errno, "cannot fdopendir `/proc/self/fd`"); /* Now it is owned by dir. */ cfd = -1; fd = dirfd (dir); for (next = readdir (dir); next; next = readdir (dir)) { int val; const char *name = next->d_name; if (name[0] == '.') continue; val = strtoll (name, NULL, 10); if (val < n || val == fd) continue; if (close_now) { ret = close (val); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "close(fd=%d)", val); } else { ret = fcntl (val, F_SETFD, FD_CLOEXEC); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot set CLOEXEC fd for `/proc/self/fd/%s`", name); } } return 0; } void get_current_timestamp (char *out, size_t len) { struct timeval tv; struct tm now; char timestamp[64]; gettimeofday (&tv, NULL); gmtime_r (&tv.tv_sec, &now); strftime (timestamp, sizeof (timestamp), "%Y-%m-%dT%H:%M:%S", &now); snprintf (out, len, "%s.%06lldZ", timestamp, (long long int) tv.tv_usec); out[len - 1] = '\0'; } int set_blocking_fd (int fd, int blocking, libcrun_error_t *err) { int ret, flags = fcntl (fd, F_GETFL, 0); if (UNLIKELY (flags < 0)) return crun_make_error (err, errno, "fcntl"); ret = fcntl (fd, F_SETFL, blocking ? flags & ~O_NONBLOCK : flags | O_NONBLOCK); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "fcntl"); return 0; } int parse_json_file (yajl_val *out, const char *jsondata, struct parser_context *ctx arg_unused, libcrun_error_t *err) { char errbuf[1024]; *err = NULL; *out = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (*out == NULL) return crun_make_error (err, 0, "cannot parse the data: `%s`", errbuf); return 0; } static int check_access (const char *path) { int ret; mode_t mode; #ifdef ANDROID ret = access (path, X_OK); #else ret = eaccess (path, X_OK); #endif if (ret < 0) return ret; ret = get_file_type (&mode, false, path); if (UNLIKELY (ret < 0)) return ret; if (! S_ISREG (mode)) { errno = EPERM; return -1; } return 0; } char * find_executable (const char *executable_path, const char *cwd) { cleanup_free char *cwd_executable_path = NULL; cleanup_free char *tmp = NULL; char path[PATH_MAX + 1]; int last_error = ENOENT; char *it, *end; int ret; if (executable_path == NULL) { errno = EINVAL; return NULL; } if (executable_path[0] == '.' || (executable_path[0] != '/' && strchr (executable_path, '/'))) { cleanup_free char *cwd_allocated = NULL; if (cwd == NULL) { cwd_allocated = getcwd (NULL, 0); if (cwd_allocated == NULL) OOM (); cwd = cwd_allocated; } /* Make sure the path starts with a '/' so it will hit the check for absolute paths. */ xasprintf (&cwd_executable_path, "%s%s/%s", cwd[0] == '/' ? "" : "/", cwd, executable_path); executable_path = cwd_executable_path; } /* Absolute path. It doesn't need to lookup $PATH. */ if (executable_path[0] == '/') { ret = check_access (executable_path); if (ret == 0) return xstrdup (executable_path); return NULL; } end = tmp = xstrdup (getenv ("PATH")); while ((it = strsep (&end, ":"))) { size_t len; if (it == end) it = "."; len = snprintf (path, PATH_MAX, "%s/%s", it, executable_path); if (len == PATH_MAX) continue; ret = check_access (path); if (ret == 0) return xstrdup (path); if (errno == ENOENT) continue; last_error = errno; } errno = last_error; return NULL; } #ifdef HAVE_FGETXATTR static ssize_t safe_read_xattr (char **ret, int sfd, const char *srcname, const char *name, size_t initial_size, libcrun_error_t *err) { cleanup_free char *buffer = NULL; ssize_t current_size; ssize_t s; current_size = (ssize_t) initial_size; buffer = xmalloc (current_size + 1); while (1) { s = fgetxattr (sfd, name, buffer, current_size); if (UNLIKELY (s < 0)) return crun_make_error (err, errno, "get xattr `%s` from `%s`", name, srcname); if (s < current_size) break; current_size *= 2; buffer = xrealloc (buffer, current_size + 1); } if (s <= 0) return s; buffer[s] = '\0'; /* Change owner. */ *ret = buffer; buffer = NULL; return s; } static ssize_t copy_xattr (int sfd, int dfd, const char *srcname, const char *destname, libcrun_error_t *err) { cleanup_free char *buf = NULL; ssize_t xattr_len; char *it; xattr_len = flistxattr (sfd, NULL, 0); if (UNLIKELY (xattr_len < 0)) { if (errno == ENOTSUP) return 0; return crun_make_error (err, errno, "get xattr list for `%s`", srcname); } if (xattr_len == 0) return 0; buf = xmalloc (xattr_len + 1); xattr_len = flistxattr (sfd, buf, xattr_len + 1); if (UNLIKELY (xattr_len < 0)) return crun_make_error (err, errno, "get xattr list for `%s`", srcname); for (it = buf; it - buf < xattr_len; it += strlen (it) + 1) { cleanup_free char *v = NULL; ssize_t s; s = safe_read_xattr (&v, sfd, srcname, it, 256, err); if (UNLIKELY (s < 0)) return s; s = fsetxattr (dfd, it, v, s, 0); if (UNLIKELY (s < 0)) { if (errno == EINVAL || errno == EOPNOTSUPP) continue; return crun_make_error (err, errno, "set xattr for `%s`", destname); } } return 0; } #endif static int copy_rec_stat_file_at (int dfd, const char *path, mode_t *mode, off_t *size, dev_t *rdev, uid_t *uid, gid_t *gid) { struct stat st; int ret; #ifdef HAVE_STATX struct statx stx = { 0, }; ret = statx (dfd, path, AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC, STATX_TYPE | STATX_MODE | STATX_SIZE | STATX_UID | STATX_GID, &stx); if (UNLIKELY (ret < 0)) { if (errno == ENOSYS || errno == EINVAL) goto fallback; return ret; } *mode = stx.stx_mode; *size = stx.stx_size; *rdev = makedev (stx.stx_rdev_major, stx.stx_rdev_minor); *uid = stx.stx_uid; *gid = stx.stx_gid; return ret; fallback: #endif ret = fstatat (dfd, path, &st, AT_SYMLINK_NOFOLLOW); *mode = st.st_mode; *size = st.st_size; *rdev = st.st_rdev; *uid = st.st_uid; *gid = st.st_gid; return ret; } int copy_recursive_fd_to_fd (int srcdirfd, int dfd, const char *srcname, const char *destname, libcrun_error_t *err) { cleanup_close int destdirfd = dfd; cleanup_dir DIR *dsrcfd = NULL; struct dirent *de; dsrcfd = fdopendir (srcdirfd); if (UNLIKELY (dsrcfd == NULL)) { TEMP_FAILURE_RETRY (close (srcdirfd)); return crun_make_error (err, errno, "cannot open directory `%s`", destname); } for (de = readdir (dsrcfd); de; de = readdir (dsrcfd)) { cleanup_close int srcfd = -1; cleanup_close int destfd = -1; cleanup_free char *target_buf = NULL; int ret; mode_t mode; off_t st_size; dev_t rdev; uid_t uid; gid_t gid; if (strcmp (de->d_name, ".") == 0 || strcmp (de->d_name, "..") == 0) continue; ret = copy_rec_stat_file_at (dirfd (dsrcfd), de->d_name, &mode, &st_size, &rdev, &uid, &gid); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "stat `%s/%s`", srcname, de->d_name); switch (mode & S_IFMT) { case S_IFREG: srcfd = openat (dirfd (dsrcfd), de->d_name, O_NONBLOCK | O_RDONLY | O_CLOEXEC); if (UNLIKELY (srcfd < 0)) return crun_make_error (err, errno, "open `%s/%s`", srcname, de->d_name); destfd = openat (destdirfd, de->d_name, O_RDWR | O_CREAT | O_CLOEXEC, 0777); if (UNLIKELY (destfd < 0)) return crun_make_error (err, errno, "open `%s/%s`", destname, de->d_name); ret = copy_from_fd_to_fd (srcfd, destfd, 1, err); if (UNLIKELY (ret < 0)) return ret; #ifdef HAVE_FGETXATTR ret = (int) copy_xattr (srcfd, destfd, de->d_name, de->d_name, err); if (UNLIKELY (ret < 0)) return ret; #endif TEMP_FAILURE_RETRY (close (destfd)); destfd = -1; break; case S_IFDIR: ret = mkdirat (destdirfd, de->d_name, mode); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "mkdir `%s/%s`", destname, de->d_name); srcfd = openat (dirfd (dsrcfd), de->d_name, O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (srcfd < 0)) return crun_make_error (err, errno, "open directory `%s/%s`", srcname, de->d_name); destfd = openat (destdirfd, de->d_name, O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (destfd < 0)) return crun_make_error (err, errno, "open directory `%s/%s`", srcname, de->d_name); #ifdef HAVE_FGETXATTR ret = (int) copy_xattr (srcfd, destfd, de->d_name, de->d_name, err); if (UNLIKELY (ret < 0)) return ret; #endif ret = copy_recursive_fd_to_fd (srcfd, destfd, de->d_name, de->d_name, err); srcfd = destfd = -1; if (UNLIKELY (ret < 0)) return ret; break; case S_IFLNK: ret = safe_readlinkat (dirfd (dsrcfd), de->d_name, &target_buf, st_size, err); if (UNLIKELY (ret < 0)) return ret; ret = symlinkat (target_buf, destdirfd, de->d_name); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "create symlink `%s/%s`", destname, de->d_name); break; case S_IFBLK: case S_IFCHR: case S_IFIFO: case S_IFSOCK: ret = mknodat (destdirfd, de->d_name, mode, rdev); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "create special file `%s/%s`", destname, de->d_name); break; } ret = fchownat (destdirfd, de->d_name, uid, gid, AT_SYMLINK_NOFOLLOW); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chown `%s/%s`", destname, de->d_name); /* * ALLPERMS is not defined by POSIX */ #ifndef ALLPERMS # define ALLPERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) #endif ret = fchmodat (destdirfd, de->d_name, mode & ALLPERMS, AT_SYMLINK_NOFOLLOW); if (UNLIKELY (ret < 0)) { /* If the operation fails with ENOTSUP we are dealing with a symlink, so ignore it. */ if (errno == ENOTSUP) continue; return crun_make_error (err, errno, "chmod `%s/%s`", destname, de->d_name); } } return 0; } const char * find_annotation_map (json_map_string_string *annotations, const char *name) { size_t i; if (annotations == NULL) return NULL; for (i = 0; i < annotations->len; i++) { if (strcmp (annotations->keys[i], name) == 0) return annotations->values[i]; } return NULL; } const char * find_annotation (libcrun_container_t *container, const char *name) { if (container->container_def->annotations == NULL) return NULL; return find_annotation_map (container->container_def->annotations, name); } ssize_t safe_write (int fd, const void *buf, ssize_t count) { ssize_t written = 0; if (count < 0) { errno = EINVAL; return -1; } while (written < count) { ssize_t w = write (fd, buf + written, count - written); if (UNLIKELY (w < 0)) { if (errno == EINTR || errno == EAGAIN) continue; return w; } written += w; } return written; } int append_paths (char **out, libcrun_error_t *err, ...) { const size_t MAX_PARTS = 32; const char *parts[MAX_PARTS]; size_t sizes[MAX_PARTS]; size_t total_len = 0; size_t n_parts = 0; size_t copied = 0; va_list ap; size_t i; va_start (ap, err); for (;;) { const char *part; size_t size; part = va_arg (ap, const char *); if (part == NULL) break; if (n_parts == MAX_PARTS) { va_end (ap); return crun_make_error (err, EINVAL, "too many paths specified"); } if (n_parts == 0) { /* For the first component allow only one '/'. */ while (part[0] == '/' && part[1] == '/') part++; } else { /* And drop any initial '/' for other components. */ while (part[0] == '/') part++; } size = strlen (part); if (size == 0) continue; while (size > 1 && part[size - 1] == '/') size--; parts[n_parts] = part; sizes[n_parts] = size; n_parts++; } va_end (ap); total_len = n_parts + 1; for (i = 0; i < n_parts; i++) total_len += sizes[i]; *out = xmalloc (total_len); copied = 0; for (i = 0; i < n_parts; i++) { bool has_trailing_slash; has_trailing_slash = copied > 0 && (*out)[copied - 1] == '/'; if (i > 0 && ! has_trailing_slash) { (*out)[copied] = '/'; copied += 1; } memcpy (*out + copied, parts[i], sizes[i]); copied += sizes[i]; } (*out)[copied] = '\0'; return 0; } /* Adapted from mailutils 0.6.91 (distributed under LGPL 2.0+) */ static int b64_input (char c) { const char table[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int i; for (i = 0; i < 64; i++) { if (table[i] == c) return i; } return -1; } int base64_decode (const char *iptr, size_t isize, char *optr, size_t osize, size_t *nbytes) { int i = 0, tmp = 0, pad = 0; size_t consumed = 0; unsigned char data[4]; *nbytes = 0; while (consumed < isize && (*nbytes) + 3 < osize) { while ((i < 4) && (consumed < isize)) { tmp = b64_input (*iptr++); consumed++; if (tmp != -1) data[i++] = tmp; else if (*(iptr - 1) == '=') { data[i++] = '\0'; pad++; } } /* I have an entire block of data 32 bits get the output data. */ if (i == 4) { *optr++ = (data[0] << 2) | ((data[1] & 0x30) >> 4); *optr++ = ((data[1] & 0xf) << 4) | ((data[2] & 0x3c) >> 2); *optr++ = ((data[2] & 0x3) << 6) | data[3]; (*nbytes) += 3 - pad; } else { /* I did not get all the data. */ consumed -= i; return consumed; } i = 0; } return consumed; } char * get_user_name (uid_t uid) { struct passwd pd; struct passwd *temp_result_ptr; char pwdbuffer[200]; if (! getpwuid_r (uid, &pd, pwdbuffer, sizeof (pwdbuffer), &temp_result_ptr)) return xstrdup (pd.pw_name); return xstrdup (""); } int has_suffix (const char *str, const char *suffix) { if (! str || ! suffix) return 0; size_t lenstr = strlen (str); size_t lensuffix = strlen (suffix); if (lensuffix > lenstr) return 0; return memcmp (str + lenstr - lensuffix, suffix, lensuffix) == 0; } char * str_join_array (int offset, size_t size, char *const array[], const char *joint) { size_t jlen, lens[size]; size_t i, total_size = (size - 1) * (jlen = strlen (joint)) + 1; char *result, *p; for (i = 0; i < size; ++i) { total_size += (lens[i] = strlen (array[i])); } p = result = xmalloc (total_size); for (i = offset; i < size; ++i) { memcpy (p, array[i], lens[i]); p += lens[i]; if (i < size - 1) { memcpy (p, joint, jlen); p += jlen; } } *p = '\0'; return result; } int libcrun_mmap (struct libcrun_mmap_s **ret, void *addr, size_t length, int prot, int flags, int fd, off_t offset, libcrun_error_t *err) { struct libcrun_mmap_s *mmap_s = NULL; void *mapped = mmap (addr, length, prot, flags, fd, offset); if (mapped == MAP_FAILED) return crun_make_error (err, errno, "mmap"); mmap_s = xmalloc (sizeof (struct libcrun_mmap_s)); mmap_s->addr = mapped; mmap_s->length = length; *ret = mmap_s; return 0; } int libcrun_munmap (struct libcrun_mmap_s *mmap, libcrun_error_t *err) { int ret; ret = munmap (mmap->addr, mmap->length); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "munmap"); free (mmap); return 0; } static long read_file_as_long_or_default (const char *path, long def_value) { cleanup_free char *content = NULL; libcrun_error_t tmp_err = NULL; char *endptr; long val; int ret; ret = read_all_file (path, &content, NULL, &tmp_err); if (UNLIKELY (ret < 0)) { crun_error_release (&tmp_err); return def_value; } errno = 0; val = strtol (content, &endptr, 10); if (UNLIKELY (errno)) return def_value; if (endptr == content || (*endptr && *endptr != '\n')) return def_value; return val; } #define DEFAULT_OVERFLOW_ID 65534 uid_t get_overflow_uid (void) { static atomic_long cached_uid = -1; atomic_long uid = cached_uid; if (uid == -1) { uid = read_file_as_long_or_default ("/proc/sys/kernel/overflowuid", DEFAULT_OVERFLOW_ID); cached_uid = uid; } return uid; } gid_t get_overflow_gid (void) { static atomic_long cached_gid = -1; atomic_long gid = cached_gid; if (gid == -1) { gid = read_file_as_long_or_default ("/proc/sys/kernel/overflowgid", DEFAULT_OVERFLOW_ID); cached_gid = gid; } return gid; } crun-1.16.1/src/libcrun/cgroup-cgroupfs.c0000644000000000000000000001134614406334420016460 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "cgroup.h" #include "cgroup-internal.h" #include "cgroup-systemd.h" #include "cgroup-setup.h" #include "cgroup-utils.h" #include "cgroup-cgroupfs.h" #include #include #include #include #include #include #include #include #include #include static char * make_cgroup_path (const char *path, const char *id) { char *ret; if (path == NULL) xasprintf (&ret, "/%s", id); else if (path[0] == '/') ret = xstrdup (path); else xasprintf (&ret, "/%s", path); return ret; } static int libcrun_precreate_cgroup_cgroupfs (struct libcrun_cgroup_args *args, int *dirfd, libcrun_error_t *err) { cleanup_free char *sub_path = make_cgroup_path (args->cgroup_path, args->id); cleanup_free char *cgroup_path = NULL; int ret; /* No need to check the mode since this feature is supported only on cgroup v2, and libcrun_cgroup_preenter already performs this check. */ *dirfd = -1; ret = append_paths (&cgroup_path, err, CGROUP_ROOT, sub_path, NULL); if (UNLIKELY (ret < 0)) return ret; ret = crun_ensure_directory (cgroup_path, 0755, true, err); if (UNLIKELY (ret < 0)) { libcrun_error_release (err); return 0; } ret = enable_controllers (sub_path, err); if (UNLIKELY (ret < 0)) return ret; *dirfd = open (cgroup_path, O_CLOEXEC | O_NOFOLLOW | O_DIRECTORY | O_RDONLY); if (UNLIKELY (*dirfd < 0)) return crun_make_error (err, errno, "open `%s`", cgroup_path); return 0; } static int make_new_sibling_cgroup (char **out, const char *id, libcrun_error_t *err) { cleanup_free char *current_cgroup = NULL; char *dir; int ret; ret = libcrun_get_current_unified_cgroup (¤t_cgroup, false, err); if (UNLIKELY (ret < 0)) return ret; dir = dirname (current_cgroup); append_paths (out, err, dir, id, NULL); return 0; } static int libcrun_cgroup_enter_cgroupfs (struct libcrun_cgroup_args *args, struct libcrun_cgroup_status *out, libcrun_error_t *err) { pid_t pid = args->pid; int cgroup_mode; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; out->path = make_cgroup_path (args->cgroup_path, args->id); if (cgroup_mode == CGROUP_MODE_UNIFIED) { int ret; ret = enable_controllers (out->path, err); if (UNLIKELY (ret < 0)) { /* If the generated path cannot be used attempt to create the new cgroup as a sibling of the current one. */ if (args->cgroup_path == NULL) { libcrun_error_t tmp_err = NULL; int tmp_ret; free (out->path); out->path = NULL; tmp_ret = make_new_sibling_cgroup (&out->path, args->id, &tmp_err); if (UNLIKELY (tmp_ret < 0)) { crun_error_release (&tmp_err); return ret; } crun_error_release (err); ret = enable_controllers (out->path, err); } if (UNLIKELY (ret < 0)) return ret; } } /* The cgroup was already joined, nothing more left to do. */ if (args->joined) return 0; return enter_cgroup (cgroup_mode, pid, 0, out->path, true, err); } static int libcrun_destroy_cgroup_cgroupfs (struct libcrun_cgroup_status *cgroup_status, libcrun_error_t *err) { int mode; int ret; mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (mode < 0)) return mode; ret = cgroup_killall_path (cgroup_status->path, SIGKILL, err); if (UNLIKELY (ret < 0)) crun_error_release (err); return destroy_cgroup_path (cgroup_status->path, mode, err); } struct libcrun_cgroup_manager cgroup_manager_cgroupfs = { .precreate_cgroup = libcrun_precreate_cgroup_cgroupfs, .create_cgroup = libcrun_cgroup_enter_cgroupfs, .destroy_cgroup = libcrun_destroy_cgroup_cgroupfs, }; crun-1.16.1/src/libcrun/cgroup-resources.c0000644000000000000000000012302414551252466016651 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "cgroup.h" #include "cgroup-internal.h" #include "cgroup-systemd.h" #include "cgroup-utils.h" #include "cgroup-resources.h" #include "ebpf.h" #include "utils.h" #include "status.h" #include #include #include #include #include #include #include #include #include static inline int write_cgroup_file (int dirfd, const char *name, const void *data, size_t len, libcrun_error_t *err) { return write_file_at_with_flags (dirfd, O_WRONLY | O_CLOEXEC, 0, name, data, len, err); } static int write_cgroup_file_or_alias (int dirfd, const char *name, const char *alias, const void *data, size_t len, libcrun_error_t *err) { int ret; ret = write_file_at_with_flags (dirfd, O_WRONLY | O_CLOEXEC, 0, name, data, len, err); if (UNLIKELY (alias != NULL && ret < 0 && crun_error_get_errno (err) == ENOENT)) { crun_error_release (err); ret = write_file_at_with_flags (dirfd, O_WRONLY | O_CLOEXEC, 0, alias, data, len, err); } return ret; } static inline int openat_with_alias (int dirfd, const char *name, const char *alias, const char **used_name, int flags, libcrun_error_t *err) { int ret; *used_name = name; ret = openat (dirfd, name, flags); if (UNLIKELY (ret < 0 && alias != NULL && errno == ENOENT)) { *used_name = alias; ret = openat (dirfd, alias, flags); } if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "open `%s`", name); return ret; } static int is_rwm (const char *str, libcrun_error_t *err) { const char *it; bool r = false; bool w = false; bool m = false; for (it = str; *it; it++) switch (*it) { case 'r': r = true; break; case 'w': w = true; break; case 'm': m = true; break; default: return crun_make_error (err, 0, "invalid mode specified `%s`", str); } return r && w && m ? 1 : 0; } static int check_cgroup_v2_controller_available_wrapper (int ret, int cgroup_dirfd, const char *name, libcrun_error_t *err) { if (ret == 0 || err == NULL) return 0; errno = crun_error_get_errno (err); /* If the file is not found, try to give a more meaningful error message. */ if (errno == ENOENT || errno == EPERM || errno == EACCES) { cleanup_free char *controllers = NULL; libcrun_error_t tmp_err = NULL; cleanup_free char *key = NULL; char *saveptr = NULL; bool found = false; const char *token; char *it; /* Check if the specified controller is enabled. */ key = xstrdup (name); it = strchr (key, '.'); if (it == NULL) { crun_error_release (err); return crun_make_error (err, 0, "the specified key has not the form CONTROLLER.VALUE `%s`", name); } *it = '\0'; /* cgroup. files are not part of a controller. Return the original error. */ if (strcmp (key, "cgroup") == 0) return ret; /* If the cgroup.controllers file cannot be read, return the original error. */ if (read_all_file_at (cgroup_dirfd, "cgroup.controllers", &controllers, NULL, &tmp_err) < 0) { crun_error_release (&tmp_err); return ret; } for (token = strtok_r (controllers, " \n", &saveptr); token; token = strtok_r (NULL, " \n", &saveptr)) { if (strcmp (token, key) == 0) { found = true; break; } } if (! found) { crun_error_release (err); return crun_make_error (err, 0, "the requested cgroup controller `%s` is not available", key); } } return ret; } static int write_file_and_check_controllers_at (bool cgroup2, int dirfd, const char *name, const char *name_alias, const void *data, size_t len, libcrun_error_t *err) { int ret; ret = write_cgroup_file_or_alias (dirfd, name, name_alias, data, len, err); if (cgroup2) return check_cgroup_v2_controller_available_wrapper (ret, dirfd, name, err); return ret; } /* The parser generates different structs but they are really all the same. */ typedef runtime_spec_schema_defs_linux_block_io_device_throttle throttling_s; static int write_blkio_v1_resources_throttling (int dirfd, const char *name, throttling_s **throttling, size_t throttling_len, libcrun_error_t *err) { char fmt_buf[128]; size_t i; cleanup_close int fd = -1; if (throttling == NULL) return 0; fd = openat (dirfd, name, O_WRONLY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `%s`", name); for (i = 0; i < throttling_len; i++) { int ret; size_t len; len = sprintf (fmt_buf, "%" PRIu64 ":%" PRIu64 " %" PRIu64 "\n", throttling[i]->major, throttling[i]->minor, throttling[i]->rate); ret = TEMP_FAILURE_RETRY (write (fd, fmt_buf, len)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write `%s`", name); } return 0; } static int write_blkio_v2_resources_throttling (int fd, const char *name, throttling_s **throttling, size_t throttling_len, libcrun_error_t *err) { char fmt_buf[128]; size_t i; if (throttling == NULL) return 0; for (i = 0; i < throttling_len; i++) { int ret; size_t len; len = sprintf (fmt_buf, "%" PRIu64 ":%" PRIu64 " %s=%" PRIu64 "\n", throttling[i]->major, throttling[i]->minor, name, throttling[i]->rate); ret = TEMP_FAILURE_RETRY (write (fd, fmt_buf, len)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write `%s`", name); } return 0; } static int write_blkio_resources (int dirfd, bool cgroup2, runtime_spec_schema_config_linux_resources_block_io *blkio, libcrun_error_t *err) { char fmt_buf[128]; size_t len; int ret; if (blkio->weight) { uint32_t val = blkio->weight; len = sprintf (fmt_buf, "%" PRIu32, val); if (! cgroup2) { ret = write_cgroup_file_or_alias (dirfd, "blkio.weight", "blkio.bfq.weight", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } else { ret = write_cgroup_file (dirfd, "io.bfq.weight", fmt_buf, len, err); if (UNLIKELY (ret < 0)) { if (crun_error_get_errno (err) == ENOENT) { crun_error_release (err); /* convert linearly from [10-1000] to [1-10000] */ val = 1 + (val - 10) * 9999 / 990; len = sprintf (fmt_buf, "%" PRIu32, val); ret = write_cgroup_file (dirfd, "io.weight", fmt_buf, len, err); } if (UNLIKELY (ret < 0)) return ret; } } } if (blkio->leaf_weight) { if (cgroup2) return crun_make_error (err, 0, "cannot set leaf_weight with cgroupv2"); len = sprintf (fmt_buf, "%d", blkio->leaf_weight); ret = write_cgroup_file (dirfd, "blkio.leaf_weight", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } if (blkio->weight_device_len) { if (cgroup2) { cleanup_close int wfd = -1; size_t i; wfd = openat (dirfd, "io.bfq.weight", O_WRONLY | O_CLOEXEC); if (UNLIKELY (wfd < 0)) return crun_make_error (err, errno, "open io.weight"); for (i = 0; i < blkio->weight_device_len; i++) { uint32_t w = blkio->weight_device[i]->weight; len = sprintf (fmt_buf, "%" PRIu64 ":%" PRIu64 " %i\n", blkio->weight_device[i]->major, blkio->weight_device[i]->minor, w); ret = TEMP_FAILURE_RETRY (write (wfd, fmt_buf, len)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write io.weight"); /* Ignore blkio->weight_device[i]->leaf_weight. */ } } else { const char *leaf_weight_device_file_name = NULL; const char *weight_device_file_name = NULL; cleanup_close int w_leafdevice_fd = -1; cleanup_close int w_device_fd = -1; size_t i; w_device_fd = openat_with_alias (dirfd, "blkio.weight_device", "blkio.bfq.weight_device", &weight_device_file_name, O_WRONLY | O_CLOEXEC, err); if (UNLIKELY (w_device_fd < 0)) return w_device_fd; w_leafdevice_fd = openat_with_alias (dirfd, "blkio.leaf_weight_device", "blkio.bfq.leaf_weight_device", &leaf_weight_device_file_name, O_WRONLY | O_CLOEXEC, err); if (UNLIKELY (w_leafdevice_fd < 0)) { /* If the .leaf_weight_device file is missing, just ignore it. */ crun_error_release (err); } for (i = 0; i < blkio->weight_device_len; i++) { len = sprintf (fmt_buf, "%" PRIu64 ":%" PRIu64 " %" PRIu16 "\n", blkio->weight_device[i]->major, blkio->weight_device[i]->minor, blkio->weight_device[i]->weight); ret = TEMP_FAILURE_RETRY (write (w_device_fd, fmt_buf, len)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write `%s`", weight_device_file_name); if (w_leafdevice_fd >= 0) { len = sprintf (fmt_buf, "%" PRIu64 ":%" PRIu64 " %" PRIu16 "\n", blkio->weight_device[i]->major, blkio->weight_device[i]->minor, blkio->weight_device[i]->leaf_weight); ret = TEMP_FAILURE_RETRY (write (w_leafdevice_fd, fmt_buf, len)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write `%s`", leaf_weight_device_file_name); } } } } if (cgroup2) { cleanup_close int wfd = -1; const char *name = "io.max"; wfd = openat (dirfd, name, O_WRONLY | O_CLOEXEC); if (UNLIKELY (wfd < 0)) { ret = crun_make_error (err, errno, "open `%s`", name); return check_cgroup_v2_controller_available_wrapper (ret, dirfd, name, err); } ret = write_blkio_v2_resources_throttling (wfd, "rbps", (throttling_s **) blkio->throttle_read_bps_device, blkio->throttle_read_bps_device_len, err); if (UNLIKELY (ret < 0)) return ret; ret = write_blkio_v2_resources_throttling (wfd, "wbps", (throttling_s **) blkio->throttle_write_bps_device, blkio->throttle_write_bps_device_len, err); if (UNLIKELY (ret < 0)) return ret; ret = write_blkio_v2_resources_throttling (wfd, "riops", (throttling_s **) blkio->throttle_read_iops_device, blkio->throttle_read_iops_device_len, err); if (UNLIKELY (ret < 0)) return ret; ret = write_blkio_v2_resources_throttling (wfd, "wiops", (throttling_s **) blkio->throttle_write_iops_device, blkio->throttle_write_iops_device_len, err); if (UNLIKELY (ret < 0)) return ret; } else { ret = write_blkio_v1_resources_throttling (dirfd, "blkio.throttle.read_bps_device", (throttling_s **) blkio->throttle_read_bps_device, blkio->throttle_read_bps_device_len, err); if (UNLIKELY (ret < 0)) return ret; ret = write_blkio_v1_resources_throttling (dirfd, "blkio.throttle.write_bps_device", (throttling_s **) blkio->throttle_write_bps_device, blkio->throttle_write_bps_device_len, err); if (UNLIKELY (ret < 0)) return ret; ret = write_blkio_v1_resources_throttling (dirfd, "blkio.throttle.read_iops_device", (throttling_s **) blkio->throttle_read_iops_device, blkio->throttle_read_iops_device_len, err); if (UNLIKELY (ret < 0)) return ret; ret = write_blkio_v1_resources_throttling (dirfd, "blkio.throttle.write_iops_device", (throttling_s **) blkio->throttle_write_iops_device, blkio->throttle_write_iops_device_len, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int write_network_resources (int dirfd_netclass, int dirfd_netprio, runtime_spec_schema_config_linux_resources_network *net, libcrun_error_t *err) { char fmt_buf[128]; size_t len; int ret; if (net->class_id) { len = sprintf (fmt_buf, "%d", net->class_id); ret = write_cgroup_file (dirfd_netclass, "net_cls.classid", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } if (net->priorities_len) { size_t i; cleanup_close int fd = -1; fd = openat (dirfd_netprio, "net_prio.ifpriomap", O_WRONLY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `net_prio.ifpriomap`"); for (i = 0; i < net->priorities_len; i++) { len = sprintf (fmt_buf, "%s %d\n", net->priorities[i]->name, net->priorities[i]->priority); ret = TEMP_FAILURE_RETRY (write (fd, fmt_buf, len)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write net_prio.ifpriomap"); } } return 0; } static int write_hugetlb_resources (int dirfd, bool cgroup2, runtime_spec_schema_config_linux_resources_hugepage_limits_element **htlb, size_t htlb_len, libcrun_error_t *err) { char fmt_buf[128]; size_t i; for (i = 0; i < htlb_len; i++) { cleanup_free char *filename = NULL; const char *suffix; size_t len; int ret; suffix = cgroup2 ? "max" : "limit_in_bytes"; xasprintf (&filename, "hugetlb.%s.%s", htlb[i]->page_size, suffix); len = sprintf (fmt_buf, "%" PRIu64, htlb[i]->limit); ret = write_file_and_check_controllers_at (cgroup2, dirfd, filename, NULL, fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int write_devices_resources_v1 (int dirfd, runtime_spec_schema_defs_linux_device_cgroup **devs, size_t devs_len, libcrun_error_t *err) { size_t i, len; int ret; char *default_devices[] = { "c *:* m", "b *:* m", "c 1:3 rwm", "c 1:8 rwm", "c 1:7 rwm", "c 5:0 rwm", "c 1:5 rwm", "c 1:9 rwm", "c 5:1 rwm", "c 136:* rwm", "c 5:2 rwm", NULL }; for (i = 0; i < devs_len; i++) { /* It is plenty of room for "TYPE MAJOR:MINOR ACCESS", where type is one char, and ACCESS is at most 3. */ #define FMT_BUF_LEN 64 char fmt_buf[FMT_BUF_LEN]; const char *file = devs[i]->allow ? "devices.allow" : "devices.deny"; if (devs[i]->type == NULL || devs[i]->type[0] == 'a') { strcpy (fmt_buf, "a"); len = 1; } else { char fmt_buf_major[16]; char fmt_buf_minor[16]; #define FMT_DEV(x, b) \ do \ { \ if (x##_present) \ sprintf (b, "%" PRIi64, x); \ else \ strcpy (b, "*"); \ } while (0) FMT_DEV (devs[i]->major, fmt_buf_major); FMT_DEV (devs[i]->minor, fmt_buf_minor); len = snprintf (fmt_buf, FMT_BUF_LEN - 1, "%s %s:%s %s", devs[i]->type, fmt_buf_major, fmt_buf_minor, devs[i]->access); /* Make sure it is still a NUL terminated string. */ fmt_buf[len] = '\0'; } ret = write_cgroup_file (dirfd, file, fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } for (i = 0; default_devices[i]; i++) { ret = write_cgroup_file (dirfd, "devices.allow", default_devices[i], strlen (default_devices[i]), err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int write_devices_resources_v2_internal (int dirfd, runtime_spec_schema_defs_linux_device_cgroup **devs, size_t devs_len, libcrun_error_t *err) { int i, ret; cleanup_free struct bpf_program *program = NULL; struct default_dev_s { char type; int major; int minor; const char *access; }; struct default_dev_s default_devices[] = { { 'c', -1, -1, "m" }, { 'b', -1, -1, "m" }, { 'c', 1, 3, "rwm" }, { 'c', 1, 8, "rwm" }, { 'c', 1, 7, "rwm" }, { 'c', 5, 0, "rwm" }, { 'c', 1, 5, "rwm" }, { 'c', 1, 9, "rwm" }, { 'c', 5, 1, "rwm" }, { 'c', 136, -1, "rwm" }, { 'c', 5, 2, "rwm" }, }; program = bpf_program_new (2048); program = bpf_program_init_dev (program, err); if (UNLIKELY (program == NULL)) return -1; for (i = (sizeof (default_devices) / sizeof (default_devices[0])) - 1; i >= 0; i--) { program = bpf_program_append_dev (program, default_devices[i].access, default_devices[i].type, default_devices[i].major, default_devices[i].minor, true, err); if (UNLIKELY (program == NULL)) return -1; } for (i = devs_len - 1; i >= 0; i--) { char type = 'a'; int minor = -1, major = -1; if (devs[i]->type != NULL) type = devs[i]->type[0]; if (devs[i]->major_present) major = devs[i]->major; if (devs[i]->minor_present) minor = devs[i]->minor; program = bpf_program_append_dev (program, devs[i]->access, type, major, minor, devs[i]->allow, err); if (UNLIKELY (program == NULL)) return -1; } program = bpf_program_complete_dev (program, err); if (UNLIKELY (program == NULL)) return -1; ret = libcrun_ebpf_load (program, dirfd, NULL, err); if (ret < 0) return ret; return 0; } static int write_devices_resources_v2 (int dirfd, runtime_spec_schema_defs_linux_device_cgroup **devs, size_t devs_len, libcrun_error_t *err) { int ret; size_t i; bool can_skip = true; ret = write_devices_resources_v2_internal (dirfd, devs, devs_len, err); if (LIKELY (ret == 0)) return 0; /* If writing the resources ebpf failed, check if it is fine to ignore the error. */ for (i = 0; i < devs_len; i++) { if (devs[i]->allow_present && ! devs[i]->allow) { can_skip = false; break; } } if (! can_skip) { libcrun_error_t tmp_err = NULL; int rootless; rootless = is_rootless (&tmp_err); if (UNLIKELY (rootless < 0)) { crun_error_release (err); *err = tmp_err; return ret; } if (rootless) can_skip = true; } if (can_skip) { crun_error_release (err); ret = 0; } return ret; } static int write_devices_resources (int dirfd, bool cgroup2, runtime_spec_schema_defs_linux_device_cgroup **devs, size_t devs_len, libcrun_error_t *err) { int ret; if (cgroup2) ret = write_devices_resources_v2 (dirfd, devs, devs_len, err); else ret = write_devices_resources_v1 (dirfd, devs, devs_len, err); if (UNLIKELY (ret < 0)) { libcrun_error_t tmp_err = NULL; int rootless; rootless = is_rootless (&tmp_err); if (UNLIKELY (rootless < 0)) { crun_error_release (&tmp_err); return ret; } if (rootless) { crun_error_release (err); ret = 0; } } return ret; } /* use for cgroupv2 files with .min, .max, .low, or .high suffix */ static int cg_itoa (char *buf, int64_t value, bool use_max) { if (use_max && value < 0) { memcpy (buf, "max", 4); return 3; } return sprintf (buf, "%" PRIi64, value); } static int write_memory (int dirfd, bool cgroup2, runtime_spec_schema_config_linux_resources_memory *memory, libcrun_error_t *err) { char limit_buf[32]; size_t limit_buf_len; if (! memory->limit_present) return 0; limit_buf_len = cg_itoa (limit_buf, memory->limit, cgroup2); return write_cgroup_file (dirfd, cgroup2 ? "memory.max" : "memory.limit_in_bytes", limit_buf, limit_buf_len, err); } static int write_memory_swap (int dirfd, bool cgroup2, runtime_spec_schema_config_linux_resources_memory *memory, libcrun_error_t *err) { int ret; int64_t swap; char swap_buf[32]; size_t swap_buf_len; const char *fname = cgroup2 ? "memory.swap.max" : "memory.memsw.limit_in_bytes"; if (! memory->swap_present) return 0; swap = memory->swap; // Cgroupv2 apply limit must check if swap > 0, since `0` and `-1` are special case // 0: This means process will not be able to use any swap space. // -1: This means that the process can use as much swap as it needs. if (cgroup2 && memory->swap > 0) { if (! memory->limit_present) return crun_make_error (err, 0, "cannot set swap limit without the memory limit"); if (memory->swap < memory->limit) return crun_make_error (err, 0, "cannot set memory+swap limit less than the memory limit"); swap -= memory->limit; } swap_buf_len = cg_itoa (swap_buf, swap, cgroup2); ret = write_cgroup_file (dirfd, fname, swap_buf, swap_buf_len, err); if (ret >= 0) return ret; /* If swap is not enabled, ignore the error. */ if (crun_error_get_errno (err) == ENOENT) { crun_error_release (err); return 0; } return ret; } static int write_memory_resources (int dirfd, bool cgroup2, runtime_spec_schema_config_linux_resources_memory *memory, libcrun_error_t *err) { size_t len; int ret; char fmt_buf[32]; bool memory_limits_written = false; if (cgroup2 && memory->check_before_update_present && memory->check_before_update) { cleanup_free char *swap_current = NULL; cleanup_free char *current = NULL; uint64_t limit = 0; uint64_t val, val_swap; int ret; ret = read_all_file_at (dirfd, "memory.current", ¤t, NULL, err); if (UNLIKELY (ret < 0)) return ret; ret = read_all_file_at (dirfd, "memory.swap.current", &swap_current, NULL, err); if (UNLIKELY (ret < 0)) return ret; errno = 0; val = strtoll (current, NULL, 10); if (UNLIKELY (errno)) return crun_make_error (err, errno, "parse memory.current"); val_swap = strtoll (swap_current, NULL, 10); if (UNLIKELY (errno)) return crun_make_error (err, errno, "parse memory.swap.current"); if (memory->limit_present && memory->limit >= 0) limit = memory->limit; if (memory->swap_present && memory->swap >= 0) limit += memory->swap; if (limit <= val + val_swap) return crun_make_error (err, 0, "cannot set the memory limit lower than its current usage"); } if (memory->limit_present) { ret = write_memory (dirfd, cgroup2, memory, err); if (ret >= 0) memory_limits_written = true; else { if (cgroup2 || crun_error_get_errno (err) != EINVAL) return ret; /* If we get an EINVAL error on cgroup v1 we reverse the order we write the memory limit and the swap. Attempt to write again the memory limit once the memory swap is written. */ crun_error_release (err); } } ret = write_memory_swap (dirfd, cgroup2, memory, err); if (UNLIKELY (ret < 0)) return ret; if (memory->limit_present && ! memory_limits_written) { ret = write_memory (dirfd, cgroup2, memory, err); if (UNLIKELY (ret < 0)) return ret; } if (memory->kernel_present) { if (cgroup2) return crun_make_error (err, 0, "cannot set kernel memory with cgroupv2"); len = sprintf (fmt_buf, "%" PRIu64, memory->kernel); ret = write_cgroup_file (dirfd, "memory.kmem.limit_in_bytes", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } // allows users set use_hierarchy as 0 when defined as false in spec. // if use_hierarchy is not defined in spec value defaults to 1 (True). // Note: users can only toggle use_hierarchy if the parent cgroup has use_hierarchy configured as 0. if (memory->use_hierarchy_present) { if (cgroup2) return crun_make_error (err, 0, "cannot set useHierarchy memory with cgroupv2"); ret = write_cgroup_file (dirfd, "memory.use_hierarchy", (memory->use_hierarchy) ? "1" : "0", 1, err); if (UNLIKELY (ret < 0)) return ret; } if (memory->reservation_present) { len = sprintf (fmt_buf, "%" PRIu64, memory->reservation); ret = write_file_and_check_controllers_at (cgroup2, dirfd, cgroup2 ? "memory.low" : "memory.soft_limit_in_bytes", NULL, fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } if (memory->disable_oom_killer) { if (cgroup2) return crun_make_error (err, 0, "cannot disable OOM killer with cgroupv2"); ret = write_cgroup_file (dirfd, "memory.oom_control", "1", 1, err); if (UNLIKELY (ret < 0)) return ret; } if (memory->kernel_tcp_present) { if (cgroup2) return crun_make_error (err, 0, "cannot set kernel TCP with cgroupv2"); len = sprintf (fmt_buf, "%" PRIu64, memory->kernel_tcp); ret = write_cgroup_file (dirfd, "memory.kmem.tcp.limit_in_bytes", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } if (memory->swappiness_present) { if (cgroup2) return crun_make_error (err, 0, "cannot set memory swappiness with cgroupv2"); len = sprintf (fmt_buf, "%" PRIu64, memory->swappiness); ret = write_cgroup_file (dirfd, "memory.swappiness", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } int write_cpu_burst (int cpu_dirfd, bool cgroup2, runtime_spec_schema_config_linux_resources_cpu *cpu, libcrun_error_t *err) { char fmt_buf[32]; size_t len; if (! cpu->burst_present) return 0; len = sprintf (fmt_buf, "%" PRIi64, cpu->burst); return write_cgroup_file (cpu_dirfd, cgroup2 ? "cpu.max.burst" : "cpu.cfs_burst_us", fmt_buf, len, err); } static int write_pids_resources (int dirfd, bool cgroup2, runtime_spec_schema_config_linux_resources_pids *pids, libcrun_error_t *err) { if (pids->limit) { char fmt_buf[32]; size_t len; int ret; len = cg_itoa (fmt_buf, pids->limit, true); ret = write_file_and_check_controllers_at (cgroup2, dirfd, "pids.max", NULL, fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int write_cpu_resources (int dirfd_cpu, bool cgroup2, runtime_spec_schema_config_linux_resources_cpu *cpu, libcrun_error_t *err) { size_t len, period_len; int ret; char fmt_buf[64]; int64_t period = -1; int64_t quota = -1; cleanup_free char *period_str = NULL; if (cpu->shares) { uint32_t val = cpu->shares; if (cgroup2) val = convert_shares_to_weight (val); len = sprintf (fmt_buf, "%u", val); ret = write_file_and_check_controllers_at (cgroup2, dirfd_cpu, cgroup2 ? "cpu.weight" : "cpu.shares", NULL, fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } if (cpu->period) { if (cgroup2) period = cpu->period; else { len = sprintf (fmt_buf, "%" PRIu64, cpu->period); ret = write_cgroup_file (dirfd_cpu, "cpu.cfs_period_us", fmt_buf, len, err); if (UNLIKELY (ret < 0)) { /* Sometimes when the period to be set is smaller than the current one, it is rejected by the kernel (EINVAL) as old_quota/new_period exceeds the parent cgroup quota limit. If this happens and the quota is going to be set, ignore the error for now and retry after setting the quota. */ if (! cpu->quota || crun_error_get_errno (err) != EINVAL) return ret; crun_error_release (err); period_str = xstrdup (fmt_buf); period_len = len; } } } if (cpu->quota) { if (cgroup2) quota = cpu->quota; else { len = sprintf (fmt_buf, "%" PRIi64, cpu->quota); ret = write_cgroup_file (dirfd_cpu, "cpu.cfs_quota_us", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; if (period_str != NULL) { ret = write_cgroup_file (dirfd_cpu, "cpu.cfs_period_us", period_str, period_len, err); if (UNLIKELY (ret < 0)) return ret; } } } if (cpu->realtime_period) { if (cgroup2) return crun_make_error (err, 0, "realtime period not supported on cgroupv2"); len = sprintf (fmt_buf, "%" PRIu64, cpu->realtime_period); ret = write_cgroup_file (dirfd_cpu, "cpu.rt_period_us", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } if (cpu->realtime_runtime) { if (cgroup2) return crun_make_error (err, 0, "realtime runtime not supported on cgroupv2"); len = sprintf (fmt_buf, "%" PRIu64, cpu->realtime_runtime); ret = write_cgroup_file (dirfd_cpu, "cpu.rt_runtime_us", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } if (cpu->idle_present) { len = sprintf (fmt_buf, "%" PRIi64, cpu->idle); ret = write_cgroup_file (dirfd_cpu, "cpu.idle", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } if (cgroup2 && (quota > 0 || period > 0)) { if (period < 0) period = 100000; if (quota < 0) len = sprintf (fmt_buf, "max %" PRIi64, period); else len = sprintf (fmt_buf, "%" PRIi64 " %" PRIi64, quota, period); ret = write_file_and_check_controllers_at (cgroup2, dirfd_cpu, "cpu.max", NULL, fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } return write_cpu_burst (dirfd_cpu, cgroup2, cpu, err); } int write_cpuset_resources (int dirfd_cpuset, int cgroup2, runtime_spec_schema_config_linux_resources_cpu *cpu, libcrun_error_t *err) { int ret; if (cpu == NULL) return 0; if (cpu->cpus) { ret = write_file_and_check_controllers_at (cgroup2, dirfd_cpuset, "cpuset.cpus", "cpus", cpu->cpus, strlen (cpu->cpus), err); if (UNLIKELY (ret < 0)) return ret; } if (cpu->mems) { ret = write_file_and_check_controllers_at (cgroup2, dirfd_cpuset, "cpuset.mems", "mems", cpu->mems, strlen (cpu->mems), err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int update_cgroup_v1_resources (runtime_spec_schema_config_linux_resources *resources, const char *path, libcrun_error_t *err) { int ret; if (resources->block_io) { cleanup_free char *path_to_blkio = NULL; cleanup_close int dirfd_blkio = -1; runtime_spec_schema_config_linux_resources_block_io *blkio = resources->block_io; ret = append_paths (&path_to_blkio, err, CGROUP_ROOT "/blkio", path, NULL); if (UNLIKELY (ret < 0)) return ret; dirfd_blkio = open (path_to_blkio, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd_blkio < 0)) return crun_make_error (err, errno, "open `%s`", path_to_blkio); ret = write_blkio_resources (dirfd_blkio, false, blkio, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->network) { cleanup_free char *path_to_netclass = NULL; cleanup_close int dirfd_netclass = -1; cleanup_free char *path_to_netprio = NULL; cleanup_close int dirfd_netprio = -1; runtime_spec_schema_config_linux_resources_network *network = resources->network; ret = append_paths (&path_to_netclass, err, CGROUP_ROOT "/net_cls", path, NULL); if (UNLIKELY (ret < 0)) return ret; ret = append_paths (&path_to_netprio, err, CGROUP_ROOT "/net_prio", path, NULL); if (UNLIKELY (ret < 0)) return ret; dirfd_netclass = open (path_to_netclass, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd_netclass < 0)) return crun_make_error (err, errno, "open `%s`", path_to_netclass); dirfd_netprio = open (path_to_netprio, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd_netprio < 0)) return crun_make_error (err, errno, "open `%s`", path_to_netprio); ret = write_network_resources (dirfd_netclass, dirfd_netprio, network, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->hugepage_limits_len) { cleanup_free char *path_to_htlb = NULL; cleanup_close int dirfd_htlb = -1; ret = append_paths (&path_to_htlb, err, CGROUP_ROOT "/hugetlb", path, NULL); if (UNLIKELY (ret < 0)) return ret; dirfd_htlb = open (path_to_htlb, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd_htlb < 0)) return crun_make_error (err, errno, "open `%s`", path_to_htlb); ret = write_hugetlb_resources (dirfd_htlb, false, resources->hugepage_limits, resources->hugepage_limits_len, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->devices_len) { cleanup_free char *path_to_devs = NULL; cleanup_close int dirfd_devs = -1; ret = append_paths (&path_to_devs, err, CGROUP_ROOT "/devices", path, NULL); if (UNLIKELY (ret < 0)) return ret; dirfd_devs = open (path_to_devs, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd_devs < 0)) return crun_make_error (err, errno, "open `%s`", path_to_devs); ret = write_devices_resources (dirfd_devs, false, resources->devices, resources->devices_len, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->memory) { cleanup_free char *path_to_mem = NULL; cleanup_close int dirfd_mem = -1; ret = append_paths (&path_to_mem, err, CGROUP_ROOT "/memory", path, NULL); if (UNLIKELY (ret < 0)) return ret; dirfd_mem = open (path_to_mem, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd_mem < 0)) return crun_make_error (err, errno, "open `%s`", path_to_mem); ret = write_memory_resources (dirfd_mem, false, resources->memory, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->pids) { cleanup_free char *path_to_pid = NULL; cleanup_close int dirfd_pid = -1; ret = append_paths (&path_to_pid, err, CGROUP_ROOT "/pids", path, NULL); if (UNLIKELY (ret < 0)) return ret; dirfd_pid = open (path_to_pid, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd_pid < 0)) return crun_make_error (err, errno, "open `%s`", path_to_pid); ret = write_pids_resources (dirfd_pid, false, resources->pids, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->cpu) { cleanup_free char *path_to_cpu = NULL; cleanup_close int dirfd_cpu = -1; cleanup_free char *path_to_cpuset = NULL; cleanup_close int dirfd_cpuset = -1; ret = append_paths (&path_to_cpu, err, CGROUP_ROOT "/cpu", path, NULL); if (UNLIKELY (ret < 0)) return ret; dirfd_cpu = open (path_to_cpu, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd_cpu < 0)) return crun_make_error (err, errno, "open `%s`", path_to_cpu); ret = write_cpu_resources (dirfd_cpu, false, resources->cpu, err); if (UNLIKELY (ret < 0)) return ret; if (resources->cpu->cpus == NULL && resources->cpu->mems == NULL) return 0; ret = append_paths (&path_to_cpuset, err, CGROUP_ROOT "/cpuset", path, NULL); if (UNLIKELY (ret < 0)) return ret; dirfd_cpuset = open (path_to_cpuset, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd_cpuset < 0)) return crun_make_error (err, errno, "open `%s`", path_to_cpuset); ret = write_cpuset_resources (dirfd_cpuset, false, resources->cpu, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->unified && resources->unified->len > 0) return crun_make_error (err, 0, "invalid configuration: cannot use unified on cgroup v1"); return 0; } static int write_unified_resources (int cgroup_dirfd, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err) { size_t i; int ret; for (i = 0; i < resources->unified->len; i++) { size_t len; if (strchr (resources->unified->keys[i], '/')) return crun_make_error (err, 0, "key `%s` must be a file name without any slash", resources->unified->keys[i]); len = strlen (resources->unified->values[i]); ret = write_file_and_check_controllers_at (true, cgroup_dirfd, resources->unified->keys[i], NULL, resources->unified->values[i], len, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int update_cgroup_v2_resources (runtime_spec_schema_config_linux_resources *resources, const char *path, libcrun_error_t *err) { cleanup_free char *cgroup_path = NULL; cleanup_close int cgroup_dirfd = -1; int ret; if (resources->network) return crun_make_error (err, 0, "network limits not supported on cgroupv2"); ret = append_paths (&cgroup_path, err, CGROUP_ROOT, path, NULL); if (UNLIKELY (ret < 0)) return ret; cgroup_dirfd = open (cgroup_path, O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (cgroup_dirfd < 0)) return crun_make_error (err, errno, "open `%s`", cgroup_path); if (resources->devices_len) { ret = write_devices_resources (cgroup_dirfd, true, resources->devices, resources->devices_len, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->memory) { ret = write_memory_resources (cgroup_dirfd, true, resources->memory, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->pids) { ret = write_pids_resources (cgroup_dirfd, true, resources->pids, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->cpu) { ret = write_cpu_resources (cgroup_dirfd, true, resources->cpu, err); if (UNLIKELY (ret < 0)) return ret; ret = write_cpuset_resources (cgroup_dirfd, true, resources->cpu, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->block_io) { ret = write_blkio_resources (cgroup_dirfd, true, resources->block_io, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->hugepage_limits_len) { ret = write_hugetlb_resources (cgroup_dirfd, true, resources->hugepage_limits, resources->hugepage_limits_len, err); if (UNLIKELY (ret < 0)) return ret; } /* Write unified resources if any. They have higher precedence and override any previous setting. */ if (resources->unified) { ret = write_unified_resources (cgroup_dirfd, resources, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } int update_cgroup_resources (const char *path, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err) { int cgroup_mode; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; if (path == NULL) { size_t i; if (resources->block_io || resources->network || resources->hugepage_limits_len || resources->memory || resources->pids || resources->cpu) return crun_make_error (err, 0, "cannot set limits without cgroups"); for (i = 0; i < resources->devices_len; i++) { int rwm; rwm = is_rwm (resources->devices[i]->access, err); if (UNLIKELY (rwm < 0)) return rwm; if (rwm == 0) return crun_make_error (err, 0, "cannot set limits without cgroups"); } return 0; } switch (cgroup_mode) { case CGROUP_MODE_UNIFIED: return update_cgroup_v2_resources (resources, path, err); case CGROUP_MODE_LEGACY: case CGROUP_MODE_HYBRID: return update_cgroup_v1_resources (resources, path, err); default: return crun_make_error (err, 0, "invalid cgroup mode `%d`", cgroup_mode); } } crun-1.16.1/src/libcrun/cgroup-setup.c0000644000000000000000000003620014561214571015772 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "cgroup.h" #include "cgroup-internal.h" #include "cgroup-systemd.h" #include "cgroup-utils.h" #include "ebpf.h" #include "utils.h" #include "status.h" #include #include #include #include #include #include #include #include #include #include #include static int initialize_cpuset_subsystem_rec (char *path, size_t path_len, char *cpus, char *mems, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err) { cleanup_free char *allocated_cpus = NULL; cleanup_free char *allocated_mems = NULL; cleanup_close int dirfd = -1; cleanup_close int mems_fd = -1; cleanup_close int cpus_fd = -1; bool has_cpus = false, has_mems = false; int b_len; dirfd = open (path, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd < 0)) return crun_make_error (err, errno, "open `%s`", path); /* If we don't yet have a cpu/mem value to base the child off of, we attempt to read it. * Either, it's the newly created cgroup (and thus is still empty), or it's a parent that's been * prepopulated. */ if (cpus[0] == '\0') { cpus_fd = openat (dirfd, "cpuset.cpus", O_RDWR | O_CLOEXEC); if (UNLIKELY (cpus_fd < 0 && errno == ENOENT)) cpus_fd = openat (dirfd, "cpus", O_RDWR | O_CLOEXEC); if (UNLIKELY (cpus_fd < 0)) return crun_make_error (err, errno, "open `%s/%s`", path, "cpuset.cpus"); b_len = TEMP_FAILURE_RETRY (read (cpus_fd, cpus, 256)); if (UNLIKELY (b_len < 0)) return crun_make_error (err, errno, "read from `cpuset.cpus`"); cpus[b_len] = '\0'; if (cpus[0] == '\n') cpus[0] = '\0'; if (cpus[0] != '\0') has_cpus = true; } if (mems[0] == '\0') { mems_fd = openat (dirfd, "cpuset.mems", O_RDWR | O_CLOEXEC); if (UNLIKELY (mems_fd < 0 && errno == ENOENT)) mems_fd = openat (dirfd, "mems", O_RDWR | O_CLOEXEC); if (UNLIKELY (mems_fd < 0)) return crun_make_error (err, errno, "open `%s/%s`", path, "cpuset.mems"); b_len = TEMP_FAILURE_RETRY (read (mems_fd, mems, 256)); if (UNLIKELY (b_len < 0)) return crun_make_error (err, errno, "read from `cpuset.mems`"); mems[b_len] = '\0'; if (mems[0] == '\n') mems[0] = '\0'; if (mems[0] != '\0') has_mems = true; } /* If we fail to find one, we should continue searching up until we find one */ if (cpus[0] == '\0' || mems[0] == '\0') { size_t parent_path_len; int ret; for (parent_path_len = path_len - 1; parent_path_len > 1 && path[parent_path_len] != '/'; parent_path_len--) ; if (parent_path_len == 1) return 0; path[parent_path_len] = '\0'; ret = initialize_cpuset_subsystem_rec (path, parent_path_len, cpus, mems, resources, err); path[parent_path_len] = '/'; if (UNLIKELY (ret < 0)) { /* Ignore errors here and try to write the configuration we want later on. */ crun_error_release (err); } } /* If we know the resources, use them, instead of initializing with the full set, only to revert it later. * Only do so if we didn't read the cpus and mems we have from this cgroup. * Otherwise, we'll clobber existing values, which is problematic when there are multiple containers in a cgroup. */ if (resources && resources->cpu) { if (resources->cpu->cpus && ! has_cpus) cpus = allocated_cpus = xstrdup (resources->cpu->cpus); if (resources->cpu->mems && ! has_mems) mems = allocated_mems = xstrdup (resources->cpu->mems); } /* Finally, if we have a fd to populate, write the value chosen. If we have a value from the resources struct to base it off of, * use that, otherwise use the parent's. */ if (cpus_fd >= 0) { b_len = TEMP_FAILURE_RETRY (write (cpus_fd, cpus, strlen (cpus))); if (UNLIKELY (b_len < 0)) return crun_make_error (err, errno, "write `cpuset.cpus`"); } if (mems_fd >= 0) { b_len = TEMP_FAILURE_RETRY (write (mems_fd, mems, strlen (mems))); if (UNLIKELY (b_len < 0)) return crun_make_error (err, errno, "write `cpuset.mems`"); } return 0; } int initialize_cpuset_subsystem (const char *path, libcrun_error_t *err) { cleanup_free char *tmp_path = xstrdup (path); char cpus_buf[257]; char mems_buf[257]; cpus_buf[0] = mems_buf[0] = '\0'; return initialize_cpuset_subsystem_rec (tmp_path, strlen (tmp_path), cpus_buf, mems_buf, NULL, err); } int initialize_cpuset_subsystem_resources (const char *path, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err) { cleanup_free char *tmp_path = xstrdup (path); char cpus_buf[257]; char mems_buf[257]; cpus_buf[0] = mems_buf[0] = '\0'; return initialize_cpuset_subsystem_rec (tmp_path, strlen (tmp_path), cpus_buf, mems_buf, resources, err); } static int initialize_memory_subsystem (const char *path, libcrun_error_t *err) { const char *const files[] = { "memory.limit_in_bytes", "memory.kmem.limit_in_bytes", "memory.memsw.limit_in_bytes", NULL }; cleanup_close int dirfd = -1; int i; dirfd = open (path, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd < 0)) return crun_make_error (err, errno, "open `%s`", path); for (i = 0; files[i]; i++) { int ret; ret = write_file_at (dirfd, files[i], "-1", 2, err); if (UNLIKELY (ret < 0)) { /* Ignore any error here. */ crun_error_release (err); } } return 0; } int enter_cgroup_subsystem (pid_t pid, const char *subsystem, const char *path, bool create_if_missing, libcrun_error_t *err) { cleanup_free char *cgroup_path = NULL; int ret; ret = append_paths (&cgroup_path, err, CGROUP_ROOT, subsystem ? subsystem : "", path ? path : "", NULL); if (UNLIKELY (ret < 0)) return ret; if (create_if_missing) { ret = crun_ensure_directory (cgroup_path, 0755, false, err); if (UNLIKELY (ret < 0)) { if (errno != EROFS) return crun_make_error (err, errno, "creating cgroup directory `%s`", cgroup_path); crun_error_release (err); return 0; } if (strcmp (subsystem, "cpuset") == 0) { ret = initialize_cpuset_subsystem (cgroup_path, err); if (UNLIKELY (ret < 0)) return ret; } if (strcmp (subsystem, "memory") == 0) { ret = initialize_memory_subsystem (cgroup_path, err); if (UNLIKELY (ret < 0)) return ret; } } else { ret = crun_path_exists (cgroup_path, err); if (UNLIKELY (ret < 0)) return ret; if (ret == 0) return 0; } return move_process_to_cgroup (pid, subsystem, path, err); } static int get_file_owner (const char *path, uid_t *uid, gid_t *gid) { struct stat st; int ret; #ifdef HAVE_STATX struct statx stx; ret = statx (AT_FDCWD, path, AT_STATX_DONT_SYNC, STATX_UID | STATX_GID, &stx); if (UNLIKELY (ret < 0)) { if (errno == ENOSYS || errno == EINVAL) goto fallback; return ret; } *uid = stx.stx_uid; *gid = stx.stx_gid; return ret; fallback: #endif ret = stat (path, &st); if (UNLIKELY (ret < 0)) return ret; *uid = st.st_uid; *gid = st.st_gid; return ret; } static int copy_owner (const char *from, const char *to, libcrun_error_t *err) { uid_t uid = 0; gid_t gid = 0; int ret; ret = get_file_owner (from, &uid, &gid); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot get file owner for `%s`", from); if (uid == 0 && gid == 0) return 0; return chown_cgroups (to, uid, gid, err); } static int read_unified_cgroup_pid (pid_t pid, char **path, libcrun_error_t *err) { int ret; char cgroup_path[32]; char *from, *to; cleanup_free char *content = NULL; sprintf (cgroup_path, "/proc/%d/cgroup", pid); ret = read_all_file (cgroup_path, &content, NULL, err); if (UNLIKELY (ret < 0)) return ret; from = strstr (content, "0::"); if (UNLIKELY (from == NULL)) return crun_make_error (err, 0, "cannot find cgroup2 for the process `%d`", pid); from += 3; to = strchr (from, '\n'); if (UNLIKELY (to == NULL)) return crun_make_error (err, 0, "cannot parse `%s`", cgroup_path); *to = '\0'; *path = xstrdup (from); return 0; } static int enter_cgroup_v1 (pid_t pid, const char *path, bool create_if_missing, libcrun_error_t *err) { cleanup_free char *content = NULL; bool entered_any = false; size_t content_size; char *controller; char pid_str[16]; char *saveptr; bool has_data; int rootless; int ret; sprintf (pid_str, "%d", pid); rootless = is_rootless (err); if (UNLIKELY (rootless < 0)) return rootless; ret = read_all_file (PROC_SELF_CGROUP, &content, &content_size, err); if (UNLIKELY (ret < 0)) { if (crun_error_get_errno (err) == ENOENT) { crun_error_release (err); return 0; } return ret; } for (has_data = read_proc_cgroup (content, &saveptr, NULL, &controller, NULL); has_data; has_data = read_proc_cgroup (NULL, &saveptr, NULL, &controller, NULL)) { char subsystem_path[64]; char *subsystem; if (has_prefix (controller, "name=")) controller += 5; subsystem = controller[0] == '\0' ? "unified" : controller; if (strcmp (subsystem, "net_prio,net_cls") == 0) subsystem = "net_cls,net_prio"; if (strcmp (subsystem, "cpuacct,cpu") == 0) subsystem = "cpu,cpuacct"; snprintf (subsystem_path, sizeof (subsystem_path), CGROUP_ROOT "/%s", subsystem); ret = crun_path_exists (subsystem_path, err); if (UNLIKELY (ret < 0)) return ret; if (ret == 0) continue; entered_any = true; ret = enter_cgroup_subsystem (pid, subsystem, path, create_if_missing, err); if (UNLIKELY (ret < 0)) { int errcode = crun_error_get_errno (err); if (rootless && (errcode == EACCES || errcode == EPERM)) { crun_error_release (err); continue; } return ret; } } if (entered_any) return 0; return crun_make_error (err, 0, "could not join cgroup"); } static int enter_cgroup_v2 (pid_t pid, pid_t init_pid, const char *path, bool create_if_missing, libcrun_error_t *err) { cleanup_free char *cgroup_path_procs = NULL; cleanup_free char *cgroup_path = NULL; char pid_str[16]; int repeat; int ret; sprintf (pid_str, "%d", pid); ret = append_paths (&cgroup_path, err, CGROUP_ROOT, path, NULL); if (UNLIKELY (ret < 0)) return ret; if (create_if_missing) { ret = crun_ensure_directory (cgroup_path, 0755, false, err); if (UNLIKELY (ret < 0)) return ret; } ret = append_paths (&cgroup_path_procs, err, cgroup_path, "cgroup.procs", NULL); if (UNLIKELY (ret < 0)) return ret; ret = write_file (cgroup_path_procs, pid_str, strlen (pid_str), err); if (LIKELY (ret >= 0)) return ret; if (UNLIKELY (crun_error_get_errno (err) == EOPNOTSUPP)) { crun_error_release (err); ret = maybe_make_cgroup_threaded (path, err); if (UNLIKELY (ret < 0)) return ret; ret = write_file (cgroup_path_procs, pid_str, strlen (pid_str), err); if (LIKELY (ret >= 0)) return ret; } if (create_if_missing || crun_error_get_errno (err) != EBUSY) return ret; crun_error_release (err); /* There are subdirectories so it is not possible to join the initial cgroup. Create a subdirectory and use that. It can still fail if the container creates a subdirectory under /sys/fs/cgroup/../crun-exec/ */ for (repeat = 0;; repeat++) { cleanup_free char *cgroup_crun_exec_path = NULL; cleanup_free char *cgroup_sub_path_procs = NULL; /* There is an init pid, try to join its cgroup. */ if (init_pid > 0) { ret = read_unified_cgroup_pid (init_pid, &cgroup_crun_exec_path, err); if (UNLIKELY (ret < 0)) return ret; /* Make sure the cgroup is below the initial cgroup specified for the container. */ if (strncmp (path, cgroup_crun_exec_path, strlen (path))) { free (cgroup_crun_exec_path); cgroup_crun_exec_path = NULL; } } /* There is no init_pid to lookup, try a static path. */ if (cgroup_crun_exec_path == NULL) xasprintf (&cgroup_crun_exec_path, "%s/crun-exec", path); ret = append_paths (&cgroup_sub_path_procs, err, CGROUP_ROOT, cgroup_crun_exec_path, "cgroup.procs", NULL); if (UNLIKELY (ret < 0)) return ret; ret = write_file (cgroup_sub_path_procs, pid_str, strlen (pid_str), err); if (UNLIKELY (ret < 0)) { /* The init process might have moved to a different cgroup, try again. */ if (crun_error_get_errno (err) == EBUSY && init_pid && repeat < 20) { crun_error_release (err); continue; } return ret; } return copy_owner (cgroup_path_procs, cgroup_crun_exec_path, err); } return ret; } int enter_cgroup (int cgroup_mode, pid_t pid, pid_t init_pid, const char *path, bool create_if_missing, libcrun_error_t *err) { int ret; if (cgroup_mode == CGROUP_MODE_UNIFIED) { ret = enter_cgroup_v2 (pid, init_pid, path, create_if_missing, err); if (UNLIKELY (ret < 0)) return ret; } else { ret = enter_cgroup_v1 (pid, path, create_if_missing, err); if (UNLIKELY (ret < 0)) return ret; } /* Reset the inherited cpu affinity. Old kernels do that automatically, but new kernels remember the affinity that was set before the cgroup move. This is undesirable, because it inherits the systemd affinity when the container should really move to the container space cpus. The sched_setaffinity call will always return an error (EINVAL or ENODEV) when used like this. This is expected and part of the backward compatibility. See: https://issues.redhat.com/browse/OCPBUGS-15102 */ ret = sched_setaffinity (pid, 0, NULL); if (LIKELY (ret < 0)) { if (UNLIKELY (! ((errno == EINVAL) || (errno == ENODEV)))) return crun_make_error (err, errno, "failed to reset affinity"); } return 0; } crun-1.16.1/src/libcrun/cgroup-systemd.c0000644000000000000000000012066614656670105016340 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "cgroup.h" #include "cgroup-internal.h" #include "cgroup-systemd.h" #include "cgroup-utils.h" #include "ebpf.h" #include "utils.h" #include "status.h" #include #include #include #include #include #include #include #ifdef HAVE_SYSTEMD # include # define SYSTEMD_PROPERTY_PREFIX "org.systemd.property." int cpuset_string_to_bitmask (const char *str, char **out, size_t *out_size, libcrun_error_t *err) { cleanup_free char *mask = NULL; size_t mask_size = 0; const char *p = str; char *endptr; while (*p) { long long start_range, end_range; if (*p < '0' || *p > '9') goto invalid_input; start_range = strtoll (p, &endptr, 10); if (start_range < 0) goto invalid_input; p = endptr; if (*p != '-') end_range = start_range; else { p++; if (*p < '0' || *p > '9') goto invalid_input; end_range = strtoll (p, &endptr, 10); if (end_range < start_range) goto invalid_input; p = endptr; } /* Just set some limit. */ if (end_range > (1 << 20)) goto invalid_input; if (end_range >= (long long) (mask_size * CHAR_BIT)) { size_t new_mask_size = (end_range / CHAR_BIT) + 1; mask = xrealloc (mask, new_mask_size); memset (mask + mask_size, 0, new_mask_size - mask_size); mask_size = new_mask_size; } for (long long i = start_range; i <= end_range; i++) mask[i / CHAR_BIT] |= (1 << (i % CHAR_BIT)); if (*p == ',') p++; else if (*p) goto invalid_input; } *out = mask; mask = NULL; *out_size = mask_size; return 0; invalid_input: return crun_make_error (err, 0, "cannot parse input `%s`", str); } static void get_systemd_scope_and_slice (const char *id, const char *cgroup_path, char **scope, char **slice) { char *n; if (cgroup_path == NULL || cgroup_path[0] == '\0') { xasprintf (scope, "crun-%s.scope", id); return; } n = strchr (cgroup_path, ':'); if (n == NULL) xasprintf (scope, "%s.scope", cgroup_path); else { xasprintf (scope, "%s.scope", n + 1); n = strchr (*scope, ':'); if (n) *n = '-'; } if (slice) { *slice = xstrdup (cgroup_path); n = strchr (*slice, ':'); if (n) *n = '\0'; } } /* set the rt-runtime for the current cgroup and its parent if the path is not a scope. */ static int setup_rt_runtime (runtime_spec_schema_config_linux_resources *resources, const char *path, libcrun_error_t *err) { cleanup_free char *cgroup_path = NULL; cleanup_close int dirfd = -1; bool need_set_parent = true; char fmt_buf[64]; size_t len; int ret; if (resources == NULL || resources->cpu == NULL) return 0; if (has_suffix (path, ".scope")) need_set_parent = false; ret = append_paths (&cgroup_path, err, CGROUP_ROOT, "cpu", path, NULL); if (UNLIKELY (ret < 0)) return ret; ret = crun_ensure_directory (cgroup_path, 0755, true, err); if (UNLIKELY (ret < 0)) return ret; dirfd = open (cgroup_path, O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (dirfd < 0)) return crun_make_error (err, errno, "open `%s`", cgroup_path); if (resources->cpu->realtime_period) { len = sprintf (fmt_buf, "%" PRIu64, resources->cpu->realtime_period); if (need_set_parent) { ret = write_file_at_with_flags (dirfd, O_WRONLY | O_CLOEXEC, 0, "../cpu.rt_period_us", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } ret = write_file_at_with_flags (dirfd, O_WRONLY | O_CLOEXEC, 0, "cpu.rt_period_us", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->cpu->realtime_runtime) { len = sprintf (fmt_buf, "%" PRIu64, resources->cpu->realtime_runtime); if (need_set_parent) { ret = write_file_at_with_flags (dirfd, O_WRONLY | O_CLOEXEC, 0, "../cpu.rt_runtime_us", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } ret = write_file_at_with_flags (dirfd, O_WRONLY | O_CLOEXEC, 0, "cpu.rt_runtime_us", fmt_buf, len, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int setup_missing_cpu_options_for_systemd (runtime_spec_schema_config_linux_resources *resources, bool cgroup2, const char *path, libcrun_error_t *err) { cleanup_free char *cgroup_path = NULL; int parent; int ret; if (resources == NULL || resources->cpu == NULL) return 0; if (! resources->cpu->burst_present) return 0; for (parent = 0; parent < 2; parent++) { cleanup_close int dirfd = -1; if (cgroup2) ret = append_paths (&cgroup_path, err, CGROUP_ROOT, path ? path : "", (parent ? ".." : NULL), NULL); else ret = append_paths (&cgroup_path, err, CGROUP_ROOT, "/cpu", path ? path : "", (parent ? ".." : NULL), NULL); if (UNLIKELY (ret < 0)) return ret; dirfd = open (cgroup_path, O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (dirfd < 0)) return crun_make_error (err, errno, "open `%s`", cgroup_path); ret = write_cpu_burst (dirfd, cgroup2, resources->cpu, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int setup_cpuset_for_systemd_v1 (runtime_spec_schema_config_linux_resources *resources, const char *path, libcrun_error_t *err) { cleanup_free char *cgroup_path = NULL; int parent; int ret; ret = append_paths (&cgroup_path, err, CGROUP_ROOT, "/cpuset", path ? path : "", NULL); if (UNLIKELY (ret < 0)) return ret; ret = crun_ensure_directory (cgroup_path, 0755, true, err); if (UNLIKELY (ret < 0)) return ret; ret = initialize_cpuset_subsystem_resources (cgroup_path, resources, err); if (UNLIKELY (ret < 0)) return ret; for (parent = 0; parent < 2; parent++) { cleanup_close int dirfd_cpuset = -1; cleanup_free char *path_to_cpuset = NULL; ret = append_paths (&path_to_cpuset, err, CGROUP_ROOT "/cpuset", path, (parent ? ".." : NULL), NULL); if (UNLIKELY (ret < 0)) return ret; dirfd_cpuset = open (path_to_cpuset, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd_cpuset < 0)) return crun_make_error (err, errno, "open `%s`", path_to_cpuset); ret = write_cpuset_resources (dirfd_cpuset, false, resources->cpu, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int systemd_finalize (struct libcrun_cgroup_args *args, char **path_out, int cgroup_mode, const char *suffix, libcrun_error_t *err) { runtime_spec_schema_config_linux_resources *resources = args->resources; cleanup_free char *cgroup_path = NULL; cleanup_free char *content = NULL; cleanup_free char *path = NULL; pid_t pid = args->pid; int ret; char *from, *to; char *saveptr = NULL; xasprintf (&cgroup_path, "/proc/%d/cgroup", pid); ret = read_all_file (cgroup_path, &content, NULL, err); if (UNLIKELY (ret < 0)) return ret; switch (cgroup_mode) { case CGROUP_MODE_HYBRID: case CGROUP_MODE_LEGACY: from = strstr (content, ":memory:"); if (LIKELY (from != NULL)) from += 8; else { from = strstr (content, ":pids:"); if (UNLIKELY (from == NULL)) return crun_make_error (err, 0, "cannot find memory or pids controller for the current process"); from += 6; } to = strchr (from, '\n'); if (UNLIKELY (to == NULL)) return crun_make_error (err, 0, "cannot parse `%s`", PROC_SELF_CGROUP); *to = '\0'; if (suffix == NULL) path = xstrdup (from); else { ret = append_paths (&path, err, from, suffix, NULL); if (UNLIKELY (ret < 0)) return ret; } *to = '\n'; if (geteuid ()) return 0; ret = setup_rt_runtime (resources, path, err); if (UNLIKELY (ret < 0)) return ret; ret = setup_cpuset_for_systemd_v1 (resources, path, err); if (UNLIKELY (ret < 0)) return ret; for (from = strtok_r (content, "\n", &saveptr); from; from = strtok_r (NULL, "\n", &saveptr)) { char *subpath, *subsystem; subsystem = strchr (from, ':') + 1; subpath = strchr (subsystem, ':') + 1; *(subpath - 1) = '\0'; if (subsystem[0] == '\0') { if (cgroup_mode == CGROUP_MODE_LEGACY) continue; subsystem = "unified"; } if (strcmp (subpath, path)) { ret = enter_cgroup_subsystem (pid, subsystem, path, true, err); if (UNLIKELY (ret < 0)) { /* If it is a named hierarchy, skip the error. */ if (strchr (subsystem, '=')) { crun_error_release (err); continue; } return ret; } } } break; case CGROUP_MODE_UNIFIED: { cleanup_free char *dir = NULL; from = strstr (content, "0::"); if (UNLIKELY (from == NULL)) return crun_make_error (err, 0, "cannot find cgroup2 for the current process"); from += 3; to = strchr (from, '\n'); if (UNLIKELY (to == NULL)) return crun_make_error (err, 0, "cannot parse `%s`", PROC_SELF_CGROUP); *to = '\0'; if (suffix == NULL) path = xstrdup (from); else { ret = append_paths (&path, err, from, suffix, NULL); if (UNLIKELY (ret < 0)) return ret; } *to = '\n'; ret = append_paths (&dir, err, CGROUP_ROOT, path, NULL); if (UNLIKELY (ret < 0)) return ret; /* On cgroup v2, processes can be only in leaf nodes. If a suffix is used, move the process immediately to the new location before enabling the controllers. */ ret = crun_ensure_directory (dir, 0755, true, err); if (UNLIKELY (ret < 0)) return ret; ret = move_process_to_cgroup (pid, NULL, path, err); if (UNLIKELY (ret < 0)) return ret; ret = enable_controllers (path, err); if (UNLIKELY (ret < 0)) return ret; if (suffix) { ret = chown_cgroups (path, args->root_uid, args->root_gid, err); if (UNLIKELY (ret < 0)) return ret; } } break; default: return crun_make_error (err, 0, "invalid cgroup mode `%d`", cgroup_mode); } ret = setup_missing_cpu_options_for_systemd (resources, cgroup_mode == CGROUP_MODE_UNIFIED, path, err); if (UNLIKELY (ret < 0)) return ret; *path_out = path; path = NULL; return 0; } struct systemd_job_removed_s { const char *path; const char *op; int terminated; libcrun_error_t err; }; static int systemd_job_removed (sd_bus_message *m, void *userdata, sd_bus_error *error arg_unused) { const char *path, *unit, *result; uint32_t id; int ret; struct systemd_job_removed_s *d = userdata; ret = sd_bus_message_read (m, "uoss", &id, &path, &unit, &result); if (ret < 0) return -1; if (strcmp (d->path, path) == 0) { d->terminated = 1; if (strcmp (result, "done") != 0) { crun_make_error (&d->err, 0, "error `%s` systemd unit `%s`: got `%s`", d->op, unit, result); return -1; } } return 0; } static int systemd_check_job_status_setup (sd_bus *bus, struct systemd_job_removed_s *data, libcrun_error_t *err) { int ret; ret = sd_bus_match_signal_async (bus, NULL, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "JobRemoved", systemd_job_removed, NULL, data); if (UNLIKELY (ret < 0)) return crun_make_error (err, -ret, "sd-bus match signal"); return 0; } static int systemd_check_job_status (sd_bus *bus, struct systemd_job_removed_s *data, const char *path, const char *op, libcrun_error_t *err) { int sd_err; data->path = path; data->op = op; while (! data->terminated) { sd_err = sd_bus_process (bus, NULL); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus process"); if (sd_err != 0) continue; sd_err = sd_bus_wait (bus, (uint64_t) -1); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus wait"); } if (data->err != NULL) { *err = data->err; return -1; } return 0; } int parse_sd_array (char *s, char **out, char **next, libcrun_error_t *err) { char endchr; char *it, *dest; bool escaped = false; *out = NULL; *next = NULL; while (isspace (*s)) s++; if (*s == '\0') return 0; else if (*s != '\'' && *s != '"') return crun_make_error (err, 0, "invalid string `%s`", s); it = s; endchr = *it++; *out = dest = it; while (1) { if (*it == '\0') return crun_make_error (err, 0, "invalid string `%s`", s); if (*it == endchr && ! escaped) { *it++ = '\0'; while (isspace (*it)) it++; if (*it == ',') { *next = ++it; *dest = '\0'; return 0; } if (*it == ']' || *it == '\0') { *dest = '\0'; return 0; } return crun_make_error (err, 0, "invalid character found `%c`", *it); } escaped = *it == '\\' ? ! escaped : false; if (! escaped) *dest++ = *it; it++; } return 0; } /* Parse a gvariant string. Support only a subset of types, just enough for systemd . */ static int append_systemd_annotation (sd_bus_message *m, const char *name, size_t name_len, const char *value, libcrun_error_t *err) { cleanup_free char *tmp_name = NULL; uint32_t factor = 1; const char *it; int sd_err; while (*value == ' ') value++; it = value; /* If the name has the form NameSec, convert it to NameUSec. */ if (name_len > 4 && name[name_len - 4] != 'U' && name[name_len - 3] == 'S' && name[name_len - 2] == 'e' && name[name_len - 1] == 'c') { factor = 1000000; tmp_name = xmalloc (name_len + 2); memcpy (tmp_name, name, name_len - 3); memcpy (tmp_name + name_len - 3, "USec", 5); name = tmp_name; } if ((strcmp (it, "true") == 0) || (strcmp (it, "false") == 0)) { bool b = *it == 't'; sd_err = sd_bus_message_append (m, "(sv)", name, "b", b); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append `%s`", name); return 0; } else if (*it == '\'') { cleanup_free char *v_start = NULL; char *end; it = v_start = xstrdup (value); end = strchr (it + 1, '\''); if (end == NULL) return crun_make_error (err, 0, "invalid variant `%s`", value); *end = '\0'; sd_err = sd_bus_message_append (m, "(sv)", name, "s", it + 1); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append `%s`", name); return 0; } else if (*it == '[') { cleanup_free char *v_start = NULL; size_t n_parts = 0, parts_size = 32; cleanup_free char **parts = xmalloc (sizeof (char *) * parts_size); char *part; part = v_start = xstrdup (it + 1); while (1) { char *out = NULL, *next = NULL; int ret; ret = parse_sd_array (part, &out, &next, err); if (UNLIKELY (ret < 0)) return ret; parts[n_parts++] = out; if (n_parts == parts_size - 1) { parts_size += 32; parts = xrealloc (parts, parts_size); } parts[n_parts] = NULL; if (next == NULL) break; part = next; } sd_err = sd_bus_message_open_container (m, 'r', "sv"); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus open container"); sd_err = sd_bus_message_append (m, "s", name); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append `%s`", name); sd_err = sd_bus_message_open_container (m, 'v', "as"); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus open container"); sd_err = sd_bus_message_append_strv (m, parts); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append `%s`", name); sd_err = sd_bus_message_close_container (m); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus close container"); sd_err = sd_bus_message_close_container (m); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus close container"); return 0; } else if (has_prefix (it, "uint64 ")) { char *endptr = NULL; uint64_t v; errno = 0; v = strtoull (it + sizeof ("uint64"), &endptr, 10); if (UNLIKELY (errno != 0 || *endptr)) return crun_make_error (err, errno, "invalid value for `%s`", name); sd_err = sd_bus_message_append (m, "(sv)", name, "t", (uint64_t) (v * factor)); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append `%s`", name); return 0; } else if (has_prefix (it, "int64 ")) { char *endptr = NULL; int64_t v; errno = 0; v = strtoll (it + sizeof ("int64"), &endptr, 10); if (UNLIKELY (errno != 0 || *endptr)) return crun_make_error (err, errno, "invalid value for `%s`", name); sd_err = sd_bus_message_append (m, "(sv)", name, "x", (int64_t) (v * factor)); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append `%s`", name); return 0; } else if (has_prefix (it, "uint32 ")) { char *endptr = NULL; uint32_t v; errno = 0; v = strtoul (it + sizeof ("uint32"), &endptr, 10); if (UNLIKELY (errno != 0 || *endptr)) return crun_make_error (err, errno, "invalid value for `%s`", name); sd_err = sd_bus_message_append (m, "(sv)", name, "u", (uint32_t) (v * factor)); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append `%s`", name); return 0; } else if (has_prefix (it, "int32 ") || strchr (it, ' ') == NULL) { char *endptr = NULL; int32_t v; /* If no type is specified, try to parse it as int32. */ errno = 0; if (has_prefix (it, "int32 ")) v = strtol (it + sizeof ("int32"), &endptr, 10); else v = strtol (it, &endptr, 10); if (UNLIKELY (errno != 0 || *endptr)) return crun_make_error (err, errno, "invalid value for `%s`", name); sd_err = sd_bus_message_append (m, "(sv)", name, "i", (int32_t) (v * factor)); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append `%s`", name); return 0; } return crun_make_error (err, errno, "unknown type for `%s`", name); } static int open_sd_bus_connection (sd_bus **bus, libcrun_error_t *err) { int rootless; int sd_err = 0; rootless = is_rootless (err); if (UNLIKELY (rootless < 0)) return rootless; if (rootless) sd_err = sd_bus_default_user (bus); if (! rootless || sd_err < 0) sd_err = sd_bus_default_system (bus); if (sd_err < 0) return crun_make_error (err, -sd_err, "cannot open sd-bus"); return 0; } static int get_value_from_unified_map (runtime_spec_schema_config_linux_resources *resources, const char *name, uint64_t *value, libcrun_error_t *err) { size_t i; if (resources == NULL || resources->unified == NULL) return 0; for (i = 0; i < resources->unified->len; i++) if (strcmp (resources->unified->keys[i], name) == 0) { errno = 0; *value = (uint64_t) strtoll (resources->unified->values[i], NULL, 10); if (UNLIKELY (errno)) return crun_make_error (err, errno, "invalid value for `%s`: %s", name, resources->unified->values[i]); return 1; } return 0; } static inline int get_memory_limit (runtime_spec_schema_config_linux_resources *resources, uint64_t *limit, libcrun_error_t *err) { if (resources->memory && resources->memory->limit_present) { *limit = resources->memory->limit; return 1; } return get_value_from_unified_map (resources, "memory.max", limit, err); } static inline int get_weight (runtime_spec_schema_config_linux_resources *resources, uint64_t *weight, libcrun_error_t *err) { if (resources->cpu && resources->cpu->shares_present) { /* Docker uses shares == 0 to specify no limit. */ if (resources->cpu->shares == 0) return 0; *weight = convert_shares_to_weight (resources->cpu->shares); return 1; } return get_value_from_unified_map (resources, "cpu.weight", weight, err); } /* Adapted from systemd. */ static int bus_append_byte_array (sd_bus_message *m, const char *field, const void *buf, size_t n, libcrun_error_t *err) { int ret; ret = sd_bus_message_open_container (m, SD_BUS_TYPE_STRUCT, "sv"); if (ret < 0) return crun_make_error (err, -ret, "sd-bus open container"); ret = sd_bus_message_append_basic (m, SD_BUS_TYPE_STRING, field); if (ret < 0) return crun_make_error (err, -ret, "sd_bus_message_append_basic"); ret = sd_bus_message_open_container (m, 'v', "ay"); if (ret < 0) return crun_make_error (err, -ret, "sd_bus_message_open_container"); ret = sd_bus_message_append_array (m, 'y', buf, n); if (ret < 0) return crun_make_error (err, -ret, "sd_bus_message_append_array"); ret = sd_bus_message_close_container (m); if (ret < 0) return crun_make_error (err, -ret, "sd_bus_message_close_container"); ret = sd_bus_message_close_container (m); if (ret < 0) return crun_make_error (err, -ret, "sd_bus_message_close_container"); return 1; } static int append_resources (sd_bus_message *m, runtime_spec_schema_config_linux_resources *resources, int cgroup_mode, libcrun_error_t *err) { uint64_t memory_limit; int sd_err; int ret; if (resources == NULL) return 0; ret = get_memory_limit (resources, &memory_limit, err); if (UNLIKELY (ret < 0)) return ret; if (ret) { sd_err = sd_bus_message_append (m, "(sv)", "MemoryMax", "t", memory_limit); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append MemoryMax"); } if (resources->cpu) { /* do not bother with systemd internal representation unless both values are specified */ if (resources->cpu->quota && resources->cpu->period) { uint64_t quota = resources->cpu->quota; /* this conversion was copied from runc. */ quota = (quota * 1000000) / resources->cpu->period; if (quota % 10000) quota = ((quota / 10000) + 1) * 10000; sd_err = sd_bus_message_append (m, "(sv)", "CPUQuotaPerSecUSec", "t", quota); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append CPUQuotaPerSecUSec"); sd_err = sd_bus_message_append (m, "(sv)", "CPUQuotaPeriodUSec", "t", resources->cpu->period); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append CPUQuotaPeriodUSec"); } } switch (cgroup_mode) { case CGROUP_MODE_UNIFIED: { uint64_t weight; ret = get_weight (resources, &weight, err); if (UNLIKELY (ret < 0)) return ret; if (ret) { sd_err = sd_bus_message_append (m, "(sv)", "CPUWeight", "t", weight); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append CPUWeight"); } if (resources->cpu && resources->cpu->cpus) { size_t allowed_cpus_len = 0; cleanup_free char *allowed_cpus = NULL; ret = cpuset_string_to_bitmask (resources->cpu->cpus, &allowed_cpus, &allowed_cpus_len, err); if (UNLIKELY (ret < 0)) return ret; ret = bus_append_byte_array (m, "AllowedCPUs", allowed_cpus, allowed_cpus_len, err); if (UNLIKELY (ret < 0)) return ret; } if (resources->cpu && resources->cpu->mems) { size_t allowed_mems_len = 0; cleanup_free char *allowed_mems = NULL; ret = cpuset_string_to_bitmask (resources->cpu->mems, &allowed_mems, &allowed_mems_len, err); if (UNLIKELY (ret < 0)) return ret; ret = bus_append_byte_array (m, "AllowedMemoryNodes", allowed_mems, allowed_mems_len, err); if (UNLIKELY (ret < 0)) return ret; } } break; case CGROUP_MODE_LEGACY: case CGROUP_MODE_HYBRID: if (resources->cpu && resources->cpu->shares > 0) { sd_err = sd_bus_message_append (m, "(sv)", "CPUShares", "t", resources->cpu->shares); if (UNLIKELY (sd_err < 0)) return crun_make_error (err, -sd_err, "sd-bus message append CPUShares"); } break; default: return crun_make_error (err, 0, "invalid cgroup mode `%d`", cgroup_mode); } return 0; } static int reset_failed_unit (sd_bus *bus, const char *unit) { int sd_err; sd_bus_error error = SD_BUS_ERROR_NULL; sd_bus_message *m = NULL, *reply = NULL; sd_err = sd_bus_message_new_method_call (bus, &m, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "ResetFailedUnit"); if (UNLIKELY (sd_err < 0)) goto exit; sd_err = sd_bus_message_append (m, "s", unit); if (UNLIKELY (sd_err < 0)) goto exit; sd_err = sd_bus_call (bus, m, 0, &error, &reply); if (UNLIKELY (sd_err < 0)) goto exit; sd_err = 0; exit: if (m) sd_bus_message_unref (m); if (reply) sd_bus_message_unref (reply); sd_bus_error_free (&error); return sd_err; } static int enter_systemd_cgroup_scope (runtime_spec_schema_config_linux_resources *resources, int cgroup_mode, json_map_string_string *annotations, const char *scope, const char *slice, pid_t pid, libcrun_error_t *err) { sd_bus *bus = NULL; sd_bus_message *m = NULL; sd_bus_message *reply = NULL; int sd_err, ret = 0; sd_bus_error error = SD_BUS_ERROR_NULL; const char *object = NULL; struct systemd_job_removed_s job_data = {}; int i; const char *boolean_opts[10]; i = 0; boolean_opts[i++] = "Delegate"; if (resources) { if (resources->cpu) boolean_opts[i++] = "CPUAccounting"; if (resources->memory) boolean_opts[i++] = "MemoryAccounting"; if (resources->block_io) boolean_opts[i++] = "IOAccounting"; if (resources->pids) boolean_opts[i++] = "TasksAccounting"; } boolean_opts[i++] = NULL; ret = open_sd_bus_connection (&bus, err); if (UNLIKELY (ret < 0)) goto exit; ret = systemd_check_job_status_setup (bus, &job_data, err); if (UNLIKELY (ret < 0)) goto exit; sd_err = sd_bus_message_new_method_call (bus, &m, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartTransientUnit"); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "set up dbus message"); goto exit; } sd_err = sd_bus_message_append (m, "ss", scope, "fail"); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus message append scope"); goto exit; } sd_err = sd_bus_message_open_container (m, 'a', "(sv)"); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus open container"); goto exit; } if (slice) { sd_err = sd_bus_message_append (m, "(sv)", "Slice", "s", slice); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus message append Slice"); goto exit; } } if (annotations) { size_t prefix_len = sizeof (SYSTEMD_PROPERTY_PREFIX) - 1; size_t i; for (i = 0; i < annotations->len; i++) { size_t len; if (! has_prefix (annotations->keys[i], SYSTEMD_PROPERTY_PREFIX)) continue; len = strlen (annotations->keys[i]); if (len < prefix_len + 3) { ret = crun_make_error (err, EINVAL, "invalid systemd property name `%s`", annotations->keys[i]); goto exit; } ret = append_systemd_annotation (m, annotations->keys[i] + prefix_len, len - prefix_len, annotations->values[i], err); if (UNLIKELY (ret < 0)) goto exit; } } sd_err = sd_bus_message_append (m, "(sv)", "Description", "s", "libcrun container"); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus message append Description"); goto exit; } sd_err = sd_bus_message_append (m, "(sv)", "PIDs", "au", 1, pid); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus message append PIDs"); goto exit; } sd_err = sd_bus_message_append (m, "(sv)", "DefaultDependencies", "b", 0); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus message append DefaultDependencies"); goto exit; } for (i = 0; boolean_opts[i]; i++) { sd_err = sd_bus_message_append (m, "(sv)", boolean_opts[i], "b", 1); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus message append `%s`", boolean_opts[i]); goto exit; } } ret = append_resources (m, resources, cgroup_mode, err); if (UNLIKELY (ret < 0)) goto exit; sd_err = sd_bus_message_close_container (m); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus close container"); goto exit; } sd_err = sd_bus_message_append (m, "a(sa(sv))", 0); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus message append"); goto exit; } sd_err = sd_bus_call (bus, m, 0, &error, &reply); if (UNLIKELY (sd_err < 0)) { if (reset_failed_unit (bus, scope) == 0) { sd_bus_error_free (&error); if (reply) sd_bus_message_unref (reply); error = SD_BUS_ERROR_NULL; reply = NULL; sd_err = sd_bus_call (bus, m, 0, &error, &reply); } if (sd_err < 0) { ret = crun_make_error (err, sd_bus_error_get_errno (&error), "sd-bus call: %s", error.message ?: error.name); goto exit; } } sd_err = sd_bus_message_read (reply, "o", &object); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus message read"); goto exit; } ret = systemd_check_job_status (bus, &job_data, object, "creating", err); exit: if (bus) sd_bus_unref (bus); if (m) sd_bus_message_unref (m); if (reply) sd_bus_message_unref (reply); sd_bus_error_free (&error); return ret; } static int libcrun_destroy_systemd_cgroup_scope (struct libcrun_cgroup_status *cgroup_status, libcrun_error_t *err) { sd_bus *bus = NULL; sd_bus_message *m = NULL; sd_bus_message *reply = NULL; int ret = 0; sd_bus_error error = SD_BUS_ERROR_NULL; const char *object; const char *scope = cgroup_status->scope; struct systemd_job_removed_s job_data = {}; ret = open_sd_bus_connection (&bus, err); if (UNLIKELY (ret < 0)) goto exit; ret = systemd_check_job_status_setup (bus, &job_data, err); if (UNLIKELY (ret < 0)) goto exit; ret = sd_bus_message_new_method_call (bus, &m, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StopUnit"); if (UNLIKELY (ret < 0)) { ret = crun_make_error (err, -ret, "set up dbus message"); goto exit; } ret = sd_bus_message_append (m, "ss", scope, "replace"); if (UNLIKELY (ret < 0)) { ret = crun_make_error (err, -ret, "sd-bus message append"); goto exit; } ret = sd_bus_call (bus, m, 0, &error, &reply); if (UNLIKELY (ret < 0)) { ret = crun_make_error (err, sd_bus_error_get_errno (&error), "sd-bus call: %s", error.message ?: error.name); goto exit; } ret = sd_bus_message_read (reply, "o", &object); if (UNLIKELY (ret < 0)) { ret = crun_make_error (err, -ret, "sd-bus message read"); goto exit; } ret = systemd_check_job_status (bus, &job_data, object, "removing", err); /* In case of a failed unit, call reset-failed so systemd can remove it. */ reset_failed_unit (bus, scope); exit: if (bus) sd_bus_unref (bus); if (m) sd_bus_message_unref (m); if (reply) sd_bus_message_unref (reply); sd_bus_error_free (&error); return ret; } static const char * find_systemd_subgroup (json_map_string_string *annotations) { const char *annotation; annotation = find_annotation_map (annotations, "run.oci.systemd.subgroup"); if (annotation) { if (annotation[0] == '\0') return NULL; return annotation; } return "container"; } static int libcrun_cgroup_enter_systemd (struct libcrun_cgroup_args *args, struct libcrun_cgroup_status *out, libcrun_error_t *err) { runtime_spec_schema_config_linux_resources *resources = args->resources; const char *cgroup_path = args->cgroup_path; cleanup_free char *scope = NULL; cleanup_free char *path = NULL; cleanup_free char *slice = NULL; const char *suffix; const char *id = args->id; pid_t pid = args->pid; int cgroup_mode; int ret; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; get_systemd_scope_and_slice (id, cgroup_path, &scope, &slice); ret = enter_systemd_cgroup_scope (resources, cgroup_mode, args->annotations, scope, slice, pid, err); if (UNLIKELY (ret < 0)) return ret; suffix = find_systemd_subgroup (args->annotations); ret = systemd_finalize (args, &path, cgroup_mode, suffix, err); if (UNLIKELY (ret < 0)) return ret; out->path = path; path = NULL; out->scope = scope; scope = NULL; return 0; } char * get_cgroup_scope_path (const char *cgroup_path, const char *scope) { char *path_to_scope = NULL; char *cur; path_to_scope = xstrdup (cgroup_path); cur = strchr (path_to_scope, '/'); while (cur) { char *next = strchr (cur + 1, '/'); if (next == NULL) break; *next = '\0'; if (strcmp (cur, scope) == 0) return path_to_scope; *next = '/'; cur = next; while (*cur == '/') cur++; } return path_to_scope; } static int libcrun_destroy_cgroup_systemd (struct libcrun_cgroup_status *cgroup_status, libcrun_error_t *err) { cleanup_free char *path_to_scope = NULL; int mode; int ret; mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (mode < 0)) return mode; ret = cgroup_killall_path (cgroup_status->path, SIGKILL, err); if (UNLIKELY (ret < 0)) crun_error_release (err); ret = libcrun_destroy_systemd_cgroup_scope (cgroup_status, err); if (UNLIKELY (ret < 0)) crun_error_release (err); path_to_scope = get_cgroup_scope_path (cgroup_status->path, cgroup_status->scope); return destroy_cgroup_path (path_to_scope, mode, err); } static int libcrun_update_resources_systemd (struct libcrun_cgroup_status *cgroup_status, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err) { struct systemd_job_removed_s job_data = {}; sd_bus_error error = SD_BUS_ERROR_NULL; sd_bus_message *reply = NULL; sd_bus_message *m = NULL; sd_bus *bus = NULL; int sd_err, ret; int cgroup_mode; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; ret = open_sd_bus_connection (&bus, err); if (UNLIKELY (ret < 0)) return ret; ret = systemd_check_job_status_setup (bus, &job_data, err); if (UNLIKELY (ret < 0)) goto exit; sd_err = sd_bus_message_new_method_call (bus, &m, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "SetUnitProperties"); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "set up dbus message"); goto exit; } sd_err = sd_bus_message_append (m, "sb", cgroup_status->scope, 1); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus message append"); goto exit; } sd_err = sd_bus_message_open_container (m, 'a', "(sv)"); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus open container"); goto exit; } ret = append_resources (m, resources, cgroup_mode, err); if (UNLIKELY (ret < 0)) goto exit; sd_err = sd_bus_message_close_container (m); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, -sd_err, "sd-bus close container"); goto exit; } sd_err = sd_bus_call (bus, m, 0, &error, &reply); if (UNLIKELY (sd_err < 0)) { ret = crun_make_error (err, sd_bus_error_get_errno (&error), "sd-bus call: %s", error.message ?: error.name); goto exit; } if (cgroup_mode != CGROUP_MODE_UNIFIED) { ret = setup_rt_runtime (resources, cgroup_status->path, err); if (UNLIKELY (ret < 0)) goto exit; ret = setup_cpuset_for_systemd_v1 (resources, cgroup_status->path, err); if (UNLIKELY (ret < 0)) goto exit; } ret = setup_missing_cpu_options_for_systemd (resources, cgroup_mode == CGROUP_MODE_UNIFIED, cgroup_status->path, err); if (UNLIKELY (ret < 0)) goto exit; ret = 0; exit: if (bus) sd_bus_unref (bus); if (m) sd_bus_message_unref (m); if (reply) sd_bus_message_unref (reply); sd_bus_error_free (&error); return ret; } #else static int libcrun_cgroup_enter_systemd (struct libcrun_cgroup_args *args, struct libcrun_cgroup_status *out, libcrun_error_t *err) { (void) args; (void) out; return crun_make_error (err, ENOTSUP, "systemd not supported"); } static int libcrun_destroy_cgroup_systemd (struct libcrun_cgroup_status *cgroup_status, libcrun_error_t *err) { (void) cgroup_status; return crun_make_error (err, ENOTSUP, "systemd not supported"); } static int libcrun_update_resources_systemd (struct libcrun_cgroup_status *cgroup_status, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err) { (void) cgroup_status; (void) resources; return crun_make_error (err, ENOTSUP, "systemd not supported"); } #endif struct libcrun_cgroup_manager cgroup_manager_systemd = { .precreate_cgroup = NULL, .create_cgroup = libcrun_cgroup_enter_systemd, .destroy_cgroup = libcrun_destroy_cgroup_systemd, .update_resources = libcrun_update_resources_systemd, }; crun-1.16.1/src/libcrun/cgroup-utils.c0000644000000000000000000006363614656670105016013 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "cgroup.h" #include "cgroup-internal.h" #include "cgroup-systemd.h" #include "cgroup-utils.h" #include "cgroup-setup.h" #include "ebpf.h" #include "utils.h" #include "status.h" #include #include #include #include #include #include #include #include #include #include struct symlink_s { const char *name; const char *target; }; static struct symlink_s cgroup_symlinks[] = { { "cpu", "cpu,cpuacct" }, { "cpuacct", "cpu,cpuacct" }, { "net_cls", "net_cls,net_prio" }, { "net_prio", "net_cls,net_prio" }, { NULL, NULL } }; int libcrun_cgroups_create_symlinks (int dirfd, libcrun_error_t *err) { int i; for (i = 0; cgroup_symlinks[i].name; i++) { int ret; ret = symlinkat (cgroup_symlinks[i].target, dirfd, cgroup_symlinks[i].name); if (UNLIKELY (ret < 0)) { if (errno == ENOENT || errno == EEXIST) continue; return crun_make_error (err, errno, "symlinkat `%s`", cgroup_symlinks[i].name); } } return 0; } int maybe_make_cgroup_threaded (const char *path, libcrun_error_t *err) { cleanup_free char *cgroup_path_type = NULL; const char *const threaded = "threaded"; cleanup_free char *content = NULL; cleanup_free char *buffer = NULL; const char *parent; size_t size; char *it; int ret; path = consume_slashes (path); if (path == NULL || path[0] == '\0') return 0; ret = append_paths (&cgroup_path_type, err, CGROUP_ROOT, path, "cgroup.type", NULL); if (UNLIKELY (ret < 0)) return ret; ret = read_all_file (cgroup_path_type, &content, &size, err); if (UNLIKELY (ret < 0)) return ret; if (size > 0) { it = content + size - 1; while (*it == '\n' && it > content) *it-- = '\0'; } if (strcmp (content, "domain") == 0 || strcmp (content, "domain threaded") == 0) return 0; buffer = xstrdup (path); parent = consume_slashes (dirname (buffer)); if (parent[0] && strcmp (parent, ".")) { ret = maybe_make_cgroup_threaded (parent, err); if (ret < 0) return ret; } return write_file (cgroup_path_type, threaded, strlen (threaded), err); } int move_process_to_cgroup (pid_t pid, const char *subsystem, const char *path, libcrun_error_t *err) { cleanup_free char *cgroup_path_procs = NULL; char pid_str[16]; int ret; ret = append_paths (&cgroup_path_procs, err, CGROUP_ROOT, subsystem ? subsystem : "", path ? path : "", "cgroup.procs", NULL); if (UNLIKELY (ret < 0)) return ret; sprintf (pid_str, "%d", pid); ret = write_file (cgroup_path_procs, pid_str, strlen (pid_str), err); if (UNLIKELY (ret < 0)) { if (crun_error_get_errno (err) == EOPNOTSUPP) { libcrun_error_t tmp_err = NULL; int mode; mode = libcrun_get_cgroup_mode (&tmp_err); if (UNLIKELY (mode < 0 || mode != CGROUP_MODE_UNIFIED)) { crun_error_release (&tmp_err); return ret; } crun_error_release (err); ret = maybe_make_cgroup_threaded (path, err); if (UNLIKELY (ret < 0)) return ret; return write_file (cgroup_path_procs, pid_str, strlen (pid_str), err); } return ret; } return ret; } int libcrun_get_current_unified_cgroup (char **path, bool absolute, libcrun_error_t *err) { cleanup_free char *content = NULL; size_t content_size; char *from, *to; int ret; ret = read_all_file (PROC_SELF_CGROUP, &content, &content_size, err); if (UNLIKELY (ret < 0)) return ret; from = strstr (content, "0::"); if (UNLIKELY (from == NULL)) return crun_make_error (err, 0, "cannot find cgroup2 for the current process"); from += 3; to = strchr (from, '\n'); if (UNLIKELY (to == NULL)) return crun_make_error (err, 0, "cannot parse `%s`", PROC_SELF_CGROUP); *to = '\0'; if (absolute) return append_paths (path, err, CGROUP_ROOT, from, NULL); *path = xstrdup (from); return 0; } #ifndef CGROUP2_SUPER_MAGIC # define CGROUP2_SUPER_MAGIC 0x63677270 #endif #ifndef TMPFS_MAGIC # define TMPFS_MAGIC 0x01021994 #endif static int detect_cgroup_mode (libcrun_error_t *err) { struct statfs stat; int ret; ret = statfs (CGROUP_ROOT, &stat); if (ret < 0) return crun_make_error (err, errno, "statfs `" CGROUP_ROOT "`"); if (stat.f_type == CGROUP2_SUPER_MAGIC) return CGROUP_MODE_UNIFIED; if (stat.f_type != TMPFS_MAGIC) return crun_make_error (err, 0, "invalid file system type on `" CGROUP_ROOT "`"); ret = statfs (CGROUP_ROOT "/unified", &stat); if (ret < 0 && errno != ENOENT) return crun_make_error (err, errno, "statfs `" CGROUP_ROOT "/unified`"); if (ret < 0) return CGROUP_MODE_LEGACY; return stat.f_type == CGROUP2_SUPER_MAGIC ? CGROUP_MODE_HYBRID : CGROUP_MODE_LEGACY; } int libcrun_get_cgroup_mode (libcrun_error_t *err) { int tmp; static int cgroup_mode = 0; if (cgroup_mode) return cgroup_mode; tmp = detect_cgroup_mode (err); if (UNLIKELY (tmp < 0)) return tmp; cgroup_mode = tmp; return cgroup_mode; } static int read_pids_cgroup (int dfd, bool recurse, pid_t **pids, size_t *n_pids, size_t *allocated, libcrun_error_t *err) { __attribute__ ((unused)) cleanup_close int clean_dfd = dfd; cleanup_close int tasksfd = -1; cleanup_free char *buffer = NULL; char *saveptr = NULL; size_t n_new_pids; size_t len; char *it; int ret; tasksfd = openat (dfd, "cgroup.procs", O_RDONLY | O_CLOEXEC); if (tasksfd < 0) return crun_make_error (err, errno, "open `cgroup.procs`"); ret = read_all_fd (tasksfd, "cgroup.procs", &buffer, &len, err); if (UNLIKELY (ret < 0)) return ret; if (len == 0) return 0; for (n_new_pids = 0, it = buffer; it; it = strchr (it + 1, '\n')) n_new_pids++; if (*allocated < *n_pids + n_new_pids + 1) { *allocated = *n_pids + n_new_pids + 1; *pids = xrealloc (*pids, sizeof (pid_t) * *allocated); } for (it = strtok_r (buffer, "\n", &saveptr); it; it = strtok_r (NULL, "\n", &saveptr)) { pid_t pid = strtoul (it, NULL, 10); if (pid > 0) (*pids)[(*n_pids)++] = pid; } (*pids)[*n_pids] = 0; if (recurse) { cleanup_dir DIR *dir = NULL; struct dirent *de; dir = fdopendir (dfd); if (UNLIKELY (dir == NULL)) return crun_make_error (err, errno, "open cgroup sub-directory"); /* Now dir owns the dfd descriptor. */ clean_dfd = -1; for (de = readdir (dir); de; de = readdir (dir)) { int nfd; if (strcmp (de->d_name, ".") == 0 || strcmp (de->d_name, "..") == 0) continue; if (de->d_type != DT_DIR) continue; nfd = openat (dirfd (dir), de->d_name, O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (nfd < 0)) return crun_make_error (err, errno, "open cgroup directory `%s`", de->d_name); ret = read_pids_cgroup (nfd, recurse, pids, n_pids, allocated, err); if (UNLIKELY (ret < 0)) return ret; } } return 0; } static int rmdir_all_fd (int dfd) { cleanup_dir DIR *dir = NULL; struct dirent *next; dir = fdopendir (dfd); if (dir == NULL) { TEMP_FAILURE_RETRY (close (dfd)); return -1; } dfd = dirfd (dir); for (next = readdir (dir); next; next = readdir (dir)) { const char *name = next->d_name; int ret; if (name[0] == '.' && name[1] == '\0') continue; if (name[0] == '.' && name[1] == '.' && name[2] == '\0') continue; if (next->d_type != DT_DIR) continue; ret = unlinkat (dfd, name, AT_REMOVEDIR); if (ret < 0 && errno == EBUSY) { cleanup_free pid_t *pids = NULL; libcrun_error_t tmp_err = NULL; size_t i, n_pids = 0, allocated = 0; cleanup_close int child_dfd = -1; int tmp; int child_dfd_clone; child_dfd = openat (dfd, name, O_DIRECTORY | O_CLOEXEC); if (child_dfd < 0) return child_dfd; /* read_pids_cgroup takes ownership for the fd, so dup it. */ child_dfd_clone = dup (child_dfd); if (LIKELY (child_dfd_clone >= 0)) { ret = read_pids_cgroup (child_dfd_clone, true, &pids, &n_pids, &allocated, &tmp_err); if (UNLIKELY (ret < 0)) { crun_error_release (&tmp_err); continue; } } for (i = 0; i < n_pids; i++) kill (pids[i], SIGKILL); tmp = child_dfd; child_dfd = -1; return rmdir_all_fd (tmp); } } return 0; } static int rmdir_all (const char *path) { int ret; int dfd = open (path, O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (dfd < 0)) return dfd; ret = rmdir_all_fd (dfd); if (UNLIKELY (ret < 0)) return ret; return rmdir (path); } int libcrun_cgroup_read_pids_from_path (const char *path, bool recurse, pid_t **pids, libcrun_error_t *err) { cleanup_free char *cgroup_path = NULL; size_t n_pids, allocated; int dirfd; int mode; int ret; if (path == NULL || *path == '\0') return 0; mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (mode < 0)) return mode; switch (mode) { case CGROUP_MODE_UNIFIED: ret = append_paths (&cgroup_path, err, CGROUP_ROOT, path, NULL); if (UNLIKELY (ret < 0)) return ret; break; case CGROUP_MODE_HYBRID: case CGROUP_MODE_LEGACY: ret = append_paths (&cgroup_path, err, CGROUP_ROOT "/memory", path, NULL); if (UNLIKELY (ret < 0)) return ret; break; default: return crun_make_error (err, 0, "invalid cgroup mode `%d`", mode); } dirfd = open (cgroup_path, O_DIRECTORY | O_CLOEXEC); if (dirfd < 0) return crun_make_error (err, errno, "open `%s`", cgroup_path); n_pids = 0; allocated = 0; return read_pids_cgroup (dirfd, recurse, pids, &n_pids, &allocated, err); } /* same semantic as strtok_r. */ bool read_proc_cgroup (char *content, char **saveptr, char **id, char **controller_list, char **path) { char *it; it = strtok_r (content, "\n", saveptr); if (it == NULL) return false; if (id) *id = it; it = strchr (it, ':'); if (it == NULL) return false; *it++ = '\0'; if (controller_list) *controller_list = it; it = strchr (it, ':'); if (it == NULL) return false; *it++ = '\0'; if (path) *path = it; return true; } int destroy_cgroup_path (const char *path, int mode, libcrun_error_t *err) { bool repeat = true; int retry_count = 0; const int max_attempts = 500; int ret; do { repeat = false; if (mode == CGROUP_MODE_UNIFIED) { cleanup_free char *cgroup_path = NULL; ret = append_paths (&cgroup_path, err, CGROUP_ROOT, path, NULL); if (UNLIKELY (ret < 0)) return ret; ret = rmdir (cgroup_path); if (ret < 0 && errno == EBUSY) { ret = rmdir_all (cgroup_path); if (ret < 0) { if (retry_count >= max_attempts) return crun_make_error (err, errno, "cannot delete path `%s`", cgroup_path); retry_count++; repeat = true; } } } else { cleanup_free char *content = NULL; size_t content_size; char *controller; char *saveptr; bool has_data; ret = read_all_file (PROC_SELF_CGROUP, &content, &content_size, err); if (UNLIKELY (ret < 0)) { if (crun_error_get_errno (err) == ENOENT) { crun_error_release (err); return 0; } return ret; } for (has_data = read_proc_cgroup (content, &saveptr, NULL, &controller, NULL); has_data; has_data = read_proc_cgroup (NULL, &saveptr, NULL, &controller, NULL)) { cleanup_free char *cgroup_path = NULL; char *subsystem; if (has_prefix (controller, "name=")) controller += 5; subsystem = controller[0] == '\0' ? "unified" : controller; if (mode == CGROUP_MODE_LEGACY && strcmp (subsystem, "unified") == 0) continue; ret = append_paths (&cgroup_path, err, CGROUP_ROOT, subsystem, path, NULL); if (UNLIKELY (ret < 0)) return ret; ret = rmdir (cgroup_path); if (ret < 0 && errno == EBUSY) { ret = rmdir_all (cgroup_path); if (ret < 0) { if (retry_count >= max_attempts) return crun_make_error (err, errno, "cannot destroy subsystem `%s` at path `%s`", subsystem, cgroup_path); retry_count++; repeat = true; } } } } if (repeat) { struct timespec req = { .tv_sec = 0, .tv_nsec = 10000000, }; nanosleep (&req, NULL); ret = cgroup_killall_path (path, SIGKILL, err); if (UNLIKELY (ret < 0)) crun_error_release (err); } } while (repeat); return 0; } int chown_cgroups (const char *path, uid_t uid, gid_t gid, libcrun_error_t *err) { cleanup_free char *cgroup_path = NULL; cleanup_free char *delegate = NULL; cleanup_close int dfd = -1; size_t delegate_size; char *saveptr = NULL; char *name; int ret; ret = append_paths (&cgroup_path, err, CGROUP_ROOT, path, NULL); if (UNLIKELY (ret < 0)) return ret; dfd = open (cgroup_path, O_CLOEXEC | O_PATH); if (UNLIKELY (dfd < 0)) return crun_make_error (err, errno, "open `%s`", cgroup_path); ret = read_all_file ("/sys/kernel/cgroup/delegate", &delegate, &delegate_size, err); if (UNLIKELY (ret < 0)) { if (crun_error_get_errno (err) == ENOENT) { crun_error_release (err); return 0; } return ret; } ret = fchownat (dfd, "", uid, gid, AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot chown `%s`", cgroup_path); for (name = strtok_r (delegate, "\n", &saveptr); name; name = strtok_r (NULL, "\n", &saveptr)) { ret = fchownat (dfd, name, uid, gid, AT_SYMLINK_NOFOLLOW); if (UNLIKELY (ret < 0)) { if (errno == ENOENT) continue; return crun_make_error (err, errno, "cannot chown `%s/%s`", cgroup_path, name); } } return 0; } static int libcrun_cgroup_pause_unpause_with_mode (const char *cgroup_path, int cgroup_mode, const bool pause, libcrun_error_t *err) { cleanup_free char *path = NULL; const char *state = ""; int ret; if (cgroup_path == NULL || cgroup_path[0] == '\0') return crun_make_error (err, 0, "cannot %s the container without a cgroup", pause ? "pause" : "resume"); if (cgroup_mode == CGROUP_MODE_UNIFIED) { state = pause ? "1" : "0"; ret = append_paths (&path, err, CGROUP_ROOT, cgroup_path, "cgroup.freeze", NULL); if (UNLIKELY (ret < 0)) return ret; } else { state = pause ? "FROZEN" : "THAWED"; ret = append_paths (&path, err, CGROUP_ROOT "/freezer", cgroup_path, "freezer.state", NULL); if (UNLIKELY (ret < 0)) return ret; } ret = write_file (path, state, strlen (state), err); if (ret >= 0) return 0; return ret; } int libcrun_cgroup_pause_unpause_path (const char *cgroup_path, const bool pause, libcrun_error_t *err) { int cgroup_mode; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; return libcrun_cgroup_pause_unpause_with_mode (cgroup_path, cgroup_mode, pause, err); } int cgroup_killall_path (const char *path, int signal, libcrun_error_t *err) { int ret; size_t i; cleanup_free pid_t *pids = NULL; if (path == NULL || *path == '\0') return 0; /* If the signal is SIGKILL, try to kill each process using the `cgroup.kill` file. */ if (signal == SIGKILL) { cleanup_free char *kill_file = NULL; ret = append_paths (&kill_file, err, CGROUP_ROOT, path, "cgroup.kill", NULL); if (UNLIKELY (ret < 0)) return ret; ret = write_file_with_flags (kill_file, 0, "1", 1, err); if (ret >= 0) return 0; crun_error_release (err); } ret = libcrun_cgroup_pause_unpause_path (path, true, err); if (UNLIKELY (ret < 0)) crun_error_release (err); ret = libcrun_cgroup_read_pids_from_path (path, true, &pids, err); if (UNLIKELY (ret < 0)) { if (crun_error_get_errno (err) != ENOENT) return ret; /* If the file doesn't exist then the container was already killed. */ crun_error_release (err); } for (i = 0; pids && pids[i]; i++) { ret = kill (pids[i], signal); if (UNLIKELY (ret < 0 && errno != ESRCH)) return crun_make_error (err, errno, "kill process `%d`", pids[i]); } ret = libcrun_cgroup_pause_unpause_path (path, false, err); if (UNLIKELY (ret < 0)) crun_error_release (err); return 0; } static int read_available_controllers (const char *path, libcrun_error_t *err) { cleanup_free char *controllers = NULL; cleanup_free char *buf = NULL; char *saveptr = NULL; const char *token; int available = 0; ssize_t ret; ret = append_paths (&controllers, err, CGROUP_ROOT, path, "cgroup.controllers", NULL); if (UNLIKELY (ret < 0)) return ret; ret = read_all_file (controllers, &buf, NULL, err); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "error reading from file `%s`", controllers); for (token = strtok_r (buf, " \n", &saveptr); token; token = strtok_r (NULL, " \n", &saveptr)) { if (strcmp (token, "memory") == 0) available |= CGROUP_MEMORY; else if (strcmp (token, "cpu") == 0) available |= CGROUP_CPU; else if (strcmp (token, "cpuset") == 0) available |= CGROUP_CPUSET; else if (strcmp (token, "hugetlb") == 0) available |= CGROUP_HUGETLB; else if (strcmp (token, "pids") == 0) available |= CGROUP_PIDS; else if (strcmp (token, "io") == 0) available |= CGROUP_IO; } return available; } static int write_controller_file (const char *path, int controllers_to_enable, libcrun_error_t *err) { cleanup_free char *subtree_control = NULL; cleanup_free char *controllers = NULL; size_t controllers_len = 0; int ret; controllers_len = xasprintf ( &controllers, "%s %s %s %s %s %s", (controllers_to_enable & CGROUP_CPU) ? "+cpu" : "", (controllers_to_enable & CGROUP_IO) ? "+io" : "", (controllers_to_enable & CGROUP_MEMORY) ? "+memory" : "", (controllers_to_enable & CGROUP_PIDS) ? "+pids" : "", (controllers_to_enable & CGROUP_CPUSET) ? "+cpuset" : "", (controllers_to_enable & CGROUP_HUGETLB) ? "+hugetlb" : ""); ret = append_paths (&subtree_control, err, CGROUP_ROOT, path, "cgroup.subtree_control", NULL); if (UNLIKELY (ret < 0)) return ret; ret = write_file (subtree_control, controllers, controllers_len, err); if (UNLIKELY (ret < 0)) { cleanup_free char *controllers_copy = xmalloc (controllers_len + 1); int attempts_left; char *saveptr = NULL; const char *token; int e; e = crun_error_get_errno (err); if (e != EPERM && e != EACCES && e != EBUSY && e != ENOENT && e != EOPNOTSUPP) return crun_error_wrap (err, "enable controllers `%s`", controllers); /* ENOENT can mean both that the file doesn't exist or the controller is not present. */ if (e == ENOENT) { libcrun_error_t tmp_err = NULL; int exists; exists = crun_path_exists (subtree_control, &tmp_err); if (UNLIKELY (exists < 0)) { crun_error_release (&tmp_err); return ret; } /* If the file doesn't exist, then return the original ENOENT. */ if (exists == 0) return ret; } crun_error_release (err); if (e == EOPNOTSUPP) { ret = maybe_make_cgroup_threaded (path, err); if (UNLIKELY (ret < 0)) return crun_error_wrap (err, "make cgroup threaded"); } /* It seems the kernel can return EBUSY when a process was moved to a sub-cgroup and the controllers are enabled in its parent cgroup. Retry a few times when it happens. */ for (attempts_left = 1000; attempts_left >= 0; attempts_left--) { int controllers_written; bool repeat = false; memcpy (controllers_copy, controllers, controllers_len); controllers_copy[controllers_len] = '\0'; controllers_written = 0; /* Fallback to write each one individually. */ for (token = strtok_r (controllers_copy, " ", &saveptr); token; token = strtok_r (NULL, " ", &saveptr)) { ret = write_file (subtree_control, token, strlen (token), err); if (ret < 0) { e = crun_error_get_errno (err); crun_error_release (err); if (e == EBUSY) repeat = true; continue; } controllers_written++; } if (! repeat) break; /* If there was any controller written, just try once more without any delay. */ if (controllers_written > 0 && attempts_left > 2) { attempts_left = 1; continue; } if (attempts_left > 0) { struct timespec delay = { .tv_sec = 0, .tv_nsec = 1000000, }; nanosleep (&delay, NULL); } } /* Refresh what controllers are available. */ return read_available_controllers (path, err); } /* All controllers were enabled successfully. */ return controllers_to_enable; } int enable_controllers (const char *path, libcrun_error_t *err) { cleanup_free char *tmp_path = NULL; char *it; int ret, controllers_to_enable; xasprintf (&tmp_path, "%s/", path); ret = read_available_controllers ("", err); if (UNLIKELY (ret < 0)) return ret; controllers_to_enable = ret; /* Enable all possible controllers in the root cgroup. */ ret = write_controller_file ("", controllers_to_enable, err); if (UNLIKELY (ret < 0)) { /* Enabling +cpu when there are realtime processes fail with EINVAL. */ if ((controllers_to_enable & CGROUP_CPU) && (crun_error_get_errno (err) == EINVAL)) { crun_error_release (err); controllers_to_enable &= ~CGROUP_CPU; ret = write_controller_file ("", controllers_to_enable, err); } if (UNLIKELY (ret < 0)) return ret; } for (it = strchr (tmp_path + 1, '/'); it;) { cleanup_free char *cgroup_path = NULL; char *next_slash = strchr (it + 1, '/'); *it = '\0'; ret = append_paths (&cgroup_path, err, CGROUP_ROOT, tmp_path, NULL); if (UNLIKELY (ret < 0)) return ret; ret = mkdir (cgroup_path, 0755); if (UNLIKELY (ret < 0 && errno != EEXIST)) return crun_make_error (err, errno, "create `%s`", cgroup_path); if (next_slash) { ret = write_controller_file (tmp_path, controllers_to_enable, err); if (UNLIKELY (ret < 0)) return ret; } *it = '/'; it = next_slash; } return 0; } int libcrun_move_process_to_cgroup (pid_t pid, pid_t init_pid, char *path, libcrun_error_t *err) { int cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; if (path == NULL || *path == '\0') return 0; return enter_cgroup (cgroup_mode, pid, init_pid, path, false, err); } int libcrun_get_cgroup_dirfd (struct libcrun_cgroup_status *status, const char *sub_cgroup, libcrun_error_t *err) { cleanup_free char *path_to_cgroup = NULL; int cgroup_mode; int cgroupdirfd; int ret; cgroup_mode = libcrun_get_cgroup_mode (err); if (cgroup_mode < 0) return cgroup_mode; if (cgroup_mode != CGROUP_MODE_UNIFIED) return crun_make_error (err, 0, "cgroup dirfd supported only on cgroup v2"); if (status == NULL) return crun_make_error (err, 0, "internal error"); if (is_empty_string (status->path)) return crun_make_error (err, 0, "no cgroup path specified"); ret = append_paths (&path_to_cgroup, err, CGROUP_ROOT, status->path, sub_cgroup, NULL); if (UNLIKELY (ret < 0)) return ret; cgroupdirfd = open (path_to_cgroup, O_CLOEXEC | O_NOFOLLOW | O_DIRECTORY | O_RDONLY); if (UNLIKELY (cgroupdirfd < 0)) return crun_make_error (err, errno, "open `%s`", path_to_cgroup); return cgroupdirfd; } crun-1.16.1/src/libcrun/cgroup.c0000644000000000000000000003750014656670105014644 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "cgroup.h" #include "cgroup-cgroupfs.h" #include "cgroup-internal.h" #include "cgroup-systemd.h" #include "cgroup-utils.h" #include "cgroup-setup.h" #include "cgroup-resources.h" #include "ebpf.h" #include "utils.h" #include "status.h" #include #include #include #include #include #include #include #include #include #include #include static int libcrun_cgroup_enter_disabled (struct libcrun_cgroup_args *args arg_unused, struct libcrun_cgroup_status *out, libcrun_error_t *err arg_unused) { out->path = NULL; return 0; } static int libcrun_destroy_cgroup_disabled (struct libcrun_cgroup_status *cgroup_status arg_unused, libcrun_error_t *err arg_unused) { return 0; } struct libcrun_cgroup_manager cgroup_manager_disabled = { .precreate_cgroup = NULL, .create_cgroup = libcrun_cgroup_enter_disabled, .destroy_cgroup = libcrun_destroy_cgroup_disabled, }; static int get_cgroup_manager (int manager, struct libcrun_cgroup_manager **out, libcrun_error_t *err) { switch (manager) { case CGROUP_MANAGER_DISABLED: *out = &cgroup_manager_disabled; return 0; case CGROUP_MANAGER_SYSTEMD: *out = &cgroup_manager_systemd; return 0; case CGROUP_MANAGER_CGROUPFS: *out = &cgroup_manager_cgroupfs; return 0; } *out = NULL; return crun_make_error (err, EINVAL, "unknown cgroup manager specified `%d`", manager); } static const char * find_delegate_cgroup (json_map_string_string *annotations) { const char *annotation; annotation = find_annotation_map (annotations, "run.oci.delegate-cgroup"); if (annotation) { if (annotation[0] == '\0') return NULL; return annotation; } return NULL; } static inline void cleanup_sig_contp (void *p) { pid_t *pp = p; if (*pp < 0) return; TEMP_FAILURE_RETRY (kill (*pp, SIGCONT)); } static bool must_stop_proc (runtime_spec_schema_config_linux_resources *resources) { size_t i; if (resources == NULL) return false; if (resources->cpu && (resources->cpu->cpus || resources->cpu->mems)) return true; if (resources->unified) { for (i = 0; i < resources->unified->len; i++) if (has_prefix (resources->unified->keys[i], "cpuset.")) return true; } return false; } int libcrun_cgroup_pause_unpause (struct libcrun_cgroup_status *status, const bool pause, libcrun_error_t *err) { return libcrun_cgroup_pause_unpause_path (status->path, pause, err); } int libcrun_cgroup_is_container_paused (struct libcrun_cgroup_status *status, bool *paused, libcrun_error_t *err) { const char *cgroup_path = status->path; cleanup_free char *content = NULL; cleanup_free char *path = NULL; const char *state; int cgroup_mode; int ret; if (cgroup_path == NULL || cgroup_path[0] == '\0') return 0; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; if (cgroup_mode == CGROUP_MODE_UNIFIED) { state = "1"; ret = append_paths (&path, err, CGROUP_ROOT, cgroup_path, "cgroup.freeze", NULL); if (UNLIKELY (ret < 0)) return ret; } else { state = "FROZEN"; ret = append_paths (&path, err, CGROUP_ROOT "/freezer", cgroup_path, "freezer.state", NULL); if (UNLIKELY (ret < 0)) return ret; } ret = read_all_file (path, &content, NULL, err); if (UNLIKELY (ret < 0)) return ret; *paused = strstr (content, state) != NULL; return 0; } int libcrun_cgroup_read_pids (struct libcrun_cgroup_status *status, bool recurse, pid_t **pids, libcrun_error_t *err) { return libcrun_cgroup_read_pids_from_path (status->path, recurse, pids, err); } int libcrun_cgroup_killall (struct libcrun_cgroup_status *cgroup_status, int signal, libcrun_error_t *err) { return cgroup_killall_path (cgroup_status->path, signal, err); } int libcrun_cgroup_destroy (struct libcrun_cgroup_status *cgroup_status, libcrun_error_t *err) { struct libcrun_cgroup_manager *cgroup_manager = NULL; int ret; ret = get_cgroup_manager (cgroup_status->manager, &cgroup_manager, err); if (UNLIKELY (ret < 0)) return ret; return cgroup_manager->destroy_cgroup (cgroup_status, err); } int libcrun_update_cgroup_resources (struct libcrun_cgroup_status *cgroup_status, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err) { struct libcrun_cgroup_manager *cgroup_manager = NULL; int ret; ret = get_cgroup_manager (cgroup_status->manager, &cgroup_manager, err); if (UNLIKELY (ret < 0)) return ret; if (cgroup_manager->update_resources) { ret = cgroup_manager->update_resources (cgroup_status, resources, err); if (UNLIKELY (ret < 0)) return ret; } return update_cgroup_resources (cgroup_status->path, resources, err); } static int can_ignore_cgroup_enter_errors (struct libcrun_cgroup_args *args, int cgroup_mode, libcrun_error_t *err) { int manager = args->manager; int rootless; rootless = is_rootless (err); if (UNLIKELY (rootless < 0)) return rootless; /* Ignore errors if all these conditions are met: - it is running as rootless. - there is no explicit path in the OCI configuration. - it is not both cgroupv2 and manager=systemd. */ if (! rootless) return 0; if (! is_empty_string (args->cgroup_path)) return 0; if (cgroup_mode == CGROUP_MODE_UNIFIED && manager == CGROUP_MANAGER_SYSTEMD) return 0; return 1; } int libcrun_cgroup_preenter (struct libcrun_cgroup_args *args, int *dirfd, libcrun_error_t *err) { struct libcrun_cgroup_manager *cgroup_manager; int cgroup_mode; int ret; *dirfd = -1; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; if (cgroup_mode != CGROUP_MODE_UNIFIED) return 0; ret = get_cgroup_manager (args->manager, &cgroup_manager, err); if (UNLIKELY (ret < 0)) return ret; if (cgroup_manager->precreate_cgroup == NULL) return 0; return cgroup_manager->precreate_cgroup (args, dirfd, err); } int libcrun_cgroup_enter (struct libcrun_cgroup_args *args, struct libcrun_cgroup_status **out, libcrun_error_t *err) { __attribute__ ((unused)) pid_t sigcont_cleanup __attribute__ ((cleanup (cleanup_sig_contp))) = -1; /* status will be filled by the cgroup manager. */ cleanup_cgroup_status struct libcrun_cgroup_status *status = xmalloc0 (sizeof *status); struct libcrun_cgroup_manager *cgroup_manager; uid_t root_uid = args->root_uid; uid_t root_gid = args->root_gid; int cgroup_mode; int ret; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; /* If the cgroup configuration is limiting what CPUs/memory Nodes are available for the container, then stop the container process during the cgroup configuration to avoid it being rescheduled on a CPU that is not allowed. This extra step is required for setting up the sub cgroup with the systemd driver. The alternative would be to temporarily setup the cpus/mems using d-bus. */ if (must_stop_proc (args->resources)) { ret = TEMP_FAILURE_RETRY (kill (args->pid, SIGSTOP)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot stop container process `%d` with SIGSTOP", args->pid); /* Send SIGCONT as soon as the function exits. */ sigcont_cleanup = args->pid; } if (cgroup_mode == CGROUP_MODE_HYBRID) { /* We don't really support hybrid mode, so check that cgroups2 is not using any controller. */ size_t len; cleanup_free char *buffer = NULL; ret = read_all_file (CGROUP_ROOT "/unified/cgroup.controllers", &buffer, &len, err); if (UNLIKELY (ret < 0)) return ret; if (len > 0) return crun_make_error (err, 0, "cgroups in hybrid mode not supported, drop all controllers from cgroupv2"); } ret = get_cgroup_manager (args->manager, &cgroup_manager, err); if (UNLIKELY (ret < 0)) return ret; status->manager = args->manager; ret = cgroup_manager->create_cgroup (args, status, err); if (UNLIKELY (ret < 0)) { libcrun_error_t tmp_err = NULL; int ignore_cgroup_errors; ignore_cgroup_errors = can_ignore_cgroup_enter_errors (args, cgroup_mode, &tmp_err); if (UNLIKELY (ignore_cgroup_errors < 0)) { crun_error_release (err); *err = tmp_err; return ignore_cgroup_errors; } if (ignore_cgroup_errors) { /* Ignore cgroups errors and set there is no cgroup path to use. */ free (status->path); free (status->scope); status->path = NULL; status->scope = NULL; status->manager = CGROUP_MANAGER_DISABLED; crun_error_release (err); goto success; } return ret; } if (status->path) { bool need_chown; need_chown = root_uid != (uid_t) -1 || root_gid != (gid_t) -1; if (cgroup_mode == CGROUP_MODE_UNIFIED && need_chown) { ret = chown_cgroups (status->path, root_uid, root_gid, err); if (UNLIKELY (ret < 0)) return ret; } if (args->resources) { ret = update_cgroup_resources (status->path, args->resources, err); if (UNLIKELY (ret < 0)) return ret; } } /* Reset the inherited cpu affinity. Old kernels do that automatically, but new kernels remember the affinity that was set before the cgroup move. This is undesirable, because it inherits the systemd affinity when the container should really move to the container space cpus. The sched_setaffinity call will always return an error (EINVAL or ENODEV) when used like this. This is expected and part of the backward compatibility. See: https://issues.redhat.com/browse/OCPBUGS-15102 */ ret = sched_setaffinity (args->pid, 0, NULL); if (LIKELY (ret < 0)) { if (UNLIKELY (! ((errno == EINVAL) || (errno == ENODEV)))) return crun_make_error (err, errno, "failed to reset affinity"); } success: *out = status; status = NULL; return 0; } int libcrun_cgroup_enter_finalize (struct libcrun_cgroup_args *args, struct libcrun_cgroup_status *cgroup_status arg_unused, libcrun_error_t *err) { cleanup_free char *target_cgroup = NULL; cleanup_free char *cgroup_path = NULL; cleanup_free char *content = NULL; const char *delegate_cgroup; cleanup_free char *dir = NULL; char *current_cgroup, *to; int cgroup_mode; int ret; delegate_cgroup = find_delegate_cgroup (args->annotations); if (delegate_cgroup == NULL) return 0; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; if (cgroup_mode != CGROUP_MODE_UNIFIED) return crun_make_error (err, 0, "delegate-cgroup not supported on cgroup v1"); xasprintf (&cgroup_path, "/proc/%d/cgroup", args->pid); ret = read_all_file (cgroup_path, &content, NULL, err); if (UNLIKELY (ret < 0)) return ret; current_cgroup = strstr (content, "0::"); if (UNLIKELY (current_cgroup == NULL)) return crun_make_error (err, 0, "cannot find cgroup2 for the current process"); current_cgroup += 3; to = strchr (current_cgroup, '\n'); if (UNLIKELY (to == NULL)) return crun_make_error (err, 0, "cannot parse `%s`", PROC_SELF_CGROUP); *to = '\0'; ret = append_paths (&target_cgroup, err, current_cgroup, delegate_cgroup, NULL); if (UNLIKELY (ret < 0)) return ret; ret = append_paths (&dir, err, CGROUP_ROOT, target_cgroup, NULL); if (UNLIKELY (ret < 0)) return ret; ret = crun_ensure_directory (dir, 0755, true, err); if (UNLIKELY (ret < 0)) return ret; ret = move_process_to_cgroup (args->pid, NULL, target_cgroup, err); if (UNLIKELY (ret < 0)) return ret; ret = enable_controllers (target_cgroup, err); if (UNLIKELY (ret < 0)) return ret; ret = chown_cgroups (target_cgroup, args->root_uid, args->root_gid, err); if (UNLIKELY (ret < 0)) return ret; return 0; } int libcrun_cgroup_has_oom (struct libcrun_cgroup_status *status, libcrun_error_t *err) { cleanup_free char *content = NULL; const char *path = status->path; const char *prefix = NULL; size_t content_size = 0; int cgroup_mode; char *it; if (UNLIKELY (path == NULL || path[0] == '\0')) return 0; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; switch (cgroup_mode) { case CGROUP_MODE_UNIFIED: { cleanup_free char *events_path = NULL; int ret; ret = append_paths (&events_path, err, CGROUP_ROOT, path, "memory.events", NULL); if (UNLIKELY (ret < 0)) return ret; /* read_all_file always NUL terminates the output. */ ret = read_all_file (events_path, &content, &content_size, err); if (UNLIKELY (ret < 0)) return ret; prefix = "oom "; break; } case CGROUP_MODE_LEGACY: case CGROUP_MODE_HYBRID: { cleanup_free char *oom_control_path = NULL; int ret; ret = append_paths (&oom_control_path, err, CGROUP_ROOT, "memory", path, "memory.oom_control", NULL); if (UNLIKELY (ret < 0)) return ret; /* read_all_file always NUL terminates the output. */ ret = read_all_file (oom_control_path, &content, &content_size, err); if (UNLIKELY (ret < 0)) return ret; prefix = "oom_kill "; break; } default: return crun_make_error (err, 0, "invalid cgroup mode `%d`", cgroup_mode); } it = content; while (it && *it) { if (has_prefix (it, prefix)) { it += strlen (prefix); while (*it == ' ') it++; return *it != '0'; } else { it = strchr (it, '\n'); if (it == NULL) return 0; it++; } } return 0; } int libcrun_cgroup_get_status (struct libcrun_cgroup_status *cgroup_status, libcrun_container_status_t *status, libcrun_error_t *err arg_unused) { status->cgroup_path = cgroup_status->path; status->scope = cgroup_status->scope; return 0; } void libcrun_cgroup_status_free (struct libcrun_cgroup_status *cgroup_status) { if (cgroup_status == NULL) return; free (cgroup_status->path); free (cgroup_status->scope); free (cgroup_status); } struct libcrun_cgroup_status * libcrun_cgroup_make_status (libcrun_container_status_t *status) { struct libcrun_cgroup_status *ret; ret = xmalloc0 (sizeof *ret); if (status->cgroup_path) ret->path = xstrdup (status->cgroup_path); if (status->scope) ret->scope = xstrdup (status->scope); if (is_empty_string (status->cgroup_path) && is_empty_string (status->scope)) ret->manager = CGROUP_MANAGER_DISABLED; else ret->manager = status->systemd_cgroup ? CGROUP_MANAGER_SYSTEMD : CGROUP_MANAGER_CGROUPFS; return ret; } crun-1.16.1/src/libcrun/chroot_realpath.c0000664000000000000000000001167614011447170016520 0ustar0000000000000000/* * chroot_realpath.c -- resolve pathname as if inside chroot * Based on realpath.c Copyright (C) 1993 Rick Sladkey * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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; see the file COPYING.LIB. If not, * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * 2005/09/12: Dan Howell (modified from realpath.c to emulate chroot) * 2019/04/19: Giuseppe Scrivano (on ENOENT return the part that could be resolved) * 2019/09/30: Giuseppe Scrivano (follow symlinks for the last component) * 2020/02/02: Giuseppe Scrivano (don't lose terminal '/' if an absolute symlink is found) */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include /* for PATH_MAX */ #include /* for MAXPATHLEN */ #include #ifndef __set_errno #define __set_errno(val) ((errno) = (val)) #endif #include /* for S_IFLNK */ #ifndef PATH_MAX #define PATH_MAX _POSIX_PATH_MAX #endif #define MAX_READLINKS 32 char *chroot_realpath(const char *chroot, const char *path, char resolved_path[]) { char copy_path[PATH_MAX]; char link_path[PATH_MAX]; char got_path[PATH_MAX]; char *got_path_root = got_path; char *new_path = got_path; char *max_path; int readlinks = 0; int n; int chroot_len; int last_component; /* Trivial case. */ if (chroot == NULL || *chroot == '\0' || (*chroot == '/' && chroot[1] == '\0')) { strcpy(resolved_path, path); return resolved_path; } chroot_len = strlen(chroot); if (chroot_len + strlen(path) >= PATH_MAX - 3) { __set_errno(ENAMETOOLONG); return NULL; } /* Make a copy of the source path since we may need to modify it. */ strcpy(copy_path, path); path = copy_path; max_path = copy_path + PATH_MAX - chroot_len - 3; /* Start with the chroot path. */ strcpy(new_path, chroot); new_path += chroot_len; while (*new_path == '/' && new_path > got_path) new_path--; got_path_root = new_path; *new_path++ = '/'; /* Expand each slash-separated pathname component. */ while (*path != '\0') { /* Ignore stray "/". */ if (*path == '/') { path++; continue; } if (*path == '.') { /* Ignore ".". */ if (path[1] == '\0' || path[1] == '/') { path++; continue; } if (path[1] == '.') { if (path[2] == '\0' || path[2] == '/') { path += 2; /* Ignore ".." at root. */ if (new_path == got_path_root + 1) continue; /* Handle ".." by backing up. */ while ((--new_path)[-1] != '/'); continue; } } } /* Safely copy the next pathname component. */ while (*path != '\0' && *path != '/') { if (path > max_path) { __set_errno(ENAMETOOLONG); return NULL; } *new_path++ = *path++; } last_component = (*path == '\0'); #ifdef S_IFLNK /* Protect against infinite loops. */ if (readlinks++ > MAX_READLINKS) { __set_errno(ELOOP); return NULL; } /* See if latest pathname component is a symlink. */ *new_path = '\0'; n = readlink(got_path, link_path, PATH_MAX - 1); if (n < 0) { /* If a component doesn't exist, then return what we could translate. */ if (errno == ENOENT) { sprintf (resolved_path, "%s%s%s", got_path, path[0] == '/' || path[0] == '\0' ? "" : "/", path); return resolved_path; } /* EINVAL means the file exists but isn't a symlink. */ if (errno != EINVAL) { /* Make sure it's null terminated. */ *new_path = '\0'; strcpy(resolved_path, got_path); return NULL; } } else { /* Note: readlink doesn't add the null byte. */ link_path[n] = '\0'; if (*link_path == '/') { /* Start over for an absolute symlink. */ new_path = got_path_root; *new_path++ = '/'; } else /* Otherwise back up over this component. */ while (*(--new_path) != '/'); /* Safe sex check. */ if (strlen(path) + n >= PATH_MAX - 2) { __set_errno(ENAMETOOLONG); return NULL; } /* Insert symlink contents into path. */ strcat(link_path, path); strcpy(copy_path, link_path); path = copy_path; } #endif /* S_IFLNK */ if (!last_component) *new_path++ = '/'; } /* Delete trailing slash but don't whomp a lone slash. */ if (new_path != got_path + 1 && new_path[-1] == '/') new_path--; /* Make sure it's null terminated. */ *new_path = '\0'; strcpy(resolved_path, got_path); return resolved_path; } crun-1.16.1/src/libcrun/cloned_binary.c0000644000000000000000000003230314522425331016140 0ustar0000000000000000// SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later /* * Copyright (C) 2019 Aleksa Sarai * Copyright (C) 2019 SUSE LLC * * This work is dual licensed under the following licenses. You may use, * redistribute, and/or modify the work under the conditions of either (or * both) licenses. * * === Apache-2.0 === * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * === LGPL-2.1-or-later === * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * . * */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "utils.h" /* Use our own wrapper for memfd_create. */ #if !defined(SYS_memfd_create) && defined(__NR_memfd_create) # define SYS_memfd_create __NR_memfd_create #endif /* memfd_create(2) flags -- copied from . */ #ifndef MFD_CLOEXEC # define MFD_CLOEXEC 0x0001U # define MFD_ALLOW_SEALING 0x0002U #endif int memfd_create(const char *name, unsigned int flags) { #ifdef SYS_memfd_create return syscall(SYS_memfd_create, name, flags); #else errno = ENOSYS; return -1; #endif } /* This comes directly from . */ #ifndef F_LINUX_SPECIFIC_BASE # define F_LINUX_SPECIFIC_BASE 1024 #endif #ifndef F_ADD_SEALS # define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9) # define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10) #endif #ifndef F_SEAL_SEAL # define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */ # define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */ # define F_SEAL_GROW 0x0004 /* prevent file from growing */ # define F_SEAL_WRITE 0x0008 /* prevent writes */ #endif #define CLONED_BINARY_ENV "_LIBCONTAINER_CLONED_BINARY" #define CRUN_MEMFD_COMMENT "crun_cloned:/proc/self/exe" #define CRUN_MEMFD_SEALS \ (F_SEAL_SEAL | F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_WRITE) /* * Verify whether we are currently in a self-cloned program (namely, is * /proc/self/exe a memfd). F_GET_SEALS will only succeed for memfds (or rather * for shmem files), and we want to be sure it's actually sealed. */ static int is_self_cloned(void) { int fd, ret, is_cloned = 0; struct stat statbuf = {}; struct statfs fsbuf = {}; fd = open("/proc/self/exe", O_RDONLY|O_CLOEXEC); if (fd < 0) return -ENOTRECOVERABLE; /* * Is the binary a fully-sealed memfd? We don't need CLONED_BINARY_ENV for * this, because you cannot write to a sealed memfd no matter what (so * sharing it isn't a bad thing -- and an admin could bind-mount a sealed * memfd to /usr/bin/crun to allow reuse). */ ret = fcntl(fd, F_GET_SEALS); if (ret >= 0) { is_cloned = (ret == CRUN_MEMFD_SEALS); goto out; } /* Is the binary on a read-only filesystem? We can't detect bind-mounts in * particular (in-kernel they are identical to regular mounts) but we can * at least be sure that it's read-only. This occurs for multiple cases, * such as truly read-only filesystems like squashfs/erofs as well as * things like the ostree read-only bind mount. */ if (fstatfs(fd, &fsbuf) >= 0 && (fsbuf.f_flags & MS_RDONLY)) { is_cloned = true; goto out; } /* * All other forms require CLONED_BINARY_ENV, since they are potentially * writeable (or we can't tell if they're fully safe) and thus we must * check the environment as an extra layer of defence. */ if (!getenv(CLONED_BINARY_ENV)) { is_cloned = false; goto out; } /* * Okay, we're a tmpfile -- or we're currently running on RHEL <=7.6 * which appears to have a borked backport of F_GET_SEALS. Either way, * having a file which has no hardlinks indicates that we aren't using * a host-side "crun" binary and this is something that a container * cannot fake (because unlinking requires being able to resolve the * path that you want to unlink). */ if (fstat(fd, &statbuf) >= 0) is_cloned |= (statbuf.st_nlink == 0); out: close(fd); return is_cloned; } /* Read a given file into a new buffer, and providing the length. */ static char *read_file(char *path, size_t *length) { int fd; char buf[4096], *copy = NULL; if (!length) return NULL; fd = open(path, O_RDONLY | O_CLOEXEC); if (fd < 0) return NULL; *length = 0; for (;;) { ssize_t n; n = read(fd, buf, sizeof(buf)); if (n < 0) goto error; if (!n) break; copy = xrealloc(copy, (*length + n) * sizeof(*copy)); memcpy(copy + *length, buf, n); *length += n; } close(fd); return copy; error: close(fd); free(copy); return NULL; } /* * A poor-man's version of "xargs -0". Basically parses a given block of * NUL-delimited data, within the given length and adds a pointer to each entry * to the array of pointers. */ static int parse_xargs(char *data, int data_length, char ***output) { int num = 0; char *cur = data; if (!data || *output != NULL) return -1; while (cur < data + data_length) { num++; *output = xrealloc(*output, (num + 1) * sizeof(**output)); (*output)[num - 1] = cur; cur += strlen(cur) + 1; } (*output)[num] = NULL; return num; } /* * "Parse" out argv from /proc/self/cmdline. * This is necessary because we are running in a context where we don't have a * main() that we can just get the arguments from. */ static int fetchve(char ***argv) { char *cmdline = NULL; size_t cmdline_size; cmdline = read_file("/proc/self/cmdline", &cmdline_size); if (!cmdline) goto error; if (parse_xargs(cmdline, cmdline_size, argv) <= 0) goto error; return 0; error: free(cmdline); return -EINVAL; } enum { EFD_NONE = 0, EFD_MEMFD, EFD_FILE, }; /* * This comes from . We can't hard-code __O_TMPFILE because it * changes depending on the architecture. If we don't have O_TMPFILE we always * have the mkostemp(3) fallback. */ #ifndef O_TMPFILE # if defined(__O_TMPFILE) && defined(O_DIRECTORY) # define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) # endif #endif static int make_execfd(int *fdtype) { int fd = -1; char template[PATH_MAX] = {0}; char *prefix = getenv("_LIBCONTAINER_STATEDIR"); if (!prefix || *prefix != '/') prefix = "/tmp"; if (snprintf(template, sizeof(template), "%s/crun.XXXXXX", prefix) < 0) return -1; /* * Now try memfd, it's much nicer than actually creating a file in STATEDIR * since it's easily detected thanks to sealing and also doesn't require * assumptions about STATEDIR. */ *fdtype = EFD_MEMFD; fd = memfd_create(CRUN_MEMFD_COMMENT, MFD_CLOEXEC | MFD_ALLOW_SEALING); if (fd >= 0) return fd; if (errno != ENOSYS && errno != EINVAL) goto error; #ifdef O_TMPFILE /* * Try O_TMPFILE to avoid races where someone might snatch our file. Note * that O_EXCL isn't actually a security measure here (since you can just * fd re-open it and clear O_EXCL). */ *fdtype = EFD_FILE; fd = open(prefix, O_TMPFILE | O_EXCL | O_RDWR | O_CLOEXEC, 0700); if (fd >= 0) { struct stat statbuf = {}; bool working_otmpfile = false; /* * open(2) ignores unknown O_* flags -- yeah, I was surprised when I * found this out too. As a result we can't check for EINVAL. However, * if we get nlink != 0 (or EISDIR) then we know that this kernel * doesn't support O_TMPFILE. */ if (fstat(fd, &statbuf) >= 0) working_otmpfile = (statbuf.st_nlink == 0); if (working_otmpfile) return fd; /* Pretend that we got EISDIR since O_TMPFILE failed. */ close(fd); errno = EISDIR; } if (errno != EISDIR) goto error; #endif /* defined(O_TMPFILE) */ /* * Our final option is to create a temporary file the old-school way, and * then unlink it so that nothing else sees it by accident. */ *fdtype = EFD_FILE; fd = mkostemp(template, O_CLOEXEC); if (fd >= 0) { if (unlink(template) >= 0) return fd; close(fd); } error: *fdtype = EFD_NONE; return -1; } static int seal_execfd(int *fd, int fdtype) { switch (fdtype) { case EFD_MEMFD: return fcntl(*fd, F_ADD_SEALS, CRUN_MEMFD_SEALS); case EFD_FILE: { /* Need to re-open our pseudo-memfd as an O_PATH to avoid execve(2) giving -ETXTBSY. */ int newfd; char fdpath[PATH_MAX] = {0}; if (fchmod(*fd, 0100) < 0) return -1; if (snprintf(fdpath, sizeof(fdpath), "/proc/self/fd/%d", *fd) < 0) return -1; newfd = open(fdpath, O_PATH | O_CLOEXEC); if (newfd < 0) return -1; close(*fd); *fd = newfd; return 0; } default: break; } return -1; } static int try_bindfd(void) { mode_t mask; int fd, ret = -1; char template[PATH_MAX] = {0}; char *prefix = getenv("_LIBCONTAINER_STATEDIR"); if (!prefix || *prefix != '/') prefix = "/tmp"; if (snprintf(template, sizeof(template), "%s/crun.XXXXXX", prefix) < 0) return ret; /* * We need somewhere to mount it, mounting anything over /proc/self is a * BAD idea on the host -- even if we do it temporarily. */ mask = umask(0700); fd = mkstemp(template); umask(mask); if (fd < 0) return ret; close(fd); /* * For obvious reasons this won't work in rootless mode because we haven't * created a userns+mntns -- but getting that to work will be a bit * complicated and it's only worth doing if someone actually needs it. */ ret = -EPERM; if (mount("/proc/self/exe", template, "", MS_BIND, "") < 0) goto out; if (mount("", template, "", MS_REMOUNT | MS_BIND | MS_RDONLY, "") < 0) goto out_umount; /* Get read-only handle that we're sure can't be made read-write. */ ret = open(template, O_PATH | O_CLOEXEC); out_umount: /* * Make sure the MNT_DETACH works, otherwise we could get remounted * read-write and that would be quite bad (the fd would be made read-write * too, invalidating the protection). */ if (umount2(template, MNT_DETACH) < 0) { if (ret >= 0) close(ret); ret = -ENOTRECOVERABLE; } out: /* * We don't care about unlink errors, the worst that happens is that * there's an empty file left around in STATEDIR. */ unlink(template); return ret; } static ssize_t fd_to_fd(int outfd, int infd) { ssize_t total = 0; char buffer[4096]; for (;;) { ssize_t nread, nwritten = 0; nread = read(infd, buffer, sizeof(buffer)); if (nread < 0) return -1; if (!nread) break; do { ssize_t n = write(outfd, buffer + nwritten, nread - nwritten); if (n < 0) return -1; nwritten += n; } while(nwritten < nread); total += nwritten; } return total; } static int clone_binary(void) { cleanup_close int binfd = -1; cleanup_close int execfd = -1; struct stat statbuf = {}; ssize_t sent = 0; int fdtype = EFD_NONE; /* * Before we resort to copying, let's try creating an ro-binfd in one shot * by getting a handle for a read-only bind-mount of the execfd. */ execfd = try_bindfd(); if (execfd >= 0) { /* Transfer ownership to caller */ int ret_execfd = execfd; execfd = -1; return ret_execfd; } /* * Dammit, that didn't work -- time to copy the binary to a safe place we * can seal the contents. */ execfd = make_execfd(&fdtype); if (execfd < 0 || fdtype == EFD_NONE) return -ENOTRECOVERABLE; binfd = open("/proc/self/exe", O_RDONLY | O_CLOEXEC); if (binfd < 0) goto error; if (fstat(binfd, &statbuf) < 0) goto error; while (sent < statbuf.st_size) { int n = sendfile(execfd, binfd, NULL, statbuf.st_size - sent); if (n < 0) { /* sendfile can fail so we fallback to a dumb user-space copy. */ n = fd_to_fd(execfd, binfd); if (n < 0) goto error; } sent += n; } close(binfd); if (sent != statbuf.st_size) goto error; if (seal_execfd(&execfd, fdtype) < 0) goto error; { /* Transfer ownership to caller */ int ret_execfd = execfd; execfd = -1; return ret_execfd; } error: return -EIO; } /* Get cheap access to the environment. */ extern char **environ; int ensure_cloned_binary(void) { cleanup_close int execfd = -1; char **argv = NULL; /* Check that we're not self-cloned, and if we are then bail. */ int cloned = is_self_cloned(); if (cloned > 0 || cloned == -ENOTRECOVERABLE) return cloned; if (fetchve(&argv) < 0) return -EINVAL; execfd = clone_binary(); if (execfd < 0) return -EIO; if (putenv(CLONED_BINARY_ENV "=1")) goto error; fexecve(execfd, argv, environ); error: return -ENOEXEC; } crun-1.16.1/src/libcrun/container.c0000644000000000000000000040255314656670105015333 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2020 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include #include #include "container.h" #include "utils.h" #include "seccomp.h" #ifdef HAVE_SECCOMP # include #endif #include "scheduler.h" #include "seccomp_notify.h" #include "custom-handler.h" #include #include #include #include #include #include #include #include #include #include "status.h" #include "mount_flags.h" #include "linux.h" #include "terminal.h" #include "io_priority.h" #include "cgroup.h" #include "cgroup-utils.h" #include #include #include #include #ifdef HAVE_CAP # include #endif #include #include #include #include #ifdef HAVE_SYSTEMD # include #endif #include #include #define YAJL_STR(x) ((const unsigned char *) (x)) enum { SYNC_SOCKET_SYNC_MESSAGE, SYNC_SOCKET_ERROR_MESSAGE, SYNC_SOCKET_WARNING_MESSAGE, }; struct container_entrypoint_s { libcrun_container_t *container; libcrun_context_t *context; int has_terminal_socket_pair; int terminal_socketpair[2]; /* Used by log_write_to_sync_socket. */ int sync_socket; int seccomp_fd; int seccomp_receiver_fd; int console_socket_fd; int hooks_out_fd; int hooks_err_fd; struct custom_handler_instance_s *custom_handler; }; struct sync_socket_message_s { int type; int error_value; char message[512]; }; typedef runtime_spec_schema_defs_hook hook; // linux hooks char *hooks[] = { "prestart", "createRuntime", "createContainer", "startContainer", "poststart", "poststop" }; // linux namespaces static char *namespaces[] = { "cgroup", "ipc", "mount", "network", "pid", "user", "uts" }; static char *actions[] = { "SCMP_ACT_ALLOW", "SCMP_ACT_ERRNO", "SCMP_ACT_KILL", "SCMP_ACT_KILL_PROCESS", "SCMP_ACT_KILL_THREAD", "SCMP_ACT_LOG", "SCMP_ACT_NOTIFY", "SCMP_ACT_TRACE", "SCMP_ACT_TRAP" }; static char *operators[] = { "SCMP_CMP_NE", "SCMP_CMP_LT", "SCMP_CMP_LE", "SCMP_CMP_EQ", "SCMP_CMP_GE", "SCMP_CMP_GT", "SCMP_CMP_MASKED_EQ", }; static char *archs[] = { "SCMP_ARCH_AARCH64", "SCMP_ARCH_ARM", "SCMP_ARCH_MIPS", "SCMP_ARCH_MIPS64", "SCMP_ARCH_MIPS64N32", "SCMP_ARCH_MIPSEL", "SCMP_ARCH_MIPSEL64", "SCMP_ARCH_MIPSEL64N32", "SCMP_ARCH_PPC", "SCMP_ARCH_PPC64", "SCMP_ARCH_PPC64LE", "SCMP_ARCH_RISCV64", "SCMP_ARCH_S390", "SCMP_ARCH_S390X", "SCMP_ARCH_X32", "SCMP_ARCH_X86", "SCMP_ARCH_X86_64" }; static const char spec_file[] = "\ {\n\ \"ociVersion\": \"1.0.0\",\n\ \"process\": {\n\ \"terminal\": true,\n\ \"user\": {\n\ \"uid\": 0,\n\ \"gid\": 0\n\ },\n\ \"args\": [\n\ \"sh\"\n\ ],\n\ \"env\": [\n\ \"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\",\n\ \"TERM=xterm\"\n\ ],\n\ \"cwd\": \"/\",\n\ \"capabilities\": {\n\ \"bounding\": [\n\ \"CAP_AUDIT_WRITE\",\n\ \"CAP_KILL\",\n\ \"CAP_NET_BIND_SERVICE\"\n\ ],\n\ \"effective\": [\n\ \"CAP_AUDIT_WRITE\",\n\ \"CAP_KILL\",\n\ \"CAP_NET_BIND_SERVICE\"\n\ ],\n\ \"inheritable\": [\n\ ],\n\ \"permitted\": [\n\ \"CAP_AUDIT_WRITE\",\n\ \"CAP_KILL\",\n\ \"CAP_NET_BIND_SERVICE\"\n\ ],\n\ \"ambient\": [\n\ \"CAP_AUDIT_WRITE\",\n\ \"CAP_KILL\",\n\ \"CAP_NET_BIND_SERVICE\"\n\ ]\n\ },\n\ \"rlimits\": [\n\ {\n\ \"type\": \"RLIMIT_NOFILE\",\n\ \"hard\": 1024,\n\ \"soft\": 1024\n\ }\n\ ],\n\ \"noNewPrivileges\": true\n\ },\n\ \"root\": {\n\ \"path\": \"rootfs\",\n\ \"readonly\": true\n\ },\n\ \"hostname\": \"crun\",\n\ \"mounts\": [\n\ {\n\ \"destination\": \"/proc\",\n\ \"type\": \"proc\",\n\ \"source\": \"proc\"\n\ },\n\ {\n\ \"destination\": \"/dev\",\n\ \"type\": \"tmpfs\",\n\ \"source\": \"tmpfs\",\n\ \"options\": [\n\ \"nosuid\",\n\ \"strictatime\",\n\ \"mode=755\",\n\ \"size=65536k\"\n\ ]\n\ },\n\ {\n\ \"destination\": \"/dev/pts\",\n\ \"type\": \"devpts\",\n\ \"source\": \"devpts\",\n\ \"options\": [\n\ \"nosuid\",\n\ \"noexec\",\n\ \"newinstance\",\n\ \"ptmxmode=0666\",\n\ \"mode=0620\"\ %s\ ]\n\ },\n\ {\n\ \"destination\": \"/dev/shm\",\n\ \"type\": \"tmpfs\",\n\ \"source\": \"shm\",\n\ \"options\": [\n\ \"nosuid\",\n\ \"noexec\",\n\ \"nodev\",\n\ \"mode=1777\",\n\ \"size=65536k\"\n\ ]\n\ },\n\ {\n\ \"destination\": \"/dev/mqueue\",\n\ \"type\": \"mqueue\",\n\ \"source\": \"mqueue\",\n\ \"options\": [\n\ \"nosuid\",\n\ \"noexec\",\n\ \"nodev\"\n\ ]\n\ },\n\ {\n\ \"destination\": \"/sys\",\n\ \"type\": \"sysfs\",\n\ \"source\": \"sysfs\",\n\ \"options\": [\n\ \"nosuid\",\n\ \"noexec\",\n\ \"nodev\",\n\ \"ro\"\n\ ]\n\ },\n\ {\n\ \"destination\": \"/sys/fs/cgroup\",\n\ \"type\": \"cgroup\",\n\ \"source\": \"cgroup\",\n\ \"options\": [\n\ \"nosuid\",\n\ \"noexec\",\n\ \"nodev\",\n\ \"relatime\",\n\ \"ro\"\n\ ]\n\ }\n\ ],\n\ \"linux\": {\n\ \"resources\": {\n\ \"devices\": [\n\ {\n\ \"allow\": false,\n\ \"access\": \"rwm\"\n\ }\n\ ]\n\ },\n\ \"namespaces\": [\n\ {\n\ \"type\": \"pid\"\n\ },\n\ {\n\ \"type\": \"network\"\n\ },\n\ {\n\ \"type\": \"ipc\"\n\ },\n\ {\n\ \"type\": \"uts\"\n\ },\n\ %s\ %s\ {\n\ \"type\": \"mount\"\n\ }\n\ ],\n\ \"maskedPaths\": [\n\ \"/proc/acpi\",\n\ \"/proc/asound\",\n\ \"/proc/kcore\",\n\ \"/proc/keys\",\n\ \"/proc/latency_stats\",\n\ \"/proc/timer_list\",\n\ \"/proc/timer_stats\",\n\ \"/proc/sched_debug\",\n\ \"/sys/firmware\",\n\ \"/proc/scsi\"\n\ ],\n\ \"readonlyPaths\": [\n\ \"/proc/bus\",\n\ \"/proc/fs\",\n\ \"/proc/irq\",\n\ \"/proc/sys\",\n\ \"/proc/sysrq-trigger\"\n\ ]\n\ }\n\ }\n"; static const char *spec_pts_tty_group = ",\n\ \"gid=5\"\n"; static const char *spec_user = "\ {\n\ \"type\": \"user\"\n\ },\n"; static const char *spec_cgroupns = "\ {\n\ \"type\": \"cgroup\"\n\ },\n"; static char *potentially_unsafe_annotations[] = { "module.wasm.image/variant", "io.kubernetes.cri.container-type", "run.oci.", }; #define SYNC_SOCKET_MESSAGE_LEN(x, l) (offsetof (struct sync_socket_message_s, message) + l) static int sync_socket_write_msg (int fd, bool warning, int err_value, const char *log_msg) { int ret; size_t err_len; struct sync_socket_message_s msg; msg.type = warning ? SYNC_SOCKET_WARNING_MESSAGE : SYNC_SOCKET_ERROR_MESSAGE; msg.error_value = err_value; if (fd < 0) return 0; err_len = strlen (log_msg); if (err_len >= sizeof (msg.message)) err_len = sizeof (msg.message) - 1; memcpy (msg.message, log_msg, err_len); msg.message[err_len] = '\0'; ret = TEMP_FAILURE_RETRY (write (fd, &msg, SYNC_SOCKET_MESSAGE_LEN (msg, err_len + 1))); if (UNLIKELY (ret < 0)) return -1; return 0; } static int sync_socket_write_error (int fd, libcrun_error_t *out_err) { if (fd < 0) return 0; return sync_socket_write_msg (fd, false, (*out_err)->status, (*out_err)->msg); } static void log_write_to_sync_socket (int errno_, const char *msg, bool warning, void *arg) { struct container_entrypoint_s *entrypoint_args = arg; int fd = entrypoint_args->sync_socket; if (fd < 0) return; if (sync_socket_write_msg (fd, warning, errno_, msg) < 0) log_write_to_stderr (errno_, msg, warning, arg); } static bool is_memory_limit_too_low (runtime_spec_schema_config_schema *def) { const long memory_limit_too_low = 1024 * 1024; if (def->linux == NULL || def->linux->resources == NULL) return false; if (def->linux->resources->memory && def->linux->resources->memory->limit_present && def->linux->resources->memory->limit < memory_limit_too_low) return true; if (def->linux->resources->unified) { size_t i; for (i = 0; i < def->linux->resources->unified->len; i++) if (strcmp (def->linux->resources->unified->keys[i], "memory.max") == 0) { long limit; errno = 0; limit = strtol (def->linux->resources->unified->values[i], NULL, 10); if (errno != 0) return false; if (limit < memory_limit_too_low) return true; } } return false; } static int sync_socket_wait_sync (libcrun_context_t *context, int fd, bool flush, libcrun_error_t *err) { struct sync_socket_message_s msg; if (fd < 0) return 0; while (true) { int ret; errno = 0; ret = TEMP_FAILURE_RETRY (read (fd, &msg, sizeof (msg))); if (UNLIKELY (ret < 0)) { if (flush) return 0; return crun_make_error (err, errno, "read from sync socket"); } if (ret == 0) { if (flush) return 0; return crun_make_error (err, errno, "read from the init process"); } if (! flush && msg.type == SYNC_SOCKET_SYNC_MESSAGE) return 0; if (msg.type == SYNC_SOCKET_WARNING_MESSAGE) { if (context) context->output_handler (msg.error_value, msg.message, 1, context->output_handler_arg); continue; } if (msg.type == SYNC_SOCKET_ERROR_MESSAGE) return crun_make_error (err, msg.error_value, "%s", msg.message); } } static int sync_socket_send_sync (int fd, bool flush_errors, libcrun_error_t *err) { int ret; struct sync_socket_message_s msg = { 0, }; msg.type = SYNC_SOCKET_SYNC_MESSAGE; if (fd < 0) return 0; ret = TEMP_FAILURE_RETRY (write (fd, &msg, SYNC_SOCKET_MESSAGE_LEN (msg, 0))); if (UNLIKELY (ret < 0)) { if (flush_errors) { int saved_errno = errno; ret = TEMP_FAILURE_RETRY (read (fd, &msg, sizeof (msg))); if (ret >= 0 && msg.type == SYNC_SOCKET_ERROR_MESSAGE) return crun_make_error (err, msg.error_value, "%s", msg.message); errno = saved_errno; } return crun_make_error (err, errno, "write to sync socket"); } return 0; } static libcrun_container_t * make_container (runtime_spec_schema_config_schema *container_def, const char *path, const char *config) { libcrun_container_t *container = xmalloc0 (sizeof (*container)); container->container_def = container_def; container->host_uid = geteuid (); container->host_gid = getegid (); if (path) container->config_file = xstrdup (path); if (config) container->config_file_content = xstrdup (config); return container; } libcrun_container_t * libcrun_container_load_from_memory (const char *json, libcrun_error_t *err) { runtime_spec_schema_config_schema *container_def; cleanup_free char *oci_error = NULL; container_def = runtime_spec_schema_config_schema_parse_data (json, NULL, &oci_error); if (container_def == NULL) { crun_make_error (err, 0, "load: `%s`", oci_error); return NULL; } return make_container (container_def, NULL, json); } libcrun_container_t * libcrun_container_load_from_file (const char *path, libcrun_error_t *err) { runtime_spec_schema_config_schema *container_def; cleanup_free char *oci_error = NULL; container_def = runtime_spec_schema_config_schema_parse_file (path, NULL, &oci_error); if (container_def == NULL) { crun_make_error (err, 0, "load `%s`: %s", path, oci_error); return NULL; } return make_container (container_def, path, NULL); } void libcrun_container_free (libcrun_container_t *ctr) { if (ctr == NULL) return; if (ctr->cleanup_private_data) ctr->cleanup_private_data (ctr->private_data); if (ctr->container_def) free_runtime_spec_schema_config_schema (ctr->container_def); free (ctr->config_file_content); free (ctr->config_file); free (ctr); } static int block_signals (libcrun_error_t *err) { int ret; sigset_t mask; sigfillset (&mask); ret = sigprocmask (SIG_BLOCK, &mask, NULL); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "sigprocmask"); return 0; } static int unblock_signals (libcrun_error_t *err) { int i; int ret; sigset_t mask; struct sigaction act = {}; sigfillset (&mask); ret = sigprocmask (SIG_UNBLOCK, &mask, NULL); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "sigprocmask"); act.sa_handler = SIG_DFL; for (i = 0; i < NSIG; i++) { ret = sigaction (i, &act, NULL); if (ret < 0 && errno != EINVAL) return crun_make_error (err, errno, "sigaction"); } return 0; } /* must be used on the host before pivot_root(2). */ static int initialize_security (runtime_spec_schema_config_schema_process *proc, libcrun_error_t *err) { int ret; if (UNLIKELY (proc == NULL)) return 0; if (proc->apparmor_profile) { ret = libcrun_initialize_apparmor (err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_initialize_selinux (err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_init_caps (err); if (UNLIKELY (ret < 0)) return ret; return 0; } static int do_hooks (runtime_spec_schema_config_schema *def, pid_t pid, const char *id, bool keep_going, const char *cwd, const char *status, hook **hooks, size_t hooks_len, int out_fd, int err_fd, libcrun_error_t *err) { size_t i, stdin_len; int r, ret; char *stdin = NULL; cleanup_free char *cwd_allocated = NULL; const char *rootfs = def->root ? def->root->path : ""; yajl_gen gen = NULL; if (cwd == NULL) { cwd = cwd_allocated = getcwd (NULL, 0); if (cwd == NULL) OOM (); } gen = yajl_gen_alloc (NULL); if (gen == NULL) return crun_make_error (err, 0, "yajl_gen_alloc failed"); r = yajl_gen_map_open (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("ociVersion"), strlen ("ociVersion")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("1.0"), strlen ("1.0")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("id"), strlen ("id")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR (id), strlen (id)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("pid"), strlen ("pid")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_integer (gen, pid); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("root"), strlen ("root")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR (rootfs), strlen (rootfs)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("bundle"), strlen ("bundle")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR (cwd), strlen (cwd)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("status"), strlen ("status")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR (status), strlen (status)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; if (def && def->annotations && def->annotations->len) { r = yajl_gen_string (gen, YAJL_STR ("annotations"), strlen ("annotations")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_map_open (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; for (i = 0; i < def->annotations->len; i++) { const char *key = def->annotations->keys[i]; const char *val = def->annotations->values[i]; r = yajl_gen_string (gen, YAJL_STR (key), strlen (key)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR (val), strlen (val)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; } r = yajl_gen_map_close (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; } r = yajl_gen_map_close (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_get_buf (gen, (const unsigned char **) &stdin, &stdin_len); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; ret = 0; for (i = 0; i < hooks_len; i++) { char **env = environ; if (hooks[i]->env) env = hooks[i]->env; ret = run_process_with_stdin_timeout_envp (hooks[i]->path, hooks[i]->args, cwd, hooks[i]->timeout, env, stdin, stdin_len, out_fd, err_fd, err); if (UNLIKELY (ret != 0)) { if (keep_going) libcrun_warning ("error executing hook `%s` (exit code: %d)", hooks[i]->path, ret); else { libcrun_error (0, "error executing hook `%s` (exit code: %d)", hooks[i]->path, ret); break; } } } if (gen) yajl_gen_free (gen); return ret; yajl_error: if (gen) yajl_gen_free (gen); return yajl_error_to_crun_error (r, err); } static int get_yajl_result (yajl_gen gen, char **out, size_t *out_len) { const unsigned char *buf = NULL; size_t buf_len = 0; int r; r = yajl_gen_get_buf (gen, &buf, &buf_len); if (UNLIKELY (r != yajl_gen_status_ok)) return r; *out_len = buf_len; *out = malloc (buf_len + 1); if (*out == NULL) OOM (); memcpy (*out, buf, buf_len); (*out)[buf_len] = '\0'; return yajl_gen_status_ok; } static int get_seccomp_receiver_fd_payload (libcrun_container_t *container, const char *status, pid_t own_pid, char **seccomp_fd_payload, size_t *seccomp_fd_payload_len, libcrun_error_t *err) { int r; yajl_gen gen = NULL; runtime_spec_schema_config_schema *def = container->container_def; const char *const OCI_VERSION = "0.2.0"; gen = yajl_gen_alloc (NULL); if (gen == NULL) return crun_make_error (err, 0, "yajl_gen_alloc failed"); yajl_gen_config (gen, yajl_gen_beautify, 1); yajl_gen_config (gen, yajl_gen_validate_utf8, 1); r = yajl_gen_map_open (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR ("ociVersion"), strlen ("ociVersion")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR (OCI_VERSION), strlen (OCI_VERSION)); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR ("fds"), strlen ("fds")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_array_open (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR ("seccompFd"), strlen ("seccompFd")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_array_close (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR ("pid"), strlen ("pid")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_integer (gen, own_pid); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; if (def && def->linux && def->linux->seccomp) { const char *metadata = def->linux->seccomp->listener_metadata; if (metadata) { r = yajl_gen_string (gen, YAJL_STR ("metadata"), strlen ("metadata")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR (metadata), strlen (metadata)); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; } } /* State. */ r = yajl_gen_string (gen, YAJL_STR ("state"), strlen ("state")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_map_open (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR ("ociVersion"), strlen ("ociVersion")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR (OCI_VERSION), strlen (OCI_VERSION)); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; if (container->context && container->context->id) { r = yajl_gen_string (gen, YAJL_STR ("id"), strlen ("id")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR (container->context->id), strlen (container->context->id)); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; } r = yajl_gen_string (gen, YAJL_STR ("status"), strlen ("status")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR (status), strlen (status)); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR ("pid"), strlen ("pid")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_integer (gen, own_pid); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; if (container->context && container->context->bundle) { r = yajl_gen_string (gen, YAJL_STR ("bundle"), strlen ("bundle")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR (container->context->bundle), strlen (container->context->bundle)); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; } if (def->annotations && def->annotations->len) { size_t i; r = yajl_gen_string (gen, YAJL_STR ("annotations"), strlen ("annotations")); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_map_open (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; for (i = 0; i < def->annotations->len; i++) { const char *key = def->annotations->keys[i]; const char *val = def->annotations->values[i]; r = yajl_gen_string (gen, YAJL_STR (key), strlen (key)); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = yajl_gen_string (gen, YAJL_STR (val), strlen (val)); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; } r = yajl_gen_map_close (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; } r = yajl_gen_map_close (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; /* End state. */ r = yajl_gen_map_close (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto exit; r = get_yajl_result (gen, seccomp_fd_payload, seccomp_fd_payload_len); exit: yajl_gen_free (gen); return yajl_error_to_crun_error (r, err); } static int send_sync_cb (void *data, libcrun_error_t *err) { int sync_socket_fd = *((int *) data); int ret; /* sync 2. */ ret = sync_socket_send_sync (sync_socket_fd, false, err); if (UNLIKELY (ret < 0)) return ret; /* sync 3. */ return sync_socket_wait_sync (NULL, sync_socket_fd, false, err); } static int maybe_chown_std_streams (uid_t container_uid, gid_t container_gid, libcrun_error_t *err) { int ret, i; for (i = 0; i < 3; i++) { if (! isatty (i)) { ret = fchown (i, container_uid, container_gid); if (UNLIKELY (ret < 0)) { /* EINVAL means the user is not mapped in the current userns. Ignore EPERM and EROFS as well as there is no reason to fail so early, and let the container payload deal with it. */ if (errno == EINVAL || errno == EPERM || errno == EROFS) continue; return crun_make_error (err, errno, "fchown std stream %i", i); } } } return 0; } int libcrun_container_notify_handler (struct container_entrypoint_s *args, enum handler_configure_phase phase, libcrun_container_t *container, const char *rootfs, libcrun_error_t *err) { struct custom_handler_s *h; if (args->custom_handler == NULL) return 0; h = args->custom_handler->vtable; if (h == NULL || h->configure_container == NULL) return 0; return h->configure_container (args->custom_handler->cookie, phase, args->context, container, rootfs, err); } /* Initialize the environment where the container process runs. It is used by the container init process. */ static int container_init_setup (void *args, pid_t own_pid, char *notify_socket, int sync_socket, char **exec_path, libcrun_error_t *err) { struct container_entrypoint_s *entrypoint_args = args; libcrun_container_t *container = entrypoint_args->container; bool chdir_done = false; int ret; int has_terminal; cleanup_close int console_socket = -1; cleanup_close int console_socketpair = -1; runtime_spec_schema_config_schema *def = container->container_def; runtime_spec_schema_config_schema_process_capabilities *capabilities; cleanup_free char *rootfs = NULL; int no_new_privs; ret = initialize_security (def->process, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_configure_network (container, err); if (UNLIKELY (ret < 0)) return ret; if (def->root && def->root->path) { rootfs = realpath (def->root->path, NULL); if (UNLIKELY (rootfs == NULL)) { /* If realpath failed for any reason, try the relative directory. */ if (def->root->path[0] == '/') { cleanup_free char *cwd = NULL; ssize_t len; len = safe_readlinkat (AT_FDCWD, "/proc/self/cwd", &cwd, 0, err); if (UNLIKELY (len < 0)) return len; /* If the rootfs is under the current working directory, just use its relative path. */ if (has_prefix (def->root->path, cwd) && def->root->path[len] == '/') { const char *it = consume_slashes (def->root->path + len); if (*it) rootfs = xstrdup (it); } } /* If nothing else worked, just use the path as it is. */ if (rootfs == NULL) rootfs = xstrdup (def->root->path); } } if (entrypoint_args->terminal_socketpair[0] >= 0) { close_and_reset (&entrypoint_args->terminal_socketpair[0]); console_socketpair = entrypoint_args->terminal_socketpair[1]; } /* sync 1. */ ret = sync_socket_wait_sync (NULL, sync_socket, false, err); if (UNLIKELY (ret < 0)) return ret; has_terminal = container->container_def->process && container->container_def->process->terminal; if (has_terminal && entrypoint_args->context->console_socket) console_socket = entrypoint_args->console_socket_fd; ret = libcrun_set_sysctl (container, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_container_notify_handler (entrypoint_args, HANDLER_CONFIGURE_BEFORE_MOUNTS, container, rootfs, err); if (UNLIKELY (ret < 0)) return ret; /* sync 2 and 3 are sent as part of libcrun_set_mounts. */ ret = libcrun_set_mounts (entrypoint_args, container, rootfs, send_sync_cb, &sync_socket, err); if (UNLIKELY (ret < 0)) return ret; if (def->hooks && def->hooks->create_container_len) { ret = do_hooks (def, 0, container->context->id, false, NULL, "created", (hook **) def->hooks->create_container, def->hooks->create_container_len, entrypoint_args->hooks_out_fd, entrypoint_args->hooks_err_fd, err); if (UNLIKELY (ret != 0)) return ret; } if (def->process) { ret = libcrun_set_selinux_label (def->process, false, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_set_apparmor_profile (def->process, false, err); if (UNLIKELY (ret < 0)) return ret; } ret = mark_or_close_fds_ge_than (entrypoint_args->context->preserve_fds + 3, false, err); if (UNLIKELY (ret < 0)) crun_error_write_warning_and_release (entrypoint_args->context->output_handler_arg, &err); if (rootfs) { ret = libcrun_do_pivot_root (container, entrypoint_args->context->no_pivot, rootfs, err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_reopen_dev_null (err); if (UNLIKELY (ret < 0)) return ret; ret = maybe_chown_std_streams (container->container_uid, container->container_gid, err); if (UNLIKELY (ret < 0)) return ret; if (clearenv ()) return crun_make_error (err, errno, "clearenv"); if (def->process) { size_t i; for (i = 0; i < def->process->env_len; i++) if (putenv (def->process->env[i]) < 0) return crun_make_error (err, errno, "putenv `%s`", def->process->env[i]); } if (getenv ("HOME") == NULL) { ret = set_home_env (container->container_uid); if (UNLIKELY (ret < 0 && errno != ENOTSUP)) { setenv ("HOME", "/", 1); libcrun_warning ("cannot detect HOME environment variable, setting default"); } } /* Set primary process to 1 explicitly if nothing is configured and LISTEN_FD is not set. */ if (entrypoint_args->context->listen_fds > 0 && getenv ("LISTEN_PID") == NULL) { setenv ("LISTEN_PID", "1", 1); libcrun_warning ("setting LISTEN_PID=1 since no previous configuration was found"); } /* Attempt to chdir immediately here, before doing the setresuid. If we fail here, let's try again later once the process switched to the user that runs in the container. */ if (def->process && def->process->cwd) { ret = libcrun_safe_chdir (def->process->cwd, err); if (LIKELY (ret == 0)) chdir_done = true; else crun_error_release (err); } if (def->process && def->process->args) { *exec_path = find_executable (def->process->args[0], def->process->cwd); if (UNLIKELY (*exec_path == NULL)) { if (entrypoint_args->custom_handler == NULL && errno == ENOENT) return crun_make_error (err, errno, "executable file `%s` not found in $PATH", def->process->args[0]); } /* If it fails for any other reason, ignore the failure. We'll try again the lookup once the process switched to the use that runs in the container. This might be necessary when opening a file that is on a network file system like NFS, where CAP_DAC_OVERRIDE is not honored. */ } ret = setsid (); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "setsid"); if (has_terminal) { cleanup_close int terminal_fd = -1; fflush (stderr); terminal_fd = libcrun_set_terminal (container, err); if (UNLIKELY (terminal_fd < 0)) return terminal_fd; if (console_socket >= 0) { ret = send_fd_to_socket (console_socket, terminal_fd, err); if (UNLIKELY (ret < 0)) return ret; close_and_reset (&console_socket); } else if (entrypoint_args->has_terminal_socket_pair && console_socketpair >= 0) { ret = send_fd_to_socket (console_socketpair, terminal_fd, err); if (UNLIKELY (ret < 0)) return ret; close_and_reset (&console_socketpair); } } ret = libcrun_set_hostname (container, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_set_domainname (container, err); if (UNLIKELY (ret < 0)) return ret; if (container->container_def->linux && container->container_def->linux->personality) { ret = libcrun_set_personality (container->container_def->linux->personality, err); if (UNLIKELY (ret < 0)) return ret; } if (def->process && def->process->user) umask (def->process->user->umask_present ? def->process->user->umask : 0022); if (def->process && ! def->process->no_new_privileges) { char **seccomp_flags = NULL; size_t seccomp_flags_len = 0; cleanup_free char *seccomp_fd_payload = NULL; size_t seccomp_fd_payload_len = 0; if (def->linux && def->linux->seccomp) { seccomp_flags = def->linux->seccomp->flags; seccomp_flags_len = def->linux->seccomp->flags_len; } if (entrypoint_args->seccomp_receiver_fd >= 0) { ret = get_seccomp_receiver_fd_payload (container, "creating", own_pid, &seccomp_fd_payload, &seccomp_fd_payload_len, err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_apply_seccomp (entrypoint_args->seccomp_fd, entrypoint_args->seccomp_receiver_fd, seccomp_fd_payload, seccomp_fd_payload_len, seccomp_flags, seccomp_flags_len, err); if (UNLIKELY (ret < 0)) return ret; close_and_reset (&entrypoint_args->seccomp_fd); close_and_reset (&entrypoint_args->seccomp_receiver_fd); } capabilities = def->process ? def->process->capabilities : NULL; no_new_privs = def->process ? def->process->no_new_privileges : 1; ret = libcrun_set_caps (capabilities, container->container_uid, container->container_gid, no_new_privs, err); if (UNLIKELY (ret < 0)) return ret; if (UNLIKELY (def->process && def->process->args && *exec_path == NULL)) { *exec_path = find_executable (def->process->args[0], def->process->cwd); if (UNLIKELY (*exec_path == NULL)) { /* If a custom handler is used, pass argv0 as specified. e.g. with wasm the file could miss the +x bit. */ if (entrypoint_args->custom_handler && ! is_empty_string (def->process->args[0])) *exec_path = xstrdup (def->process->args[0]); else if (errno == ENOENT) return crun_make_error (err, errno, "executable file `%s` not found in $PATH", def->process->args[0]); else return crun_make_error (err, errno, "open executable"); } } /* The chdir was not already performed, so try again now after switching to the UID/GID in the container. */ if (! chdir_done && def->process && def->process->cwd) { ret = libcrun_safe_chdir (def->process->cwd, err); if (UNLIKELY (ret < 0)) return ret; } if (notify_socket && putenv (notify_socket) < 0) return crun_make_error (err, errno, "putenv `%s`", notify_socket); return 0; } static int open_hooks_output (libcrun_container_t *container, int *out_fd, int *err_fd, libcrun_error_t *err) { const char *annotation; *err_fd = *out_fd = -1; annotation = find_annotation (container, "run.oci.hooks.stdout"); if (annotation) { *out_fd = TEMP_FAILURE_RETRY (open (annotation, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0700)); if (UNLIKELY (*out_fd < 0)) return crun_make_error (err, errno, "open `%s`", annotation); } annotation = find_annotation (container, "run.oci.hooks.stderr"); if (annotation) { *err_fd = TEMP_FAILURE_RETRY (open (annotation, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0700)); if (UNLIKELY (*err_fd < 0)) return crun_make_error (err, errno, "open `%s`", annotation); } return 0; } static void rewrite_argv (char **argv, int argc, const char *name, char **args, size_t args_len) { cleanup_free char *decorated_name = NULL; size_t available_len = argv[argc - 1] - argv[0] + strlen (argv[argc - 1]) + 1; cleanup_free char *new_argv = NULL; size_t i, so_far = 0, needed = 0; needed = xasprintf (&decorated_name, "[libcrun:%s]", name) + 1; for (i = 0; i < args_len; i++) needed += strlen (args[i]) + 1; new_argv = xmalloc0 (needed + 1); strcpy (new_argv, decorated_name); so_far = strlen (decorated_name) + 1; if (available_len >= needed) { for (i = 0; i < args_len; i++) { strcpy (new_argv + so_far, args[i]); so_far += strlen (args[i]) + 1; } } if (so_far >= available_len) so_far = available_len - 1; memset (argv[0], 0, available_len); memcpy (argv[0], new_argv, so_far); } /* Entrypoint to the container. */ static int container_init (void *args, char *notify_socket, int sync_socket, libcrun_error_t *err) { struct container_entrypoint_s *entrypoint_args = args; int ret; runtime_spec_schema_config_schema *def = entrypoint_args->container->container_def; cleanup_free char *exec_path = NULL; __attribute__ ((unused)) cleanup_free char *notify_socket_cleanup = notify_socket; pid_t own_pid = 0; entrypoint_args->sync_socket = sync_socket; crun_set_output_handler (log_write_to_sync_socket, args, false); /* sync receive own pid. */ ret = TEMP_FAILURE_RETRY (read (sync_socket, &own_pid, sizeof (own_pid))); if (UNLIKELY (ret != sizeof (own_pid))) { if (ret >= 0) errno = 0; return crun_make_error (err, errno, "read from sync socket"); } ret = container_init_setup (args, own_pid, notify_socket, sync_socket, &exec_path, err); if (UNLIKELY (ret < 0)) { /* If it fails to write the error using the sync socket, then fallback to stderr. */ if (sync_socket_write_error (sync_socket, err) < 0) return ret; crun_error_release (err); return ret; } entrypoint_args->sync_socket = -1; ret = unblock_signals (err); if (UNLIKELY (ret < 0)) return ret; /* sync 4. */ ret = sync_socket_send_sync (sync_socket, false, err); if (UNLIKELY (ret < 0)) return ret; close_and_reset (&sync_socket); if (entrypoint_args->context->fifo_exec_wait_fd >= 0) { char buffer[1]; fd_set read_set; cleanup_close int fd = entrypoint_args->context->fifo_exec_wait_fd; entrypoint_args->context->fifo_exec_wait_fd = -1; FD_ZERO (&read_set); FD_SET (fd, &read_set); do { ret = select (fd + 1, &read_set, NULL, NULL, NULL); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "select"); ret = TEMP_FAILURE_RETRY (read (fd, buffer, sizeof (buffer))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "read from the exec fifo"); } while (ret == 0); close_and_reset (&entrypoint_args->context->fifo_exec_wait_fd); } crun_set_output_handler (log_write_to_stderr, NULL, false); if (def->process && def->process->no_new_privileges) { char **seccomp_flags = NULL; size_t seccomp_flags_len = 0; cleanup_free char *seccomp_fd_payload = NULL; size_t seccomp_fd_payload_len = 0; if (def->linux && def->linux->seccomp) { seccomp_flags = def->linux->seccomp->flags; seccomp_flags_len = def->linux->seccomp->flags_len; } if (entrypoint_args->seccomp_receiver_fd >= 0) { ret = get_seccomp_receiver_fd_payload (entrypoint_args->container, "creating", own_pid, &seccomp_fd_payload, &seccomp_fd_payload_len, err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_apply_seccomp (entrypoint_args->seccomp_fd, entrypoint_args->seccomp_receiver_fd, seccomp_fd_payload, seccomp_fd_payload_len, seccomp_flags, seccomp_flags_len, err); if (UNLIKELY (ret < 0)) return ret; close_and_reset (&entrypoint_args->seccomp_fd); close_and_reset (&entrypoint_args->seccomp_receiver_fd); } if (UNLIKELY (def->process == NULL)) return crun_make_error (err, 0, "block `process` not found"); if (UNLIKELY (exec_path == NULL)) return crun_make_error (err, 0, "executable path not specified"); if (def->hooks && def->hooks->start_container_len) { libcrun_container_t *container = entrypoint_args->container; ret = do_hooks (def, 0, container->context->id, false, NULL, "starting", (hook **) def->hooks->start_container, def->hooks->start_container_len, entrypoint_args->hooks_out_fd, entrypoint_args->hooks_err_fd, err); if (UNLIKELY (ret != 0)) return ret; /* Seek stdout/stderr to the end. If the hooks were using the same files, the container process overwrites what was previously written. */ (void) lseek (1, 0, SEEK_END); (void) lseek (2, 0, SEEK_END); } if (entrypoint_args->custom_handler) { /* Files marked with O_CLOEXEC are closed at execv time, so make sure they are closed now. This is a best effort operation, because the seccomp filter is already in place and it could stop some syscalls used by mark_or_close_fds_ge_than. */ ret = mark_or_close_fds_ge_than (entrypoint_args->context->preserve_fds + 3, true, err); if (UNLIKELY (ret < 0)) crun_error_release (err); prctl (PR_SET_NAME, entrypoint_args->custom_handler->vtable->name); if (entrypoint_args->context->argv) { rewrite_argv (entrypoint_args->context->argv, entrypoint_args->context->argc, entrypoint_args->custom_handler->vtable->name, def->process->args, def->process->args_len); /* It is a quite destructive operation as we might be referencing data from the old argv, so make sure the context is not reused. */ entrypoint_args->context->argv = NULL; entrypoint_args->context = NULL; } ret = libcrun_set_selinux_label (def->process, true, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_set_apparmor_profile (def->process, true, err); if (UNLIKELY (ret < 0)) return ret; ret = entrypoint_args->custom_handler->vtable->run_func (entrypoint_args->custom_handler->cookie, entrypoint_args->container, exec_path, def->process->args); if (ret != 0) return crun_make_error (err, ret, "exec container process failed with handler as `%s`", entrypoint_args->custom_handler->vtable->name); return ret; } /* Attempt to close all the files that are not needed to prevent execv to have access to them. This is a best effort operation since the seccomp profile is already in place now and might block some of the syscalls needed by mark_or_close_fds_ge_than. */ ret = mark_or_close_fds_ge_than (entrypoint_args->context->preserve_fds + 3, true, err); if (UNLIKELY (ret < 0)) crun_error_release (err); TEMP_FAILURE_RETRY (execv (exec_path, def->process->args)); if (errno == ENOENT) return crun_make_error (err, errno, "exec container process (missing dynamic library?) `%s`", exec_path); return crun_make_error (err, errno, "exec container process `%s`", exec_path); } static int read_container_config_from_state (libcrun_container_t **container, const char *state_root, const char *id, libcrun_error_t *err) { cleanup_free char *config_file = NULL; cleanup_free char *dir = NULL; int ret; *container = NULL; dir = libcrun_get_state_directory (state_root, id); if (UNLIKELY (dir == NULL)) return crun_make_error (err, 0, "cannot get state directory from `%s`", state_root); ret = append_paths (&config_file, err, dir, "config.json", NULL); if (UNLIKELY (ret < 0)) return ret; *container = libcrun_container_load_from_file (config_file, err); if (*container == NULL) return crun_make_error (err, 0, "error loading `%s`", config_file); return 0; } static int run_poststop_hooks (libcrun_context_t *context, libcrun_container_t *container, runtime_spec_schema_config_schema *def, libcrun_container_status_t *status, const char *state_root, const char *id, libcrun_error_t *err) { cleanup_container libcrun_container_t *container_cleanup = NULL; int ret; if (def == NULL) { if (container == NULL) { ret = read_container_config_from_state (&container_cleanup, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; container = container_cleanup; } def = container->container_def; } if (def->hooks && def->hooks->poststop_len) { cleanup_close int hooks_out_fd = -1; cleanup_close int hooks_err_fd = -1; if (container == NULL) { ret = read_container_config_from_state (&container_cleanup, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; container = container_cleanup; } ret = open_hooks_output (container, &hooks_out_fd, &hooks_err_fd, err); if (UNLIKELY (ret < 0)) return ret; ret = do_hooks (def, 0, id, true, status->bundle, "stopped", (hook **) def->hooks->poststop, def->hooks->poststop_len, hooks_out_fd, hooks_err_fd, err); if (UNLIKELY (ret < 0)) crun_error_write_warning_and_release (context->output_handler_arg, &err); } return 0; } static bool has_new_pid_namespace (runtime_spec_schema_config_schema *def) { size_t i; if (def->linux == NULL || def->linux->namespaces == NULL) return false; for (i = 0; i < def->linux->namespaces_len; i++) { if (strcmp (def->linux->namespaces[i]->type, "pid") == 0 && def->linux->namespaces[i]->path == NULL) return true; } return false; } static int container_delete_internal (libcrun_context_t *context, runtime_spec_schema_config_schema *def, const char *id, bool force, bool killall, libcrun_error_t *err) { cleanup_cgroup_status struct libcrun_cgroup_status *cgroup_status = NULL; cleanup_container_status libcrun_container_status_t status = {}; cleanup_container libcrun_container_t *container = NULL; const char *state_root = context->state_root; int ret; ret = libcrun_read_container_status (&status, state_root, id, err); if (UNLIKELY (ret < 0)) { if (force && crun_error_get_errno (err) == ENOENT) { libcrun_error_t tmp_err = NULL; crun_error_release (err); libcrun_container_delete_status (state_root, id, &tmp_err); crun_error_release (&tmp_err); return 0; } return libcrun_container_delete_status (state_root, id, err); } cgroup_status = libcrun_cgroup_make_status (&status); if (! force) { ret = libcrun_is_container_running (&status, err); if (UNLIKELY (ret < 0)) return ret; if (ret == 1) { ret = libcrun_status_has_read_exec_fifo (state_root, id, err); if (UNLIKELY (ret < 0)) return ret; if (ret == 0) return crun_make_error (err, 0, "the container `%s` is not in `created` or `stopped` state", id); /* If the container is in "created" state, then do the equivalent of delete --force. */ killall = force = true; } } if (killall && force) { if (def == NULL) { ret = read_container_config_from_state (&container, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; def = container->container_def; } /* If the container has a pid namespace, it is enough to kill the first process (pid=1 in the namespace). */ if (has_new_pid_namespace (def)) { ret = libcrun_kill_linux (&status, SIGKILL, err); if (UNLIKELY (ret < 0)) { errno = crun_error_get_errno (err); /* pidfd_open returns EINVAL if the process is not a thread-group leader. In our case it means the process already exited, so handle as ESRCH. */ if (errno != ESRCH && errno != EINVAL) return ret; crun_error_release (err); } } else if (status.cgroup_path) { ret = libcrun_cgroup_killall (cgroup_status, SIGKILL, err); if (UNLIKELY (ret < 0)) return 0; } } if (! is_empty_string (status.intelrdt)) { ret = libcrun_destroy_intelrdt (status.intelrdt, err); if (UNLIKELY (ret < 0)) crun_error_write_warning_and_release (context->output_handler_arg, &err); } if (status.cgroup_path) { ret = libcrun_cgroup_destroy (cgroup_status, err); if (UNLIKELY (ret < 0)) crun_error_write_warning_and_release (context->output_handler_arg, &err); } ret = run_poststop_hooks (context, container, def, &status, state_root, id, err); if (UNLIKELY (ret < 0)) crun_error_write_warning_and_release (context->output_handler_arg, &err); return libcrun_container_delete_status (state_root, id, err); } int libcrun_container_delete (libcrun_context_t *context, runtime_spec_schema_config_schema *def, const char *id, bool force, libcrun_error_t *err) { return container_delete_internal (context, def, id, force, true, err); } int libcrun_container_kill (libcrun_context_t *context, const char *id, const char *signal, libcrun_error_t *err) { int sig, ret; const char *state_root = context->state_root; cleanup_container_status libcrun_container_status_t status = {}; sig = str2sig (signal); if (UNLIKELY (sig < 0)) return crun_make_error (err, 0, "unknown signal `%s`", signal); ret = libcrun_read_container_status (&status, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; return libcrun_kill_linux (&status, sig, err); } int libcrun_container_killall (libcrun_context_t *context, const char *id, const char *signal, libcrun_error_t *err) { int sig, ret; const char *state_root = context->state_root; cleanup_container_status libcrun_container_status_t status = {}; cleanup_cgroup_status struct libcrun_cgroup_status *cgroup_status = NULL; sig = str2sig (signal); if (UNLIKELY (sig < 0)) return crun_make_error (err, 0, "unknown signal `%s`", signal); ret = libcrun_read_container_status (&status, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; cgroup_status = libcrun_cgroup_make_status (&status); ret = libcrun_cgroup_killall (cgroup_status, sig, err); if (UNLIKELY (ret < 0)) return ret; return 0; } static int write_container_status (libcrun_container_t *container, libcrun_context_t *context, pid_t pid, struct libcrun_cgroup_status *cgroup_status, libcrun_error_t *err) { cleanup_free char *cwd = getcwd (NULL, 0); cleanup_free char *owner = get_user_name (geteuid ()); cleanup_free char *intelrdt = NULL; char *external_descriptors = libcrun_get_external_descriptors (container); char *rootfs = container->container_def->root ? container->container_def->root->path : ""; char created[35]; if (container_has_intelrdt (container)) { bool explicit = false; const char *tmp; tmp = libcrun_get_intelrdt_name (context->id, container, &explicit); if (tmp == NULL) return crun_make_error (err, 0, "internal error: cannot get intelrdt name"); /* It is stored in the status only for cleanup purposes. Delete the group only if it was not explicitly set. */ if (! explicit) intelrdt = xstrdup (tmp); } libcrun_container_status_t status = { .pid = pid, .rootfs = rootfs, .bundle = cwd, .created = created, .owner = owner, .intelrdt = intelrdt, .systemd_cgroup = context->systemd_cgroup, .detached = context->detach, .external_descriptors = external_descriptors, .cgroup_path = NULL, .scope = NULL, }; get_current_timestamp (created, sizeof (created)); if (cwd == NULL) OOM (); if (cgroup_status) { int ret; ret = libcrun_cgroup_get_status (cgroup_status, &status, err); if (UNLIKELY (ret < 0)) return ret; } if (external_descriptors == NULL) return crun_make_error (err, 0, "invalid internal state. No external descriptors found"); return libcrun_write_container_status (context->state_root, context->id, &status, err); } static int reap_subprocesses (pid_t main_process, int *main_process_exit, int *last_process, libcrun_error_t *err) { *last_process = 0; while (1) { int status; int r = waitpid_ignore_stopped (-1, &status, WNOHANG); if (r < 0) { if (errno == EINTR) continue; if (errno == ECHILD) { *last_process = 1; return 0; } return crun_make_error (err, errno, "waitpid"); } if (r == 0) break; if (r != main_process) continue; *main_process_exit = get_process_exit_status (status); } return 0; } static int handle_notify_socket (int notify_socketfd, libcrun_error_t *err) { #ifdef HAVE_SYSTEMD int ret; char buf[256]; const char *ready_str = "READY=1"; ret = recvfrom (notify_socketfd, buf, sizeof (buf) - 1, 0, NULL, NULL); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "recvfrom notify socket"); buf[ret] = '\0'; if (strstr (buf, ready_str)) { ret = sd_notify (0, ready_str); if (UNLIKELY (ret < 0)) return crun_make_error (err, -ret, "sd_notify"); # if HAVE_SD_NOTIFY_BARRIER /* Hard-code a 30 seconds timeout. Ignore errors. */ sd_notify_barrier (0, 30 * 1000000); # endif return 1; } return 0; #else (void) notify_socketfd; (void) err; return 1; #endif } struct wait_for_process_args { pid_t pid; libcrun_context_t *context; int terminal_fd; int notify_socket; int *container_ready_fd; int seccomp_notify_fd; const char *seccomp_notify_plugins; }; static int wait_for_process (struct wait_for_process_args *args, libcrun_error_t *err) { cleanup_close int epollfd = -1; cleanup_close int signalfd = -1; int ret, container_exit_code = 0, last_process; sigset_t mask; int fds[10]; int levelfds[10]; int levelfds_len = 0; int fds_len = 0; cleanup_seccomp_notify_context struct seccomp_notify_context_s *seccomp_notify_ctx = NULL; container_exit_code = 0; if (args == NULL || args->context == NULL) return crun_make_error (err, 0, "internal error: context is empty"); if (args->context->pid_file) { char buf[32]; size_t buf_len = snprintf (buf, sizeof (buf), "%d", args->pid); ret = write_file_with_flags (args->context->pid_file, O_CREAT | O_TRUNC, buf, buf_len, err); if (UNLIKELY (ret < 0)) return ret; } /* Also exit if there is nothing more to wait for. */ if (args->context->detach && args->notify_socket < 0) return 0; if (args->container_ready_fd) { ret = 0; TEMP_FAILURE_RETRY (write (*args->container_ready_fd, &ret, sizeof (ret))); close_and_reset (args->container_ready_fd); } sigfillset (&mask); ret = sigprocmask (SIG_BLOCK, &mask, NULL); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "sigprocmask"); signalfd = create_signalfd (&mask, err); if (UNLIKELY (signalfd < 0)) return signalfd; ret = reap_subprocesses (args->pid, &container_exit_code, &last_process, err); if (UNLIKELY (ret < 0)) return ret; if (last_process) return container_exit_code; if (args->seccomp_notify_fd >= 0) { cleanup_free char *state_root = NULL; cleanup_free char *oci_config_path = NULL; struct libcrun_load_seccomp_notify_conf_s conf; memset (&conf, 0, sizeof conf); state_root = libcrun_get_state_directory (args->context->state_root, args->context->id); if (UNLIKELY (state_root == NULL)) return crun_make_error (err, 0, "cannot get state directory"); ret = append_paths (&oci_config_path, err, state_root, "config.json", NULL); if (UNLIKELY (ret < 0)) return ret; conf.runtime_root_path = state_root; conf.name = args->context->id; conf.bundle_path = args->context->bundle; conf.oci_config_path = oci_config_path; ret = set_blocking_fd (args->seccomp_notify_fd, 0, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_load_seccomp_notify_plugins (&seccomp_notify_ctx, args->seccomp_notify_plugins, &conf, err); if (UNLIKELY (ret < 0)) return ret; fds[fds_len++] = args->seccomp_notify_fd; } fds[fds_len++] = signalfd; if (args->notify_socket >= 0) fds[fds_len++] = args->notify_socket; if (args->terminal_fd >= 0) { fds[fds_len++] = 0; levelfds[levelfds_len++] = args->terminal_fd; } fds[fds_len++] = -1; levelfds[levelfds_len++] = -1; epollfd = epoll_helper (fds, levelfds, err); if (UNLIKELY (epollfd < 0)) return epollfd; while (1) { struct signalfd_siginfo si; struct winsize ws; ssize_t res; struct epoll_event events[10]; int i, nr_events; nr_events = TEMP_FAILURE_RETRY (epoll_wait (epollfd, events, 10, -1)); if (UNLIKELY (nr_events < 0)) return crun_make_error (err, errno, "epoll_wait"); for (i = 0; i < nr_events; i++) { if (events[i].data.fd == 0) { ret = copy_from_fd_to_fd (0, args->terminal_fd, 0, err); if (UNLIKELY (ret < 0)) return crun_error_wrap (err, "copy to terminal fd"); } else if (events[i].data.fd == args->seccomp_notify_fd) { ret = libcrun_seccomp_notify_plugins (seccomp_notify_ctx, args->seccomp_notify_fd, err); if (UNLIKELY (ret < 0)) return ret; } else if (events[i].data.fd == args->terminal_fd) { ret = set_blocking_fd (args->terminal_fd, 0, err); if (UNLIKELY (ret < 0)) return crun_error_wrap (err, "set terminal fd not blocking"); ret = copy_from_fd_to_fd (args->terminal_fd, 1, 1, err); if (UNLIKELY (ret < 0)) return crun_error_wrap (err, "copy from terminal fd"); ret = set_blocking_fd (args->terminal_fd, 1, err); if (UNLIKELY (ret < 0)) return crun_error_wrap (err, "set terminal fd blocking"); } else if (events[i].data.fd == args->notify_socket) { ret = handle_notify_socket (args->notify_socket, err); if (UNLIKELY (ret < 0)) return ret; if (ret && args->context->detach) return 0; } else if (events[i].data.fd == signalfd) { res = TEMP_FAILURE_RETRY (read (signalfd, &si, sizeof (si))); if (UNLIKELY (res < 0)) return crun_make_error (err, errno, "read from signalfd"); if (si.ssi_signo == SIGCHLD) { ret = reap_subprocesses (args->pid, &container_exit_code, &last_process, err); if (UNLIKELY (ret < 0)) return ret; if (last_process) return container_exit_code; } else if (si.ssi_signo == SIGWINCH) { if (UNLIKELY (args->terminal_fd < 0)) return 0; ret = ioctl (0, TIOCGWINSZ, &ws); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "copy terminal size from stdin"); ret = ioctl (args->terminal_fd, TIOCSWINSZ, &ws); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "copy terminal size to pty"); } else { /* Send any other signal to the child process. */ ret = kill (args->pid, si.ssi_signo); } } else { return crun_make_error (err, 0, "unknown fd from epoll_wait"); } } } return 0; } static void flush_fd_to_err (libcrun_context_t *context, int terminal_fd) { char buf[256]; int flags; if (terminal_fd < 0 || stderr == NULL) return; flags = fcntl (terminal_fd, F_GETFL, 0); if (flags == -1) return; if (fcntl (terminal_fd, F_SETFL, flags | O_NONBLOCK) < 0) return; for (;;) { int ret = TEMP_FAILURE_RETRY (read (terminal_fd, buf, sizeof (buf) - 1)); if (ret <= 0) break; buf[ret] = '\0'; if (context->output_handler) context->output_handler (0, buf, false, context->output_handler_arg); } (void) fcntl (terminal_fd, F_SETFL, flags); fflush (stderr); fsync (1); fsync (2); } static int cleanup_watch (libcrun_context_t *context, runtime_spec_schema_config_schema *def, struct libcrun_cgroup_status *cgroup_status, pid_t init_pid, int sync_socket, int terminal_fd, libcrun_error_t *err) { const char *oom_message = NULL; libcrun_error_t tmp_err = NULL; int ret; if (init_pid) { /* Try to detect whether the cgroup has a OOM. */ if (cgroup_status) { int has_oom; has_oom = libcrun_cgroup_has_oom (cgroup_status, &tmp_err); if (has_oom > 0) oom_message = "OOM: the memory limit could be too low"; else if (has_oom < 0) { /* If the detection has failed for any reason, e.g. the cgroup was already deleted by the time it was checked, just ignore the failure. */ crun_error_release (&tmp_err); } } /* If the OOM wasn't detected, look into the static configuration. */ if (oom_message == NULL && is_memory_limit_too_low (def)) oom_message = "the memory limit could be too low"; kill (init_pid, SIGKILL); waitpid_ignore_stopped (init_pid, NULL, 0); } ret = sync_socket_wait_sync (context, sync_socket, true, &tmp_err); if (UNLIKELY (ret < 0)) { crun_error_release (err); *err = tmp_err; } if (terminal_fd >= 0) flush_fd_to_err (context, terminal_fd); if (oom_message) return crun_error_wrap (err, "%s", oom_message); return -1; } /* Find the uid:gid that is mapped to root inside the container user namespace. */ void get_root_in_the_userns (runtime_spec_schema_config_schema *def, uid_t host_uid, gid_t host_gid, uid_t *uid, gid_t *gid) { *uid = -1; *gid = -1; /* Not root in the namespace. */ if (host_uid) return; if (def->linux && def->linux->uid_mappings) { size_t i; for (i = 0; i < def->linux->uid_mappings_len; i++) if (def->linux->uid_mappings[i]->container_id == 0) { *uid = def->linux->uid_mappings[i]->host_id; break; } } if (def->linux && def->linux->gid_mappings) { size_t i; for (i = 0; i < def->linux->gid_mappings_len; i++) if (def->linux->gid_mappings[i]->container_id == 0) { *gid = def->linux->gid_mappings[i]->host_id; break; } } /* If the uid and the gid are not changed, do not attempt any chown. */ if (*uid == host_uid && *gid == host_gid) *uid = *gid = -1; } static int get_seccomp_receiver_fd (libcrun_container_t *container, int *fd, int *self_receiver_fd, const char **plugins, libcrun_error_t *err) { const char *tmp; runtime_spec_schema_config_schema *def = container->container_def; *fd = -1; *self_receiver_fd = -1; tmp = find_annotation (container, "run.oci.seccomp.plugins"); if (tmp) { int fds[2]; int ret; ret = create_socket_pair (fds, err); if (UNLIKELY (ret < 0)) return crun_error_wrap (err, "create socket pair"); *fd = fds[0]; *self_receiver_fd = fds[1]; *plugins = tmp; } if (def && def->linux && def->linux->seccomp && def->linux->seccomp->listener_path) tmp = def->linux->seccomp->listener_path; else tmp = find_annotation (container, "run.oci.seccomp.receiver"); if (tmp == NULL) tmp = getenv ("RUN_OCI_SECCOMP_RECEIVER"); if (tmp) { if (tmp[0] != '/') return crun_make_error (err, 0, "the seccomp receiver `%s` is not an absolute path", tmp); *fd = open_unix_domain_client_socket (tmp, 0, err); if (UNLIKELY (*fd < 0)) return crun_error_wrap (err, "open seccomp receiver"); } return 0; } static int libcrun_container_run_internal (libcrun_container_t *container, libcrun_context_t *context, int *container_ready_fd, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; int ret; pid_t pid; int detach = context->detach; cleanup_cgroup_status struct libcrun_cgroup_status *cgroup_status = NULL; cleanup_close int terminal_fd = -1; cleanup_terminal void *orig_terminal = NULL; cleanup_close int sync_socket = -1; cleanup_close int notify_socket = -1; cleanup_close int socket_pair_0 = -1; cleanup_close int socket_pair_1 = -1; cleanup_close int seccomp_fd = -1; cleanup_close int console_socket_fd = -1; cleanup_close int hooks_out_fd = -1; cleanup_close int hooks_err_fd = -1; cleanup_close int own_seccomp_receiver_fd = -1; cleanup_close int seccomp_notify_fd = -1; const char *seccomp_notify_plugins = NULL; int cgroup_manager; uid_t root_uid = -1; gid_t root_gid = -1; struct libcrun_cgroup_args cg; struct container_entrypoint_s container_args = { .container = container, .context = context, .terminal_socketpair = { -1, -1 }, .console_socket_fd = -1, .hooks_out_fd = -1, .hooks_err_fd = -1, .seccomp_receiver_fd = -1, .custom_handler = NULL, }; cleanup_close int cgroup_dirfd = -1; struct libcrun_dirfd_s cgroup_dirfd_s; struct libcrun_seccomp_gen_ctx_s seccomp_gen_ctx; const char *seccomp_bpf_data = find_annotation (container, "run.oci.seccomp_bpf_data"); if (def->hooks && (def->hooks->prestart_len || def->hooks->poststart_len || def->hooks->create_runtime_len || def->hooks->create_container_len || def->hooks->start_container_len)) { ret = open_hooks_output (container, &hooks_out_fd, &hooks_err_fd, err); if (UNLIKELY (ret < 0)) return ret; container_args.hooks_out_fd = hooks_out_fd; container_args.hooks_err_fd = hooks_err_fd; } container->context = context; if (! detach || context->notify_socket) { ret = prctl (PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "set child subreaper"); } if (! context->no_new_keyring) { const char *label = NULL; if (def->process) label = def->process->selinux_label; ret = libcrun_create_keyring (container->context->id, label, err); if (UNLIKELY (ret < 0)) return ret; } if (def->process && def->process->terminal && ! detach && context->console_socket == NULL) { container_args.has_terminal_socket_pair = 1; ret = create_socket_pair (container_args.terminal_socketpair, err); if (UNLIKELY (ret < 0)) return crun_error_wrap (err, "create terminal socket"); socket_pair_0 = container_args.terminal_socketpair[0]; socket_pair_1 = container_args.terminal_socketpair[1]; } ret = block_signals (err); if (UNLIKELY (ret < 0)) return ret; umask (0); if (def->linux && (def->linux->seccomp || seccomp_bpf_data)) { unsigned int seccomp_gen_options = 0; const char *annotation; annotation = find_annotation (container, "run.oci.seccomp_fail_unknown_syscall"); if (annotation && strcmp (annotation, "0") != 0) seccomp_gen_options = LIBCRUN_SECCOMP_FAIL_UNKNOWN_SYSCALL; if (seccomp_bpf_data) seccomp_gen_options |= LIBCRUN_SECCOMP_SKIP_CACHE; libcrun_seccomp_gen_ctx_init (&seccomp_gen_ctx, container, true, seccomp_gen_options); ret = libcrun_open_seccomp_bpf (&seccomp_gen_ctx, &seccomp_fd, err); if (UNLIKELY (ret < 0)) return ret; } container_args.seccomp_fd = seccomp_fd; if (seccomp_fd >= 0) { ret = get_seccomp_receiver_fd (container, &container_args.seccomp_receiver_fd, &own_seccomp_receiver_fd, &seccomp_notify_plugins, err); if (UNLIKELY (ret < 0)) return ret; } if (context->console_socket) { console_socket_fd = open_unix_domain_client_socket (context->console_socket, 0, err); if (UNLIKELY (console_socket_fd < 0)) return crun_error_wrap (err, "open console socket"); container_args.console_socket_fd = console_socket_fd; } cgroup_manager = CGROUP_MANAGER_CGROUPFS; if (context->systemd_cgroup) cgroup_manager = CGROUP_MANAGER_SYSTEMD; else if (context->force_no_cgroup) cgroup_manager = CGROUP_MANAGER_DISABLED; /* If we are root (either on the host or in a namespace), then chown the cgroup to root in the container user namespace. */ get_root_in_the_userns (def, container->host_uid, container->host_gid, &root_uid, &root_gid); memset (&cg, 0, sizeof (cg)); cg.cgroup_path = def->linux ? def->linux->cgroups_path : ""; cg.manager = cgroup_manager; cg.id = context->id; cg.resources = def->linux ? def->linux->resources : NULL; cg.annotations = def->annotations; cg.root_uid = root_uid; cg.root_gid = root_gid; ret = libcrun_cgroup_preenter (&cg, &cgroup_dirfd, err); if (UNLIKELY (ret < 0)) return ret; cgroup_dirfd_s.dirfd = &cgroup_dirfd; cgroup_dirfd_s.joined = false; ret = libcrun_configure_handler (container_args.context->handler_manager, container_args.context, container, &(container_args.custom_handler), err); if (UNLIKELY (ret < 0)) return ret; if (container_args.custom_handler && container_args.custom_handler->vtable->modify_oci_configuration) { ret = container_args.custom_handler->vtable->modify_oci_configuration (container_args.custom_handler->cookie, container_args.context, container->container_def, err); if (UNLIKELY (ret < 0)) return ret; } pid = libcrun_run_linux_container (container, container_init, &container_args, &sync_socket, &cgroup_dirfd_s, err); if (UNLIKELY (pid < 0)) return pid; cg.pid = pid; cg.joined = cgroup_dirfd_s.joined; if (context->fifo_exec_wait_fd < 0 && context->notify_socket) { /* Do not open the notify socket here on "create". "start" will take care of it. */ ret = get_notify_fd (context, container, ¬ify_socket, err); if (UNLIKELY (ret < 0)) goto fail; } if (container_args.terminal_socketpair[1] >= 0) close_and_reset (&socket_pair_1); /* If the root in the container is different than the current root user, attempt to chown the std streams before entering the user namespace. Otherwise we might lose access to the user (as it is not mapped in the user namespace) and cannot chown them. */ if (root_uid > 0 || root_gid > 0) { ret = maybe_chown_std_streams (root_uid, root_gid, err); if (UNLIKELY (ret < 0)) goto fail; } ret = libcrun_cgroup_enter (&cg, &cgroup_status, err); if (UNLIKELY (ret < 0)) goto fail; ret = libcrun_apply_intelrdt (context->id, container, pid, LIBCRUN_INTELRDT_CREATE_UPDATE_MOVE, err); if (UNLIKELY (ret < 0)) goto fail; /* sync send own pid. */ ret = TEMP_FAILURE_RETRY (write (sync_socket, &pid, sizeof (pid))); if (UNLIKELY (ret != sizeof (pid))) { if (ret >= 0) errno = 0; crun_make_error (err, errno, "write to sync socket"); goto fail; } /* sync 1. */ ret = sync_socket_send_sync (sync_socket, true, err); if (UNLIKELY (ret < 0)) goto fail; /* sync 2. */ ret = sync_socket_wait_sync (context, sync_socket, false, err); if (UNLIKELY (ret < 0)) goto fail; ret = libcrun_cgroup_enter_finalize (&cg, cgroup_status, err); if (UNLIKELY (ret < 0)) goto fail; ret = libcrun_set_scheduler (pid, def->process, err); if (UNLIKELY (ret < 0)) goto fail; ret = libcrun_set_io_priority (pid, def->process, err); if (UNLIKELY (ret < 0)) goto fail; /* The container is waiting that we write back. In this phase we can launch the prestart hooks. */ if (def->hooks && def->hooks->prestart_len) { ret = do_hooks (def, pid, context->id, false, NULL, "created", (hook **) def->hooks->prestart, def->hooks->prestart_len, hooks_out_fd, hooks_err_fd, err); if (UNLIKELY (ret != 0)) goto fail; } if (def->hooks && def->hooks->create_runtime_len) { ret = do_hooks (def, pid, context->id, false, NULL, "created", (hook **) def->hooks->create_runtime, def->hooks->create_runtime_len, hooks_out_fd, hooks_err_fd, err); if (UNLIKELY (ret != 0)) goto fail; } if (seccomp_fd >= 0) { if (seccomp_bpf_data != NULL) { ret = libcrun_copy_seccomp (&seccomp_gen_ctx, seccomp_bpf_data, err); if (UNLIKELY (ret < 0)) goto fail; } else { ret = libcrun_generate_seccomp (&seccomp_gen_ctx, err); if (UNLIKELY (ret < 0)) goto fail; } close_and_reset (&seccomp_fd); } /* sync 3. */ ret = sync_socket_send_sync (sync_socket, true, err); if (UNLIKELY (ret < 0)) goto fail; if (def->process && def->process->terminal && ! detach && context->console_socket == NULL) { terminal_fd = receive_fd_from_socket (socket_pair_0, err); if (UNLIKELY (terminal_fd < 0)) goto fail; close_and_reset (&socket_pair_0); ret = libcrun_setup_terminal_ptmx (terminal_fd, &orig_terminal, err); if (UNLIKELY (ret < 0)) goto fail; } /* sync 4. */ ret = sync_socket_wait_sync (context, sync_socket, false, err); if (UNLIKELY (ret < 0)) goto fail; ret = close_and_reset (&sync_socket); if (UNLIKELY (ret < 0)) goto fail; ret = write_container_status (container, context, pid, cgroup_status, err); if (UNLIKELY (ret < 0)) goto fail; /* Run poststart hooks here only if the container is created using "run". For create+start, the hooks will be executed as part of the start command. */ if (context->fifo_exec_wait_fd < 0 && def->hooks && def->hooks->poststart_len) { ret = do_hooks (def, pid, context->id, true, NULL, "running", (hook **) def->hooks->poststart, def->hooks->poststart_len, hooks_out_fd, hooks_err_fd, err); if (UNLIKELY (ret < 0)) goto fail; } /* Let's receive the seccomp notify fd and handle it as part of wait_for_process(). */ if (own_seccomp_receiver_fd >= 0) { seccomp_notify_fd = receive_fd_from_socket (own_seccomp_receiver_fd, err); if (UNLIKELY (seccomp_notify_fd < 0)) goto fail; ret = close_and_reset (&own_seccomp_receiver_fd); if (UNLIKELY (ret < 0)) goto fail; } { struct wait_for_process_args args = { .pid = pid, .context = context, .terminal_fd = terminal_fd, .notify_socket = notify_socket, .container_ready_fd = container_ready_fd, .seccomp_notify_fd = seccomp_notify_fd, .seccomp_notify_plugins = seccomp_notify_plugins, }; ret = wait_for_process (&args, err); } if (! context->detach) { libcrun_error_t tmp_err = NULL; cleanup_watch (context, def, cgroup_status, 0, sync_socket, terminal_fd, &tmp_err); crun_error_release (&tmp_err); } return ret; fail: ret = cleanup_watch (context, def, cgroup_status, pid, sync_socket, terminal_fd, err); if (cgroup_status) { libcrun_error_t tmp_err = NULL; libcrun_cgroup_destroy (cgroup_status, &tmp_err); crun_error_release (&tmp_err); } return ret; } static int check_config_file (runtime_spec_schema_config_schema *def, libcrun_context_t *context, libcrun_error_t *err) { if (UNLIKELY (def->linux == NULL)) return crun_make_error (err, 0, "invalid config file, no `linux` block specified"); if (context->handler == NULL) { if (UNLIKELY (def->root == NULL)) return crun_make_error (err, 0, "invalid config file, no `root` block specified"); if (UNLIKELY (def->mounts == NULL)) return crun_make_error (err, 0, "invalid config file, no `mounts` block specified"); } return 0; } static int libcrun_copy_config_file (const char *id, const char *state_root, libcrun_container_t *container, libcrun_error_t *err) { int ret; cleanup_free char *dest_path = NULL; cleanup_free char *dir = NULL; cleanup_free char *buffer = NULL; size_t len; dir = libcrun_get_state_directory (state_root, id); if (UNLIKELY (dir == NULL)) return crun_make_error (err, 0, "cannot get state directory"); ret = append_paths (&dest_path, err, dir, "config.json", NULL); if (UNLIKELY (ret < 0)) return ret; if (container->config_file == NULL && container->config_file_content == NULL) return crun_make_error (err, 0, "config file not specified"); if (container->config_file == NULL) { ret = write_file (dest_path, container->config_file_content, strlen (container->config_file_content), err); if (UNLIKELY (ret < 0)) return ret; } else { ret = read_all_file (container->config_file, &buffer, &len, err); if (UNLIKELY (ret < 0)) return ret; ret = write_file (dest_path, buffer, len, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static void force_delete_container_status (libcrun_context_t *context, runtime_spec_schema_config_schema *def) { libcrun_error_t tmp_err = NULL; container_delete_internal (context, def, context->id, true, false, &tmp_err); crun_error_release (&tmp_err); } int libcrun_container_run (libcrun_context_t *context, libcrun_container_t *container, unsigned int options, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; int ret; int detach = context->detach; int container_ret_status[2]; cleanup_close int pipefd0 = -1; cleanup_close int pipefd1 = -1; libcrun_error_t tmp_err = NULL; container->context = context; ret = validate_options (options, LIBCRUN_RUN_OPTIONS_PREFORK | LIBCRUN_RUN_OPTIONS_KEEP, err); if (UNLIKELY (ret < 0)) return ret; ret = check_config_file (def, context, err); if (UNLIKELY (ret < 0)) return ret; if (def->process && def->process->terminal && detach && context->console_socket == NULL) return crun_make_error (err, 0, "use --console-socket with --detach when a terminal is used"); ret = libcrun_status_check_directories (context->state_root, context->id, err); if (UNLIKELY (ret < 0)) return ret; if (! detach && (options & LIBCRUN_RUN_OPTIONS_PREFORK) == 0) { ret = libcrun_copy_config_file (context->id, context->state_root, container, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_container_run_internal (container, context, NULL, err); if (! (options & LIBCRUN_RUN_OPTIONS_KEEP)) force_delete_container_status (context, def); return ret; } ret = pipe2 (container_ret_status, O_CLOEXEC); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "pipe"); pipefd0 = container_ret_status[0]; pipefd1 = container_ret_status[1]; ret = fork (); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "fork"); if (ret) { int status; close_and_reset (&pipefd1); waitpid_ignore_stopped (ret, &status, 0); ret = TEMP_FAILURE_RETRY (read (pipefd0, &status, sizeof (status))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "invalid read from sync pipe"); if (status < 0) { int errno_; char buf[512]; ret = TEMP_FAILURE_RETRY (read (pipefd0, &errno_, sizeof (errno_))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "invalid read from sync pipe"); ret = TEMP_FAILURE_RETRY (read (pipefd0, buf, sizeof (buf) - 1)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "invalid read from sync pipe"); buf[ret] = '\0'; return crun_make_error (err, errno_, "%s", buf); } return status; } close_and_reset (&pipefd0); /* forked process. */ ret = detach_process (); if (UNLIKELY (ret < 0)) libcrun_fail_with_error (errno, "detach process"); ret = libcrun_copy_config_file (context->id, context->state_root, container, &tmp_err); if (UNLIKELY (ret < 0)) goto fail; ret = libcrun_container_run_internal (container, context, NULL, &tmp_err); TEMP_FAILURE_RETRY (write (pipefd1, &ret, sizeof (ret))); if (UNLIKELY (ret < 0)) goto fail; exit (EXIT_SUCCESS); fail: if (! (options & LIBCRUN_RUN_OPTIONS_KEEP)) force_delete_container_status (context, def); if (tmp_err) { TEMP_FAILURE_RETRY (write (pipefd1, &(tmp_err->status), sizeof (tmp_err->status))); TEMP_FAILURE_RETRY (write (pipefd1, tmp_err->msg, strlen (tmp_err->msg) + 1)); crun_error_release (&tmp_err); } exit (EXIT_FAILURE); } int libcrun_container_create (libcrun_context_t *context, libcrun_container_t *container, unsigned int options, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; int ret; int container_ready_pipe[2]; cleanup_close int pipefd0 = -1; cleanup_close int pipefd1 = -1; cleanup_close int exec_fifo_fd = -1; context->detach = 1; container->context = context; ret = validate_options (options, LIBCRUN_CREATE_OPTIONS_PREFORK, err); if (UNLIKELY (ret < 0)) return ret; ret = check_config_file (def, context, err); if (UNLIKELY (ret < 0)) return ret; if (def->process && def->process->terminal && context->console_socket == NULL) return crun_make_error (err, 0, "use --console-socket with create when a terminal is used"); ret = libcrun_status_check_directories (context->state_root, context->id, err); if (UNLIKELY (ret < 0)) return ret; exec_fifo_fd = libcrun_status_create_exec_fifo (context->state_root, context->id, err); if (UNLIKELY (exec_fifo_fd < 0)) return exec_fifo_fd; context->fifo_exec_wait_fd = exec_fifo_fd; exec_fifo_fd = -1; if ((options & LIBCRUN_RUN_OPTIONS_PREFORK) == 0) { ret = libcrun_copy_config_file (context->id, context->state_root, container, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_container_run_internal (container, context, NULL, err); if (UNLIKELY (ret < 0)) force_delete_container_status (context, def); return ret; } ret = pipe2 (container_ready_pipe, O_CLOEXEC); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "pipe"); pipefd0 = container_ready_pipe[0]; pipefd1 = container_ready_pipe[1]; ret = fork (); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "fork"); if (ret) { int exit_code; close_and_reset (&pipefd1); waitpid_ignore_stopped (ret, NULL, 0); ret = TEMP_FAILURE_RETRY (read (pipefd0, &exit_code, sizeof (exit_code))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "waiting for container to be ready"); if (ret > 0) { if (exit_code != 0) { libcrun_error_t tmp_err = NULL; libcrun_container_delete (context, def, context->id, true, &tmp_err); crun_error_release (&tmp_err); } return -exit_code; } return 1; } /* forked process. */ ret = detach_process (); if (UNLIKELY (ret < 0)) libcrun_fail_with_error (errno, "detach process"); ret = libcrun_copy_config_file (context->id, context->state_root, container, err); if (UNLIKELY (ret < 0)) libcrun_fail_with_error (errno, "copy config file"); ret = libcrun_container_run_internal (container, context, &pipefd1, err); if (UNLIKELY (ret < 0)) { force_delete_container_status (context, def); libcrun_error ((*err)->status, "%s", (*err)->msg); crun_set_output_handler (log_write_to_stderr, NULL, false); } if (pipefd1 >= 0) TEMP_FAILURE_RETRY (write (pipefd1, &ret, sizeof (ret))); exit (ret ? EXIT_FAILURE : 0); } int libcrun_container_start (libcrun_context_t *context, const char *id, libcrun_error_t *err) { cleanup_container libcrun_container_t *container = NULL; const char *state_root = context->state_root; runtime_spec_schema_config_schema *def; cleanup_container_status libcrun_container_status_t status = {}; cleanup_close int fd = -1; int ret; ret = libcrun_read_container_status (&status, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_is_container_running (&status, err); if (UNLIKELY (ret < 0)) return ret; if (! ret) return crun_make_error (err, 0, "container `%s` is not running", id); ret = read_container_config_from_state (&container, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; if (context->notify_socket) { ret = get_notify_fd (context, container, &fd, err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_status_write_exec_fifo (context->state_root, id, err); if (UNLIKELY (ret < 0)) return ret; def = container->container_def; if (context->notify_socket) { if (fd >= 0) { fd_set read_set; while (1) { struct timeval timeout = { .tv_sec = 0, .tv_usec = 10000, }; FD_ZERO (&read_set); FD_SET (fd, &read_set); ret = select (fd + 1, &read_set, NULL, NULL, &timeout); if (UNLIKELY (ret < 0)) return ret; if (ret) { ret = handle_notify_socket (fd, err); if (UNLIKELY (ret < 0)) return ret; if (ret) break; } else { ret = libcrun_is_container_running (&status, err); if (UNLIKELY (ret < 0)) return ret; if (! ret) return 0; } } } } /* The container is considered running only after we got the notification from the notify_socket, if any. */ if (def->hooks && def->hooks->poststart_len) { cleanup_close int hooks_out_fd = -1; cleanup_close int hooks_err_fd = -1; ret = open_hooks_output (container, &hooks_out_fd, &hooks_err_fd, err); if (UNLIKELY (ret < 0)) return ret; ret = do_hooks (def, status.pid, context->id, true, status.bundle, "running", (hook **) def->hooks->poststart, def->hooks->poststart_len, hooks_out_fd, hooks_err_fd, err); if (UNLIKELY (ret < 0)) crun_error_release (err); } return 0; } int libcrun_get_container_state_string (const char *id, libcrun_container_status_t *status, const char *state_root, const char **container_status, int *running, libcrun_error_t *err) { int ret, has_fifo = 0; bool paused = false; ret = libcrun_is_container_running (status, err); if (UNLIKELY (ret < 0)) return ret; *running = ret; if (*running) { ret = libcrun_status_has_read_exec_fifo (state_root, id, err); if (UNLIKELY (ret < 0)) return ret; has_fifo = ret; } if (*running && ! has_fifo) { cleanup_cgroup_status struct libcrun_cgroup_status *cgroup_status = NULL; cgroup_status = libcrun_cgroup_make_status (status); ret = libcrun_cgroup_is_container_paused (cgroup_status, &paused, err); if (UNLIKELY (ret < 0)) { /* The cgroup might have been cleaned up by the time we try to read it, ignore both ENOENT and ENODEV: - ENOENT: if the open(CGROUP_PATH) fails because the cgroup was deleted. - ENODEV: if the cgroup is deleted between the open and reading the freeze status. */ errno = crun_error_get_errno (err); if (errno == ENOENT || errno == ENODEV) { crun_error_release (err); *container_status = "stopped"; return 0; } return ret; } } if (! *running) *container_status = "stopped"; else if (has_fifo) *container_status = "created"; else if (paused) *container_status = "paused"; else *container_status = "running"; return 0; } int libcrun_container_state (libcrun_context_t *context, const char *id, FILE *out, libcrun_error_t *err) { const char *const OCI_CONFIG_VERSION = "1.0.0"; libcrun_container_status_t status = {}; const char *state_root = context->state_root; const char *container_status = NULL; yajl_gen gen = NULL; const unsigned char *buf; int ret = 0; int running; size_t len; ret = libcrun_read_container_status (&status, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_get_container_state_string (id, &status, state_root, &container_status, &running, err); if (UNLIKELY (ret < 0)) goto exit; ret = 0; gen = yajl_gen_alloc (NULL); if (gen == NULL) return crun_make_error (err, 0, "yajl_gen_alloc failed"); yajl_gen_config (gen, yajl_gen_beautify, 1); yajl_gen_config (gen, yajl_gen_validate_utf8, 1); yajl_gen_map_open (gen); yajl_gen_string (gen, YAJL_STR ("ociVersion"), strlen ("ociVersion")); yajl_gen_string (gen, YAJL_STR (OCI_CONFIG_VERSION), strlen (OCI_CONFIG_VERSION)); yajl_gen_string (gen, YAJL_STR ("id"), strlen ("id")); yajl_gen_string (gen, YAJL_STR (id), strlen (id)); yajl_gen_string (gen, YAJL_STR ("pid"), strlen ("pid")); yajl_gen_integer (gen, running ? status.pid : 0); yajl_gen_string (gen, YAJL_STR ("status"), strlen ("status")); yajl_gen_string (gen, YAJL_STR (container_status), strlen (container_status)); yajl_gen_string (gen, YAJL_STR ("bundle"), strlen ("bundle")); yajl_gen_string (gen, YAJL_STR (status.bundle), strlen (status.bundle)); yajl_gen_string (gen, YAJL_STR ("rootfs"), strlen ("rootfs")); yajl_gen_string (gen, YAJL_STR (status.rootfs), strlen (status.rootfs)); yajl_gen_string (gen, YAJL_STR ("created"), strlen ("created")); yajl_gen_string (gen, YAJL_STR (status.created), strlen (status.created)); if (status.scope) { yajl_gen_string (gen, YAJL_STR ("systemd-scope"), strlen ("systemd-scope")); yajl_gen_string (gen, YAJL_STR (status.scope), strlen (status.scope)); } if (status.owner) { yajl_gen_string (gen, YAJL_STR ("owner"), strlen ("owner")); yajl_gen_string (gen, YAJL_STR (status.owner), strlen (status.owner)); } { size_t i; cleanup_free char *config_file = NULL; cleanup_container libcrun_container_t *container = NULL; cleanup_free char *dir = NULL; dir = libcrun_get_state_directory (state_root, id); if (UNLIKELY (dir == NULL)) { ret = crun_make_error (err, 0, "cannot get state directory"); goto exit; } ret = append_paths (&config_file, err, dir, "config.json", NULL); if (UNLIKELY (ret < 0)) goto exit; container = libcrun_container_load_from_file (config_file, err); if (UNLIKELY (container == NULL)) { ret = crun_make_error (err, 0, "error loading config.json"); goto exit; } if (container->container_def->annotations && container->container_def->annotations->len) { yajl_gen_string (gen, YAJL_STR ("annotations"), strlen ("annotations")); yajl_gen_map_open (gen); for (i = 0; i < container->container_def->annotations->len; i++) { const char *key = container->container_def->annotations->keys[i]; const char *val = container->container_def->annotations->values[i]; yajl_gen_string (gen, YAJL_STR (key), strlen (key)); yajl_gen_string (gen, YAJL_STR (val), strlen (val)); } yajl_gen_map_close (gen); } } yajl_gen_map_close (gen); if (yajl_gen_get_buf (gen, &buf, &len) != yajl_gen_status_ok) { ret = crun_make_error (err, 0, "error generating JSON"); goto exit; } fprintf (out, "%s\n", buf); exit: if (gen) yajl_gen_free (gen); libcrun_free_container_status (&status); return ret; } int libcrun_container_exec (libcrun_context_t *context, const char *id, runtime_spec_schema_config_schema_process *process, libcrun_error_t *err) { struct libcrun_container_exec_options_s opts; memset (&opts, 0, sizeof (opts)); opts.struct_size = sizeof (opts); opts.process = process; return libcrun_container_exec_with_options (context, id, &opts, err); } int libcrun_container_exec_process_file (libcrun_context_t *context, const char *id, const char *path, libcrun_error_t *err) { struct libcrun_container_exec_options_s opts; memset (&opts, 0, sizeof (opts)); opts.struct_size = sizeof (opts); opts.path = path; return libcrun_container_exec_with_options (context, id, &opts, err); } #define cleanup_process_schema __attribute__ ((cleanup (cleanup_process_schemap))) static inline void cleanup_process_schemap (runtime_spec_schema_config_schema_process **p) { runtime_spec_schema_config_schema_process *process = *p; if (process) (void) free_runtime_spec_schema_config_schema_process (process); } static int exec_process_entrypoint (libcrun_context_t *context, libcrun_container_t *container, runtime_spec_schema_config_schema_process *process, int pipefd1, int seccomp_fd, int seccomp_receiver_fd, struct custom_handler_instance_s *custom_handler, libcrun_error_t *err) { runtime_spec_schema_config_schema_process_capabilities *capabilities = NULL; cleanup_free char *exec_path = NULL; uid_t container_uid; gid_t container_gid; const char *cwd; bool chdir_done = false; size_t seccomp_flags_len = 0; char **seccomp_flags = NULL; pid_t own_pid = 0; size_t i; int ret; container_uid = process->user ? process->user->uid : 0; container_gid = process->user ? process->user->gid : 0; TEMP_FAILURE_RETRY (read (pipefd1, &own_pid, sizeof (own_pid))); cwd = process->cwd ? process->cwd : "/"; if (LIKELY (libcrun_safe_chdir (cwd, err) == 0)) chdir_done = true; else crun_error_release (err); ret = unblock_signals (err); if (UNLIKELY (ret < 0)) return ret; ret = clearenv (); if (UNLIKELY (ret < 0)) return ret; if (process->env_len) { for (i = 0; i < process->env_len; i++) if (putenv (process->env[i]) < 0) return crun_make_error (err, errno, "putenv `%s`", process->env[i]); } else if (container->container_def->process->env_len) { char *e; for (i = 0; i < container->container_def->process->env_len; i++) { e = container->container_def->process->env[i]; if (putenv (e) < 0) return crun_make_error (err, errno, "putenv `%s`", e); } } if (getenv ("HOME") == NULL) { ret = set_home_env (container_uid); if (UNLIKELY (ret < 0 && errno != ENOTSUP)) { setenv ("HOME", "/", 1); libcrun_warning ("cannot detect HOME environment variable, setting default"); } } ret = libcrun_set_selinux_label (process, false, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_set_apparmor_profile (process, false, err); if (UNLIKELY (ret < 0)) return ret; if (container->container_def->linux && container->container_def->linux->seccomp) { seccomp_flags = container->container_def->linux->seccomp->flags; seccomp_flags_len = container->container_def->linux->seccomp->flags_len; } exec_path = find_executable (process->args[0], process->cwd); if (UNLIKELY (exec_path == NULL)) { if (errno == ENOENT) return crun_make_error (err, errno, "executable file `%s` not found in $PATH", process->args[0]); /* If it fails for any other reason, ignore the failure. We'll try again the lookup once the process switched to the use that runs in the container. This might be necessary when opening a file that is on a network file system like NFS, where CAP_DAC_OVERRIDE is not honored. */ } if (container->container_def->linux && container->container_def->linux->personality) { ret = libcrun_set_personality (container->container_def->linux->personality, err); if (UNLIKELY (ret < 0)) return ret; } ret = mark_or_close_fds_ge_than (context->preserve_fds + 3, false, err); if (UNLIKELY (ret < 0)) return ret; if (! process->no_new_privileges) { cleanup_free char *seccomp_fd_payload = NULL; size_t seccomp_fd_payload_len = 0; if (seccomp_receiver_fd >= 0) { ret = get_seccomp_receiver_fd_payload (container, "running", own_pid, &seccomp_fd_payload, &seccomp_fd_payload_len, err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_apply_seccomp (seccomp_fd, seccomp_receiver_fd, seccomp_fd_payload, seccomp_fd_payload_len, seccomp_flags, seccomp_flags_len, err); if (UNLIKELY (ret < 0)) return ret; close_and_reset (&seccomp_fd); close_and_reset (&seccomp_receiver_fd); } ret = libcrun_container_setgroups (container, process, err); if (UNLIKELY (ret < 0)) return ret; ret = maybe_chown_std_streams (container_uid, container_gid, err); if (UNLIKELY (ret < 0)) return ret; if (process->capabilities) capabilities = process->capabilities; else if (container->container_def->process) capabilities = container->container_def->process->capabilities; ret = libcrun_set_caps (capabilities, container_uid, container_gid, process->no_new_privileges, err); if (UNLIKELY (ret < 0)) return ret; if (UNLIKELY (exec_path == NULL)) { exec_path = find_executable (process->args[0], process->cwd); if (UNLIKELY (exec_path == NULL)) { if (errno == ENOENT) return crun_make_error (err, errno, "executable file `%s` not found in $PATH", process->args[0]); return crun_make_error (err, errno, "open executable"); } } if (UNLIKELY ((! chdir_done) && libcrun_safe_chdir (cwd, err) < 0)) libcrun_fail_with_error ((*err)->status, "%s", (*err)->msg); if (process->no_new_privileges) { cleanup_free char *seccomp_fd_payload = NULL; size_t seccomp_fd_payload_len = 0; if (seccomp_receiver_fd >= 0) { ret = get_seccomp_receiver_fd_payload (container, "running", own_pid, &seccomp_fd_payload, &seccomp_fd_payload_len, err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_apply_seccomp (seccomp_fd, seccomp_receiver_fd, seccomp_fd_payload, seccomp_fd_payload_len, seccomp_flags, seccomp_flags_len, err); if (UNLIKELY (ret < 0)) return ret; close_and_reset (&seccomp_fd); close_and_reset (&seccomp_receiver_fd); } if (process->user) umask (process->user->umask_present ? process->user->umask : 0022); TEMP_FAILURE_RETRY (write (pipefd1, "0", 1)); TEMP_FAILURE_RETRY (close (pipefd1)); pipefd1 = -1; if (custom_handler) { if (custom_handler->vtable->exec_func == NULL) return crun_make_error (err, 0, "the handler does not support exec"); ret = custom_handler->vtable->exec_func (custom_handler->cookie, container, exec_path, process->args); if (UNLIKELY (ret < 0)) return ret; _exit (EXIT_FAILURE); return 0; } /* Attempt to close all the files that are not needed to prevent execv to have access to them. This is a best effort operation, because the seccomp filter is already in place and it could stop some syscalls used by mark_or_close_fds_ge_than. */ ret = mark_or_close_fds_ge_than (context->preserve_fds + 3, true, err); if (UNLIKELY (ret < 0)) crun_error_release (err); TEMP_FAILURE_RETRY (execv (exec_path, process->args)); libcrun_fail_with_error (errno, "exec"); _exit (EXIT_FAILURE); return 0; } int libcrun_container_exec_with_options (libcrun_context_t *context, const char *id, struct libcrun_container_exec_options_s *opts, libcrun_error_t *err) { cleanup_custom_handler_instance struct custom_handler_instance_s *custom_handler = NULL; int container_status, ret; bool container_paused = false; pid_t pid; libcrun_container_status_t status = {}; const char *state_root = context->state_root; cleanup_close int terminal_fd = -1; cleanup_close int seccomp_fd = -1; cleanup_terminal void *orig_terminal = NULL; cleanup_free char *config_file = NULL; cleanup_container libcrun_container_t *container = NULL; cleanup_free char *dir = NULL; int container_ret_status[2]; cleanup_close int pipefd0 = -1; cleanup_close int pipefd1 = -1; cleanup_close int seccomp_receiver_fd = -1; cleanup_close int own_seccomp_receiver_fd = -1; cleanup_close int seccomp_notify_fd = -1; const char *seccomp_notify_plugins = NULL; __attribute__ ((unused)) cleanup_process_schema runtime_spec_schema_config_schema_process *process_cleanup = NULL; runtime_spec_schema_config_schema_process *process = opts->process; struct libcrun_seccomp_gen_ctx_s seccomp_gen_ctx; char b; ret = libcrun_read_container_status (&status, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_is_container_running (&status, err); if (UNLIKELY (ret < 0)) return ret; container_status = ret; dir = libcrun_get_state_directory (state_root, id); if (UNLIKELY (dir == NULL)) return crun_make_error (err, 0, "cannot get state directory"); ret = append_paths (&config_file, err, dir, "config.json", NULL); if (UNLIKELY (ret < 0)) return ret; container = libcrun_container_load_from_file (config_file, err); if (container == NULL) return crun_make_error (err, 0, "error loading config.json"); container->context = context; if (container_status == 0) return crun_make_error (err, 0, "the container `%s` is not running", id); { cleanup_cgroup_status struct libcrun_cgroup_status *cgroup_status = NULL; cgroup_status = libcrun_cgroup_make_status (&status); ret = libcrun_cgroup_is_container_paused (cgroup_status, &container_paused, err); if (UNLIKELY (ret < 0)) return ret; } if (UNLIKELY (container_paused)) return crun_make_error (err, 0, "the container `%s` is paused", id); ret = libcrun_configure_handler (context->handler_manager, context, container, &custom_handler, err); if (UNLIKELY (ret < 0)) return ret; ret = block_signals (err); if (UNLIKELY (ret < 0)) return ret; libcrun_seccomp_gen_ctx_init (&seccomp_gen_ctx, container, false, 0); ret = libcrun_open_seccomp_bpf (&seccomp_gen_ctx, &seccomp_fd, err); if (UNLIKELY (ret < 0)) return ret; if (seccomp_fd >= 0) { ret = get_seccomp_receiver_fd (container, &seccomp_receiver_fd, &own_seccomp_receiver_fd, &seccomp_notify_plugins, err); if (UNLIKELY (ret < 0)) return ret; } if (sizeof (*opts) != opts->struct_size) return crun_make_error (err, EINVAL, "invalid libcrun_container_exec_options_s struct"); if (opts->path) { struct parser_context ctx = { 0, stderr }; cleanup_free char *content = NULL; parser_error parser_err = NULL; yajl_val tree = NULL; size_t len; if (process) return crun_make_error (err, EINVAL, "cannot specify both exec file and options"); ret = read_all_file (opts->path, &content, &len, err); if (UNLIKELY (ret < 0)) return ret; ret = parse_json_file (&tree, content, &ctx, err); if (UNLIKELY (ret < 0)) return ret; process = make_runtime_spec_schema_config_schema_process (tree, &ctx, &parser_err); if (UNLIKELY (process == NULL)) { ret = crun_make_error (err, errno, "cannot parse process file: `%s`", parser_err); free (parser_err); if (tree) yajl_tree_free (tree); return ret; } free (parser_err); if (tree) yajl_tree_free (tree); process_cleanup = process; } /* This must be done before we enter a user namespace. */ ret = libcrun_set_rlimits (process->rlimits, process->rlimits_len, err); if (UNLIKELY (ret < 0)) return ret; ret = pipe2 (container_ret_status, O_CLOEXEC); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "pipe"); pipefd0 = container_ret_status[0]; pipefd1 = container_ret_status[1]; /* If the new process block doesn't specify a SELinux label, AppArmor profile or user, then use the configuration from the original config file. */ if (container->container_def->process) { if (process->selinux_label == NULL && container->container_def->process->selinux_label) process->selinux_label = xstrdup (container->container_def->process->selinux_label); if (process->apparmor_profile == NULL && container->container_def->process->apparmor_profile) process->apparmor_profile = xstrdup (container->container_def->process->apparmor_profile); if (process->user == NULL && container->container_def->process->user) process->user = container->container_def->process->user; } ret = initialize_security (process, err); if (UNLIKELY (ret < 0)) return ret; ret = prctl (PR_SET_DUMPABLE, 0, 0, 0, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "prctl (PR_SET_DUMPABLE)"); pid = libcrun_join_process (context, container, status.pid, &status, opts->cgroup, context->detach, process, process->terminal ? &terminal_fd : NULL, err); if (UNLIKELY (pid < 0)) return pid; /* Process to exec. */ if (pid == 0) { TEMP_FAILURE_RETRY (close (pipefd0)); pipefd0 = -1; exec_process_entrypoint (context, container, process, pipefd1, seccomp_fd, seccomp_receiver_fd, custom_handler, err); /* It gets here only on errors. */ if (*err) libcrun_fail_with_error ((*err)->status, "%s", (*err)->msg); _exit (EXIT_FAILURE); } TEMP_FAILURE_RETRY (close (pipefd1)); pipefd1 = -1; TEMP_FAILURE_RETRY (write (pipefd0, &pid, sizeof (pid))); if (seccomp_fd >= 0) close_and_reset (&seccomp_fd); if (terminal_fd >= 0) { unsigned short rows = 0, cols = 0; if (process->console_size) { cols = process->console_size->width; rows = process->console_size->height; } ret = libcrun_terminal_setup_size (terminal_fd, rows, cols, err); if (UNLIKELY (ret < 0)) return ret; if (context->console_socket) { int ret; cleanup_close int console_socket_fd = open_unix_domain_client_socket (context->console_socket, 0, err); if (UNLIKELY (console_socket_fd < 0)) return console_socket_fd; ret = send_fd_to_socket (console_socket_fd, terminal_fd, err); if (UNLIKELY (ret < 0)) return ret; close_and_reset (&terminal_fd); } else { ret = libcrun_setup_terminal_ptmx (terminal_fd, &orig_terminal, err); if (UNLIKELY (ret < 0)) { flush_fd_to_err (context, terminal_fd); return ret; } } } ret = TEMP_FAILURE_RETRY (read (pipefd0, &b, sizeof (b))); TEMP_FAILURE_RETRY (close (pipefd0)); pipefd0 = -1; if (ret != 1 || b != '0') ret = -1; else { /* Let's receive the seccomp notify fd and handle it as part of wait_for_process(). */ if (own_seccomp_receiver_fd >= 0) { seccomp_notify_fd = receive_fd_from_socket (own_seccomp_receiver_fd, err); if (UNLIKELY (seccomp_notify_fd < 0)) return seccomp_notify_fd; ret = close_and_reset (&own_seccomp_receiver_fd); if (UNLIKELY (ret < 0)) return ret; } { struct wait_for_process_args args = { .pid = pid, .context = context, .terminal_fd = terminal_fd, .notify_socket = -1, .container_ready_fd = NULL, .seccomp_notify_fd = seccomp_notify_fd, .seccomp_notify_plugins = seccomp_notify_plugins, }; ret = wait_for_process (&args, err); } } flush_fd_to_err (context, terminal_fd); return ret; } int libcrun_container_update (libcrun_context_t *context, const char *id, const char *content, size_t len arg_unused, libcrun_error_t *err) { cleanup_custom_handler_instance struct custom_handler_instance_s *custom_handler = NULL; runtime_spec_schema_config_linux_resources *resources = NULL; cleanup_container libcrun_container_t *container = NULL; const char *state_root = context->state_root; struct parser_context ctx = { 0, stderr }; libcrun_container_status_t status = {}; parser_error parser_err = NULL; yajl_val tree = NULL; int ret; ret = libcrun_read_container_status (&status, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; ret = read_container_config_from_state (&container, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_configure_handler (context->handler_manager, context, container, &custom_handler, err); if (UNLIKELY (ret < 0)) return ret; ret = parse_json_file (&tree, content, &ctx, err); if (UNLIKELY (ret < 0)) return ret; resources = make_runtime_spec_schema_config_linux_resources (tree, &ctx, &parser_err); if (UNLIKELY (resources == NULL)) { ret = crun_make_error (err, errno, "cannot parse resources"); goto cleanup; } if (custom_handler && custom_handler->vtable->modify_oci_configuration) { /* Adapt RESOURCES to be used from the modify_oci_configuration hook. */ cleanup_free runtime_spec_schema_config_linux *linux = xmalloc0 (sizeof (*linux)); cleanup_free runtime_spec_schema_config_schema *def = xmalloc0 (sizeof (*def)); def->linux = linux; linux->resources = resources; ret = custom_handler->vtable->modify_oci_configuration (custom_handler->cookie, context, def, err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_linux_container_update (&status, resources, err); cleanup: if (tree) yajl_tree_free (tree); free (parser_err); if (resources) free_runtime_spec_schema_config_linux_resources (resources); return ret; } int libcrun_container_update_from_file (libcrun_context_t *context, const char *id, const char *file, libcrun_error_t *err) { cleanup_free char *content = NULL; size_t len; int ret; ret = read_all_file (file, &content, &len, err); if (UNLIKELY (ret < 0)) return ret; return libcrun_container_update (context, id, content, len, err); } static int compare_update_values (const void *a, const void *b) { const struct libcrun_update_value_s *aa = a; const struct libcrun_update_value_s *bb = b; int ret; ret = strcmp (aa->section, bb->section); if (ret) return ret; return strcmp (aa->name, bb->name); } int libcrun_container_update_from_values (libcrun_context_t *context, const char *id, struct libcrun_update_value_s *values, size_t len, libcrun_error_t *err) { const char *current_section = NULL; const unsigned char *buf; yajl_gen gen = NULL; size_t i, buf_len; int ret; gen = yajl_gen_alloc (NULL); if (gen == NULL) return crun_make_error (err, errno, "yajl_gen_create failed"); yajl_gen_map_open (gen); qsort (values, len, sizeof (struct libcrun_update_value_s), compare_update_values); for (i = 0; i < len; i++) { if (current_section == NULL || strcmp (values[i].section, current_section)) { if (i > 0) yajl_gen_map_close (gen); current_section = values[i].section; yajl_gen_string (gen, YAJL_STR (current_section), strlen (current_section)); yajl_gen_map_open (gen); } yajl_gen_string (gen, (const unsigned char *) values[i].name, strlen (values[i].name)); if (values[i].numeric) yajl_gen_number (gen, (const char *) values[i].value, strlen (values[i].value)); else yajl_gen_string (gen, (const unsigned char *) values[i].value, strlen (values[i].value)); } if (len) yajl_gen_map_close (gen); yajl_gen_map_close (gen); yajl_gen_get_buf (gen, &buf, &buf_len); ret = libcrun_container_update (context, id, (const char *) buf, buf_len, err); yajl_gen_free (gen); return ret; } static void populate_array_field (char ***field, char *array[], size_t num_elements) { size_t i; *field = xmalloc0 ((num_elements + 1) * sizeof (char *)); for (i = 0; i < num_elements; i++) (*field)[i] = xstrdup (array[i]); (*field)[i] = NULL; } #ifdef HAVE_CAP static void populate_capabilities (struct features_info_s *info, char ***capabilities, size_t *num_capabilities) { size_t index = 0; cap_value_t i; char *endptr; int j; *num_capabilities = 0; for (i = 0;; i++) { char *v = cap_to_name (i); if (v == NULL) break; strtol (v, &endptr, 10); if (endptr != v) { // Non-numeric or non-zero value encountered, break the loop break; } (*num_capabilities)++; } *capabilities = xmalloc0 ((*num_capabilities + 1) * sizeof (const char *)); for (i = 0; i < (cap_value_t) *num_capabilities; i++) { char *v = cap_to_name (i); if (v == NULL) break; strtol (v, &endptr, 10); if (endptr != v) { // Non-numeric or non-zero value encountered, break the loop break; } // Convert capability name to uppercase for (j = 0; v[j] != '\0'; j++) v[j] = toupper (v[j]); (*capabilities)[index] = v; index++; } (*capabilities)[index] = NULL; // Terminate the array with NULL populate_array_field (&(info->linux.capabilities), *capabilities, *num_capabilities); } #endif static void retrieve_mount_options (struct features_info_s **info) { cleanup_free const struct propagation_flags_s *mount_options_list = NULL; size_t num_mount_options = 0; // Retrieve mount options from wordlist mount_options_list = get_mount_flags_from_wordlist (); // Calculate the number of mount options while (mount_options_list[num_mount_options].name != NULL) num_mount_options++; // Allocate memory for mount options in info struct (*info)->mount_options = xmalloc0 ((num_mount_options + 1) * sizeof (char *)); // Copy mount options to info struct for (size_t i = 0; i < num_mount_options; i++) (*info)->mount_options[i] = xstrdup (mount_options_list[i].name); } int libcrun_container_get_features (libcrun_context_t *context, struct features_info_s **info, libcrun_error_t *err arg_unused) { // Allocate memory for the features_info_s structure size_t num_namspaces = sizeof (namespaces) / sizeof (namespaces[0]); size_t num_operators = sizeof (operators) / sizeof (operators[0]); size_t num_actions = sizeof (actions) / sizeof (actions[0]); size_t num_hooks = sizeof (hooks) / sizeof (hooks[0]); size_t num_archs = sizeof (archs) / sizeof (archs[0]); size_t num_unsafe_annotations = sizeof (potentially_unsafe_annotations) / sizeof (potentially_unsafe_annotations[0]); cleanup_free char **capabilities = NULL; size_t num_capabilities = 0; *info = xmalloc0 (sizeof (struct features_info_s)); // Hardcoded feature information (*info)->oci_version_min = xstrdup ("1.0.0"); (*info)->oci_version_max = xstrdup ("1.1.0+dev"); // Populate hooks populate_array_field (&((*info)->hooks), hooks, num_hooks); // Populate mount_options retrieve_mount_options (info); // Populate namespaces populate_array_field (&((*info)->linux.namespaces), namespaces, num_namspaces); #ifdef HAVE_CAP // Populate capabilities populate_capabilities (*info, &capabilities, &num_capabilities); #endif // Hardcode the values for cgroup (*info)->linux.cgroup.v1 = true; (*info)->linux.cgroup.v2 = true; #ifdef HAVE_SYSTEMD (*info)->linux.cgroup.systemd = true; (*info)->linux.cgroup.systemd_user = true; #endif // Put seccomp values #ifdef HAVE_SECCOMP (*info)->linux.seccomp.enabled = true; // Populate actions populate_array_field (&((*info)->linux.seccomp.actions), actions, num_actions); // Populate operators populate_array_field (&((*info)->linux.seccomp.operators), operators, num_operators); // Populate archs populate_array_field (&((*info)->linux.seccomp.archs), archs, num_archs); #else (*info)->linux.seccomp.enabled = false; #endif // Put values for apparmor and selinux (*info)->linux.apparmor.enabled = true; (*info)->linux.selinux.enabled = true; (*info)->linux.intel_rdt.enabled = true; // Put the values for mount extensions (*info)->linux.mount_ext.idmap.enabled = true; // Populate the values for annotations #ifdef HAVE_SECCOMP { const struct scmp_version *version = seccomp_version (); int size = snprintf (NULL, 0, "%u.%u.%u", version->major, version->minor, version->micro) + 1; char *version_string = xmalloc0 (size); snprintf (version_string, size, "%u.%u.%u", version->major, version->minor, version->micro); (*info)->annotations.io_github_seccomp_libseccomp_version = version_string; } #endif if (context->handler_manager && handler_by_name (context->handler_manager, "wasm")) (*info)->annotations.run_oci_crun_wasm = true; #if HAVE_CRIU (*info)->annotations.run_oci_crun_checkpoint_enabled = true; #endif (*info)->annotations.run_oci_crun_commit = GIT_VERSION; (*info)->annotations.run_oci_crun_version = PACKAGE_VERSION; populate_array_field (&((*info)->potentially_unsafe_annotations), potentially_unsafe_annotations, num_unsafe_annotations); return 0; } int libcrun_container_spec (bool root, FILE *out, libcrun_error_t *err) { int cgroup_mode; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; return fprintf (out, spec_file, root ? spec_pts_tty_group : "\n", root ? "" : spec_user, cgroup_mode == CGROUP_MODE_UNIFIED ? spec_cgroupns : ""); } int libcrun_container_pause (libcrun_context_t *context, const char *id, libcrun_error_t *err) { int ret; const char *state_root = context->state_root; libcrun_container_status_t status = {}; ret = libcrun_read_container_status (&status, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_is_container_running (&status, err); if (UNLIKELY (ret < 0)) return ret; if (ret == 0) return crun_make_error (err, errno, "the container `%s` is not running", id); return libcrun_container_pause_linux (&status, err); } int libcrun_container_unpause (libcrun_context_t *context, const char *id, libcrun_error_t *err) { int ret; const char *state_root = context->state_root; libcrun_container_status_t status = {}; ret = libcrun_read_container_status (&status, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_is_container_running (&status, err); if (UNLIKELY (ret < 0)) return ret; if (ret == 0) return crun_make_error (err, errno, "the container `%s` is not running", id); return libcrun_container_unpause_linux (&status, err); } int libcrun_container_checkpoint (libcrun_context_t *context, const char *id, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err) { int ret; const char *state_root = context->state_root; libcrun_container_status_t status = {}; cleanup_container libcrun_container_t *container = NULL; ret = libcrun_read_container_status (&status, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_is_container_running (&status, err); if (UNLIKELY (ret < 0)) return ret; if (ret == 0) return crun_make_error (err, errno, "the container `%s` is not running", id); ret = read_container_config_from_state (&container, state_root, id, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_container_checkpoint_linux (&status, container, cr_options, err); if (UNLIKELY (ret < 0)) return ret; if (! (cr_options->leave_running || cr_options->pre_dump)) return container_delete_internal (context, NULL, id, true, true, err); return 0; } int libcrun_container_restore (libcrun_context_t *context, const char *id, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err) { cleanup_cgroup_status struct libcrun_cgroup_status *cgroup_status = NULL; cleanup_container libcrun_container_t *container = NULL; runtime_spec_schema_config_schema *def; libcrun_container_status_t status = {}; int cgroup_manager; uid_t root_uid = -1; gid_t root_gid = -1; int ret; container = libcrun_container_load_from_file ("config.json", err); if (container == NULL) return -1; container->context = context; def = container->container_def; ret = check_config_file (def, context, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_status_check_directories (context->state_root, context->id, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_copy_config_file (context->id, context->state_root, container, err); if (UNLIKELY (ret < 0)) return ret; /* The CRIU restore code uses bundle and rootfs of status. */ status.bundle = (char *) context->bundle; status.rootfs = def->root->path; ret = libcrun_container_restore_linux (&status, container, cr_options, err); if (UNLIKELY (ret < 0)) return ret; /* Now that the process has been restored, moved it into is cgroup again. * The whole cgroup code is copied from libcrun_container_run_internal(). */ def = container->container_def; cgroup_manager = CGROUP_MANAGER_CGROUPFS; if (context->systemd_cgroup) cgroup_manager = CGROUP_MANAGER_SYSTEMD; else if (context->force_no_cgroup) cgroup_manager = CGROUP_MANAGER_DISABLED; /* If we are root (either on the host or in a namespace), * then chown the cgroup to root in the container user namespace. */ get_root_in_the_userns (def, container->host_uid, container->host_gid, &root_uid, &root_gid); /* If the root in the container is different than the current root user, attempt to chown the std streams before entering the user namespace. Otherwise we might lose access to the user (as it is not mapped in the user namespace) and cannot chown them. */ if (root_uid > 0 || root_gid > 0) { ret = maybe_chown_std_streams (root_uid, root_gid, err); if (UNLIKELY (ret < 0)) return ret; } { struct libcrun_cgroup_args cg = { .resources = def->linux ? def->linux->resources : NULL, .annotations = def->annotations, .cgroup_path = def->linux ? def->linux->cgroups_path : "", .manager = cgroup_manager, .pid = status.pid, .root_uid = root_uid, .root_gid = root_gid, .id = context->id, }; ret = libcrun_cgroup_enter (&cg, &cgroup_status, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_cgroup_enter_finalize (&cg, cgroup_status, err); if (UNLIKELY (ret < 0)) return ret; } context->detach = cr_options->detach; ret = write_container_status (container, context, status.pid, cgroup_status, err); if (UNLIKELY (ret < 0)) return ret; if (context->pid_file) { char buf[32]; size_t buf_len = snprintf (buf, sizeof (buf), "%d", status.pid); ret = write_file_with_flags (context->pid_file, O_CREAT | O_TRUNC, buf, buf_len, err); if (UNLIKELY (ret < 0)) return ret; } if (! cr_options->detach) { int wait_status; ret = waitpid_ignore_stopped (status.pid, &wait_status, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "waitpid failed for container `%s` with %d", id, ret); return get_process_exit_status (wait_status); } return 0; } int libcrun_container_read_pids (libcrun_context_t *context, const char *id, bool recurse, pid_t **pids, libcrun_error_t *err) { cleanup_cgroup_status struct libcrun_cgroup_status *cgroup_status = NULL; cleanup_container_status libcrun_container_status_t status = {}; int ret; ret = libcrun_read_container_status (&status, context->state_root, id, err); if (UNLIKELY (ret < 0)) return ret; if (status.cgroup_path == NULL || status.cgroup_path[0] == '\0') return crun_make_error (err, 0, "the container is not using cgroups"); cgroup_status = libcrun_cgroup_make_status (&status); return libcrun_cgroup_read_pids (cgroup_status, recurse, pids, err); } int libcrun_write_json_containers_list (libcrun_context_t *context, FILE *out, libcrun_error_t *err) { libcrun_container_list_t *list = NULL, *it; const unsigned char *content = NULL; yajl_gen gen = NULL; size_t len; int ret; ret = libcrun_get_containers_list (&list, context->state_root, err); if (UNLIKELY (ret < 0)) return ret; gen = yajl_gen_alloc (NULL); if (gen == NULL) { ret = crun_make_error (err, 0, "cannot allocate json generator"); goto exit; } yajl_gen_config (gen, yajl_gen_beautify, 1); yajl_gen_config (gen, yajl_gen_validate_utf8, 1); yajl_gen_array_open (gen); for (it = list; it; it = it->next) { libcrun_container_status_t status; int running = 0; int pid; const char *container_status = NULL; ret = libcrun_read_container_status (&status, context->state_root, it->name, err); if (UNLIKELY (ret < 0)) goto exit; pid = status.pid; ret = libcrun_get_container_state_string (it->name, &status, context->state_root, &container_status, &running, err); if (UNLIKELY (ret < 0)) { libcrun_error_write_warning_and_release (stderr, &err); continue; } if (! running) pid = 0; yajl_gen_map_open (gen); yajl_gen_string (gen, YAJL_STR ("id"), strlen ("id")); yajl_gen_string (gen, YAJL_STR (it->name), strlen (it->name)); yajl_gen_string (gen, YAJL_STR ("pid"), strlen ("pid")); yajl_gen_integer (gen, pid); yajl_gen_string (gen, YAJL_STR ("status"), strlen ("status")); yajl_gen_string (gen, YAJL_STR (container_status), strlen (container_status)); yajl_gen_string (gen, YAJL_STR ("bundle"), strlen ("bundle")); yajl_gen_string (gen, YAJL_STR (status.bundle), strlen (status.bundle)); yajl_gen_string (gen, YAJL_STR ("created"), strlen ("created")); yajl_gen_string (gen, YAJL_STR (status.created), strlen (status.created)); yajl_gen_string (gen, YAJL_STR ("owner"), strlen ("owner")); yajl_gen_string (gen, YAJL_STR (status.owner), strlen (status.owner)); yajl_gen_map_close (gen); libcrun_free_container_status (&status); } yajl_gen_array_close (gen); if (yajl_gen_get_buf (gen, &content, &len) != yajl_gen_status_ok) { ret = libcrun_make_error (err, 0, "cannot generate json list"); goto exit; } while (len) { size_t written = fwrite (content, 1, len, out); if (ferror (out)) { ret = libcrun_make_error (err, errno, "error writing to file"); goto exit; } len -= written; content += written; } ret = 0; exit: if (list) libcrun_free_containers_list (list); if (gen) yajl_gen_free (gen); return ret; } int libcrun_container_update_intel_rdt (libcrun_context_t *context, const char *id, struct libcrun_intel_rdt_update *update, libcrun_error_t *err) { cleanup_container libcrun_container_t *container = NULL; cleanup_free char *config_file = NULL; cleanup_free char *dir = NULL; int ret; dir = libcrun_get_state_directory (context->state_root, id); if (UNLIKELY (dir == NULL)) return crun_make_error (err, 0, "cannot get state directory"); ret = append_paths (&config_file, err, dir, "config.json", NULL); if (UNLIKELY (ret < 0)) return ret; container = libcrun_container_load_from_file (config_file, err); if (UNLIKELY (container == NULL)) return crun_make_error (err, 0, "error loading config.json"); return libcrun_update_intel_rdt (id, container, update->l3_cache_schema, update->mem_bw_schema, err); } crun-1.16.1/src/libcrun/criu.c0000644000000000000000000010575314551252466014315 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2020 Adrian Reber * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #if HAVE_CRIU && HAVE_DLOPEN # include # include # include # include # include # include # include # include "container.h" # include "linux.h" # include "status.h" # include "utils.h" # include "cgroup.h" # include "cgroup-utils.h" # include # define CRIU_CHECKPOINT_LOG_FILE "dump.log" # define CRIU_RESTORE_LOG_FILE "restore.log" # define DESCRIPTORS_FILENAME "descriptors.json" # define CRIU_EXT_NETNS "extRootNetNS" # define CRIU_EXT_PIDNS "extRootPidNS" # ifndef CLONE_NEWTIME # define CLONE_NEWTIME 0x00000080 /* New time namespace */ # endif static const char *console_socket = NULL; # define LIBCRIU_MIN_VERSION 31500 struct libcriu_wrapper_s { void *handle; int (*criu_add_ext_mount) (const char *key, const char *val); int (*criu_add_external) (const char *key); int (*criu_add_inherit_fd) (int fd, const char *key); int (*criu_check_version) (int minimum); int (*criu_dump) (void); int (*criu_get_orphan_pts_master_fd) (void); int (*criu_init_opts) (void); # ifdef CRIU_JOIN_NS_SUPPORT int (*criu_join_ns_add) (const char *ns, const char *ns_file, const char *extra_opt); # endif # ifdef CRIU_PRE_DUMP_SUPPORT int (*criu_feature_check) (struct criu_feature_check *features, size_t size); int (*criu_pre_dump) (void); # endif int (*criu_restore_child) (void); int (*criu_set_freeze_cgroup) (const char *name); void (*criu_set_file_locks) (bool file_locks); void (*criu_set_ext_unix_sk) (bool ext_unix_sk); int (*criu_set_log_file) (const char *log_file); void (*criu_set_log_level) (int log_level); void (*criu_set_leave_running) (bool leave_running); void (*criu_set_manage_cgroups) (bool manage); void (*criu_set_manage_cgroups_mode) (enum criu_cg_mode mode); void (*criu_set_notify_cb) (int (*cb) (char *action, criu_notify_arg_t na)); void (*criu_set_orphan_pts_master) (bool orphan_pts_master); void (*criu_set_images_dir_fd) (int fd); int (*criu_set_parent_images) (const char *path); void (*criu_set_pid) (int pid); int (*criu_set_root) (const char *root); void (*criu_set_shell_job) (bool shell_job); void (*criu_set_tcp_established) (bool tcp_established); void (*criu_set_track_mem) (bool track_mem); void (*criu_set_work_dir_fd) (int fd); }; static struct libcriu_wrapper_s *libcriu_wrapper; static inline void cleanup_wrapper (void *p) { struct libcriu_wrapper_s **w; w = (struct libcriu_wrapper_s **) p; if (*w == NULL) return; if ((*w)->handle) dlclose ((*w)->handle); free (*w); libcriu_wrapper = NULL; } # define cleanup_wrapper __attribute__ ((cleanup (cleanup_wrapper))) static int load_wrapper (struct libcriu_wrapper_s **wrapper_out, libcrun_error_t *err) { cleanup_free struct libcriu_wrapper_s *wrapper = xmalloc0 (sizeof (*wrapper)); # define LOAD_CRIU_FUNCTION(X, ALLOW_NULL) \ do \ { \ wrapper->X = dlsym (wrapper->handle, #X); \ if (! ALLOW_NULL && wrapper->X == NULL) \ { \ dlclose (wrapper->handle); \ return crun_make_error (err, 0, "could not find symbol `%s` in `libcriu.so`", #X); \ } \ } while (0) wrapper->handle = dlopen ("libcriu.so.2", RTLD_NOW); if (wrapper->handle == NULL) return crun_make_error (err, 0, "could not load `libcriu.so.2`"); LOAD_CRIU_FUNCTION (criu_add_ext_mount, false); LOAD_CRIU_FUNCTION (criu_add_external, false); LOAD_CRIU_FUNCTION (criu_add_inherit_fd, false); LOAD_CRIU_FUNCTION (criu_check_version, false); LOAD_CRIU_FUNCTION (criu_dump, false); LOAD_CRIU_FUNCTION (criu_get_orphan_pts_master_fd, false); LOAD_CRIU_FUNCTION (criu_init_opts, false); # ifdef CRIU_JOIN_NS_SUPPORT /* criu_join_ns_add() API was introduced with CRIU version 3.16.1 * Here we check if this API is available at build time to support * compiling with older version of CRIU, and at runtime to support * running crun with older versions of libcriu.so.2. */ LOAD_CRIU_FUNCTION (criu_join_ns_add, true); # endif # ifdef CRIU_PRE_DUMP_SUPPORT LOAD_CRIU_FUNCTION (criu_feature_check, false); LOAD_CRIU_FUNCTION (criu_pre_dump, false); # endif LOAD_CRIU_FUNCTION (criu_restore_child, false); LOAD_CRIU_FUNCTION (criu_set_ext_unix_sk, false); LOAD_CRIU_FUNCTION (criu_set_file_locks, false); LOAD_CRIU_FUNCTION (criu_set_freeze_cgroup, false); LOAD_CRIU_FUNCTION (criu_set_images_dir_fd, false); LOAD_CRIU_FUNCTION (criu_set_leave_running, false); LOAD_CRIU_FUNCTION (criu_set_log_file, false); LOAD_CRIU_FUNCTION (criu_set_log_level, false); LOAD_CRIU_FUNCTION (criu_set_manage_cgroups, false); LOAD_CRIU_FUNCTION (criu_set_manage_cgroups_mode, false); LOAD_CRIU_FUNCTION (criu_set_notify_cb, false); LOAD_CRIU_FUNCTION (criu_set_orphan_pts_master, false); LOAD_CRIU_FUNCTION (criu_set_parent_images, false); LOAD_CRIU_FUNCTION (criu_set_pid, false); LOAD_CRIU_FUNCTION (criu_set_root, false); LOAD_CRIU_FUNCTION (criu_set_shell_job, false); LOAD_CRIU_FUNCTION (criu_set_tcp_established, false); LOAD_CRIU_FUNCTION (criu_set_track_mem, false); LOAD_CRIU_FUNCTION (criu_set_work_dir_fd, false); libcriu_wrapper = *wrapper_out = wrapper; wrapper = NULL; # undef LOAD_CRIU_FUNCTION return 0; } static int criu_notify (char *action, __attribute__ ((unused)) criu_notify_arg_t na) { if (strncmp (action, "orphan-pts-master", 17) == 0) { /* CRIU sends us the master FD via the 'orphan-pts-master' * callback and we are passing it on to the '--console-socket' * if it exists. */ cleanup_close int console_socket_fd = -1; libcrun_error_t tmp_err = NULL; int master_fd; int ret; if (! console_socket) return 0; master_fd = libcriu_wrapper->criu_get_orphan_pts_master_fd (); console_socket_fd = open_unix_domain_client_socket (console_socket, 0, &tmp_err); if (UNLIKELY (console_socket_fd < 0)) { libcrun_error_release (&tmp_err); return console_socket_fd; } ret = send_fd_to_socket (console_socket_fd, master_fd, &tmp_err); if (UNLIKELY (ret < 0)) { libcrun_error_release (&tmp_err); return ret; } } return 0; } # ifdef CRIU_PRE_DUMP_SUPPORT static int criu_check_mem_track (char *work_path, libcrun_error_t *err) { struct criu_feature_check features = { 0 }; int ret; /* Right now we are only interested in checking memory tracking. * Memory tracking can be disabled at different levels. aarch64 * for example has memory tracking not implemented. It could also * be not enabled on other architectures. Just ask CRIU if that * features exists. */ features.mem_track = true; ret = libcriu_wrapper->criu_feature_check (&features, sizeof (features)); if (UNLIKELY (ret < 0)) return crun_make_error (err, 0, "CRIU feature checking failed %d. Please check CRIU logfile %s/%s", ret, work_path, CRIU_CHECKPOINT_LOG_FILE); if (features.mem_track == true) return 1; return crun_make_error (err, 0, "memory tracking not supported. Please check CRIU logfile %s/%s", work_path, CRIU_CHECKPOINT_LOG_FILE); } # endif static int restore_cgroup_v1_mount (runtime_spec_schema_config_schema *def, libcrun_error_t *err) { cleanup_free char *content = NULL; bool has_cgroup_mount = false; char *saveptr = NULL; int cgroup_mode; char *from; int ret; uint32_t i; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; if (cgroup_mode == CGROUP_MODE_UNIFIED) return 0; /* First check if there is actually a cgroup mount in the container. */ for (i = 0; i < def->mounts_len; i++) { if (strcmp (def->mounts[i]->type, "cgroup") == 0) { has_cgroup_mount = true; break; } } if (! has_cgroup_mount) return 0; ret = read_all_file (PROC_SELF_CGROUP, &content, NULL, err); if (UNLIKELY (ret < 0)) return ret; if (UNLIKELY (content == NULL || content[0] == '\0')) return crun_make_error (err, 0, "invalid content from `%s`", PROC_SELF_CGROUP); for (from = strtok_r (content, "\n", &saveptr); from; from = strtok_r (NULL, "\n", &saveptr)) { cleanup_free char *destination = NULL; cleanup_free char *source = NULL; char *subsystem; char *subpath; char *it; subsystem = strchr (from, ':') + 1; subpath = strchr (subsystem, ':') + 1; *(subpath - 1) = '\0'; if (subsystem[0] == '\0') continue; it = strstr (subsystem, "name="); if (it) subsystem = it + 5; if (strcmp (subsystem, "net_prio,net_cls") == 0) subsystem = "net_cls,net_prio"; if (strcmp (subsystem, "cpuacct,cpu") == 0) subsystem = "cpu,cpuacct"; ret = append_paths (&source, err, CGROUP_ROOT, subsystem, NULL); if (UNLIKELY (ret < 0)) return ret; ret = append_paths (&destination, err, source, subpath, NULL); if (UNLIKELY (ret < 0)) return ret; libcriu_wrapper->criu_add_ext_mount (source, destination); } return 0; } static int checkpoint_cgroup_v1_mount (runtime_spec_schema_config_schema *def, libcrun_error_t *err) { cleanup_free char *content = NULL; bool has_cgroup_mount = false; char *saveptr = NULL; char *from; int ret; uint32_t i; /* First check if there is actually a cgroup mount in the container. */ for (i = 0; i < def->mounts_len; i++) { if (strcmp (def->mounts[i]->type, "cgroup") == 0) { has_cgroup_mount = true; break; } } if (! has_cgroup_mount) return 0; ret = read_all_file (PROC_SELF_CGROUP, &content, NULL, err); if (UNLIKELY (ret < 0)) return ret; if (UNLIKELY (content == NULL || content[0] == '\0')) return crun_make_error (err, 0, "invalid content from `%s`", PROC_SELF_CGROUP); for (from = strtok_r (content, "\n", &saveptr); from; from = strtok_r (NULL, "\n", &saveptr)) { cleanup_free char *source_path = NULL; char *subsystem; char *subpath; char *it; subsystem = strchr (from, ':') + 1; subpath = strchr (subsystem, ':') + 1; *(subpath - 1) = '\0'; if (subsystem[0] == '\0') continue; it = strstr (subsystem, "name="); if (it) subsystem = it + 5; if (strcmp (subsystem, "net_prio,net_cls") == 0) subsystem = "net_cls,net_prio"; if (strcmp (subsystem, "cpuacct,cpu") == 0) subsystem = "cpu,cpuacct"; ret = append_paths (&source_path, err, CGROUP_ROOT, subsystem, NULL); if (UNLIKELY (ret < 0)) return ret; libcriu_wrapper->criu_add_ext_mount (source_path, source_path); } return 0; } int libcrun_container_checkpoint_linux_criu (libcrun_container_status_t *status, libcrun_container_t *container, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; cleanup_wrapper struct libcriu_wrapper_s *wrapper = NULL; cleanup_free char *descriptors_path = NULL; cleanup_free char *freezer_path = NULL; cleanup_free char *path = NULL; cleanup_close int image_fd = -1; cleanup_close int work_fd = -1; int cgroup_mode; size_t i; int ret; ret = load_wrapper (&wrapper, err); if (UNLIKELY (ret < 0)) return ret; if (geteuid ()) return crun_make_error (err, 0, "checkpointing requires root"); /* No CRIU version or feature checking yet. In configure.ac there * is a minimum CRIU version listed and so far it is good enough. * * The CRIU library also does not yet have an interface to CRIU * the version of the binary. Right now it is only possible to * query the version of the library via defines during buildtime. * * The whole CRIU library setup works this way, that the library * is only a wrapper around RPC calls to the actual library. So * if CRIU is updated and the SO of the library does not change, * and crun is not rebuilt against the newer version, the version * is still returning the values during buildtime and not from * the actual running CRIU binary. The RPC interface between the * library will not break, so no reason to worry, but it is not * possible to detect (via the library) which CRIU version is * actually being used. This needs to be added to CRIU upstream. */ ret = libcriu_wrapper->criu_init_opts (); if (UNLIKELY (ret < 0)) return crun_make_error (err, 0, "CRIU init failed with %d", ret); if (! libcriu_wrapper->criu_check_version (LIBCRIU_MIN_VERSION)) return crun_make_error (err, 0, "libcriu is too old"); if (UNLIKELY (cr_options->image_path == NULL)) return crun_make_error (err, 0, "image path not set"); ret = mkdir (cr_options->image_path, 0700); if (UNLIKELY ((ret == -1) && (errno != EEXIST))) return crun_make_error (err, errno, "error creating checkpoint directory `%s`", cr_options->image_path); image_fd = open (cr_options->image_path, O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (image_fd == -1)) return crun_make_error (err, errno, "error opening checkpoint directory `%s`", cr_options->image_path); libcriu_wrapper->criu_set_images_dir_fd (image_fd); /* Set up logging. */ libcriu_wrapper->criu_set_log_level (4); libcriu_wrapper->criu_set_log_file (CRIU_CHECKPOINT_LOG_FILE); /* Setting the pid early as we can skip a lot of checkpoint setup if * we just do a pre-dump. The PID needs to be set always. Do it here. * The main process of the container is the process CRIU will checkpoint * and all of its children. */ libcriu_wrapper->criu_set_pid (status->pid); /* work_dir is the place CRIU will put its logfiles. If not explicitly set, * CRIU will put the logfiles into the images_dir from above. No need for * crun to set it if the user has not selected a specific directory. */ if (cr_options->work_path != NULL) { work_fd = open (cr_options->work_path, O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (work_fd == -1)) return crun_make_error (err, errno, "error opening CRIU work directory `%s`", cr_options->work_path); libcriu_wrapper->criu_set_work_dir_fd (work_fd); } else { /* This is only for the error message later. */ cr_options->work_path = cr_options->image_path; } # ifdef CRIU_PRE_DUMP_SUPPORT { int criu_can_mem_track = 0; /* If the user uses --pre-dump for the second time or does * a final dump from a previous pre-dump, setting parent_path * is necessary so that CRIU can find which pages have not * changed compared to the previous dump. */ if (cr_options->parent_path != NULL) { criu_can_mem_track = criu_check_mem_track (cr_options->work_path, err); if (UNLIKELY (criu_can_mem_track == -1)) return -1; libcriu_wrapper->criu_set_track_mem (true); /* The parent path needs to be a relative path. CRIU will fail * if the path is not in the right format. Usually something like * ../previous-dump */ libcriu_wrapper->criu_set_parent_images (cr_options->parent_path); } if (cr_options->pre_dump) { if (criu_can_mem_track != 1) { criu_can_mem_track = criu_check_mem_track (cr_options->work_path, err); if (UNLIKELY (criu_can_mem_track == -1)) return -1; } libcriu_wrapper->criu_set_track_mem (true); ret = libcriu_wrapper->criu_pre_dump (); if (UNLIKELY (ret != 0)) return crun_make_error (err, 0, "CRIU pre-dump failed %d. Please check CRIU logfile %s/%s", ret, cr_options->work_path, CRIU_CHECKPOINT_LOG_FILE); return 0; } } # endif /* descriptors.json is needed during restore to correctly * reconnect stdin, stdout, stderr. */ ret = append_paths (&descriptors_path, err, cr_options->image_path, DESCRIPTORS_FILENAME, NULL); if (UNLIKELY (ret < 0)) return ret; ret = write_file (descriptors_path, status->external_descriptors, strlen (status->external_descriptors), err); if (UNLIKELY (ret < 0)) return crun_error_wrap (err, "error saving CRIU descriptors file"); ret = append_paths (&path, err, status->bundle, status->rootfs, NULL); if (UNLIKELY (ret < 0)) return ret; ret = libcriu_wrapper->criu_set_root (path); if (UNLIKELY (ret != 0)) return crun_make_error (err, 0, "error setting CRIU root to `%s`", path); cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; /* For cgroup v1 we need to tell CRIU to handle all cgroup mounts as external mounts. */ if (cgroup_mode != CGROUP_MODE_UNIFIED) { ret = checkpoint_cgroup_v1_mount (def, err); if (UNLIKELY (ret != 0)) return crun_make_error (err, 0, "error handling cgroup v1 mounts"); } /* Tell CRIU about external bind mounts. */ for (i = 0; i < def->mounts_len; i++) { size_t j; for (j = 0; j < def->mounts[i]->options_len; j++) { if (strcmp (def->mounts[i]->options[j], "bind") == 0 || strcmp (def->mounts[i]->options[j], "rbind") == 0) { libcriu_wrapper->criu_add_ext_mount (def->mounts[i]->destination, def->mounts[i]->destination); break; } } } for (i = 0; i < def->linux->masked_paths_len; i++) { struct stat statbuf; ret = stat (def->linux->masked_paths[i], &statbuf); if (ret == 0 && S_ISREG (statbuf.st_mode)) libcriu_wrapper->criu_add_ext_mount (def->linux->masked_paths[i], def->linux->masked_paths[i]); } /* CRIU tries to checkpoint and restore all namespaces. However, * namespaces could be shared between containers in a pod. * To address this, CRIU provides support for external namespaces. * External namespaces allow to ignore the namespace during checkpoint * and restore the container into the existing namespaces. * * We are looking at config.json and if there is a path configured for * a namespace we are telling CRIU to ignore the namespace and * just restore the container into the existing namespace. * * In the case of Podman, a network namespace would be created via CNI. * * CRIU expects the information about an external namespace like this: * --external []: */ for (i = 0; i < def->linux->namespaces_len; i++) { int value = libcrun_find_namespace (def->linux->namespaces[i]->type); if (UNLIKELY (value < 0)) return crun_make_error (err, 0, "invalid namespace type: `%s`", def->linux->namespaces[i]->type); if (value == CLONE_NEWNET && def->linux->namespaces[i]->path != NULL) { cleanup_free char *external = NULL; struct stat statbuf; ret = stat (def->linux->namespaces[i]->path, &statbuf); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "unable to stat(): `%s`", def->linux->namespaces[i]->path); xasprintf (&external, "net[%ld]:" CRIU_EXT_NETNS, statbuf.st_ino); libcriu_wrapper->criu_add_external (external); } if (value == CLONE_NEWPID && def->linux->namespaces[i]->path != NULL) { cleanup_free char *external = NULL; struct stat statbuf; ret = stat (def->linux->namespaces[i]->path, &statbuf); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "unable to stat(): `%s`", def->linux->namespaces[i]->path); xasprintf (&external, "pid[%ld]:" CRIU_EXT_PIDNS, statbuf.st_ino); libcriu_wrapper->criu_add_external (external); } } /* Tell CRIU to use the freezer to pause all container processes. */ if (cgroup_mode == CGROUP_MODE_UNIFIED) { /* This needs CRIU 3.14. */ ret = append_paths (&freezer_path, err, CGROUP_ROOT, status->cgroup_path, NULL); if (UNLIKELY (ret < 0)) return ret; } else { ret = append_paths (&freezer_path, err, CGROUP_ROOT "/freezer", status->cgroup_path, NULL); if (UNLIKELY (ret < 0)) return ret; } ret = libcriu_wrapper->criu_set_freeze_cgroup (freezer_path); if (UNLIKELY (ret < 0)) return crun_make_error (err, -ret, "CRIU: failed setting freezer %d", ret); /* Set boolean options . */ libcriu_wrapper->criu_set_leave_running (cr_options->leave_running); libcriu_wrapper->criu_set_ext_unix_sk (cr_options->ext_unix_sk); libcriu_wrapper->criu_set_shell_job (cr_options->shell_job); libcriu_wrapper->criu_set_tcp_established (cr_options->tcp_established); libcriu_wrapper->criu_set_file_locks (cr_options->file_locks); libcriu_wrapper->criu_set_orphan_pts_master (true); if (cr_options->manage_cgroups_mode == -1) /* Defaulting to CRIU_CG_MODE_SOFT just as runc */ libcriu_wrapper->criu_set_manage_cgroups_mode (CRIU_CG_MODE_SOFT); else libcriu_wrapper->criu_set_manage_cgroups_mode (cr_options->manage_cgroups_mode); libcriu_wrapper->criu_set_manage_cgroups (true); ret = libcriu_wrapper->criu_dump (); if (UNLIKELY (ret != 0)) return crun_make_error (err, 0, "CRIU checkpointing failed %d. Please check CRIU logfile %s/%s", ret, cr_options->work_path, CRIU_CHECKPOINT_LOG_FILE); return 0; } static int prepare_restore_mounts (runtime_spec_schema_config_schema *def, char *root, libcrun_error_t *err) { uint32_t i; /* Go through all mountpoints to be able to recreate missing mountpoints. */ for (i = 0; i < def->mounts_len; i++) { char *dest = def->mounts[i]->destination; char *type = def->mounts[i]->type; cleanup_close int root_fd = -1; bool on_tmpfs = false; int is_dir = 1; size_t j; /* cgroup restore should be handled by CRIU itself */ if (strcmp (type, "cgroup") == 0 || strcmp (type, "cgroup2") == 0) continue; /* Check if the mountpoint is on a tmpfs. CRIU restores * all tmpfs. We do need to recreate directories on a tmpfs. */ for (j = 0; j < def->mounts_len; j++) { cleanup_free char *dest_loop = NULL; xasprintf (&dest_loop, "%s/", def->mounts[j]->destination); if (strncmp (dest, dest_loop, strlen (dest_loop)) == 0 && strcmp (def->mounts[j]->type, "tmpfs") == 0) { /* This is a mountpoint which is on a tmpfs.*/ on_tmpfs = true; break; } } if (on_tmpfs) continue; /* For bind mounts check if the source is a file or a directory. */ for (j = 0; j < def->mounts[i]->options_len; j++) { const char *opt = def->mounts[i]->options[j]; if (strcmp (opt, "bind") == 0 || strcmp (opt, "rbind") == 0) { is_dir = crun_dir_p (def->mounts[i]->source, false, err); if (UNLIKELY (is_dir < 0)) return is_dir; break; } } root_fd = open (root, O_RDONLY | O_CLOEXEC); if (UNLIKELY (root_fd == -1)) return crun_make_error (err, errno, "error opening container root directory `%s`", root); if (is_dir) { int ret; ret = crun_safe_ensure_directory_at (root_fd, root, strlen (root), dest, 0755, err); if (UNLIKELY (ret < 0)) return ret; } else { int ret; ret = crun_safe_ensure_file_at (root_fd, root, strlen (root), dest, 0755, err); if (UNLIKELY (ret < 0)) return ret; } } return 0; } int libcrun_container_restore_linux_criu (libcrun_container_status_t *status, libcrun_container_t *container, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; cleanup_wrapper struct libcriu_wrapper_s *wrapper = NULL; cleanup_close int inherit_new_net_fd = -1; cleanup_close int inherit_new_pid_fd = -1; cleanup_close int image_fd = -1; cleanup_free char *root = NULL; cleanup_free char *bundle_cleanup = NULL; cleanup_close int work_fd = -1; int ret_out; size_t i; int ret; ret = load_wrapper (&wrapper, err); if (UNLIKELY (ret < 0)) return ret; if (geteuid ()) return crun_make_error (err, 0, "restoring requires root"); ret = libcriu_wrapper->criu_init_opts (); if (UNLIKELY (ret < 0)) return crun_make_error (err, 0, "CRIU init failed with %d", ret); if (! libcriu_wrapper->criu_check_version (LIBCRIU_MIN_VERSION)) return crun_make_error (err, 0, "libcriu is too old"); if (UNLIKELY (cr_options->image_path == NULL)) return crun_make_error (err, 0, "image path not set"); image_fd = open (cr_options->image_path, O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (image_fd == -1)) return crun_make_error (err, errno, "error opening checkpoint directory `%s`", cr_options->image_path); libcriu_wrapper->criu_set_images_dir_fd (image_fd); /* Load descriptors.json to tell CRIU where those FDs should be connected to. */ { cleanup_free char *descriptors_path = NULL; cleanup_free char *buffer = NULL; char err_buffer[256]; yajl_val tree; ret = append_paths (&descriptors_path, err, cr_options->image_path, DESCRIPTORS_FILENAME, NULL); if (UNLIKELY (ret < 0)) return ret; ret = read_all_file (descriptors_path, &buffer, NULL, err); if (UNLIKELY (ret < 0)) return ret; /* descriptors.json contains a JSON array with strings * telling where 0, 1 and 2 have been initially been * pointing to. For each descriptor which points to * a pipe 'pipe:' we tell CRIU to reconnect that pipe * to the corresponding FD to have (especially) stdout * and stderr being correctly redirected. */ tree = yajl_tree_parse (buffer, err_buffer, sizeof (err_buffer)); if (UNLIKELY (tree == NULL)) return crun_make_error (err, 0, "cannot parse descriptors file `%s`", DESCRIPTORS_FILENAME); if (tree && YAJL_IS_ARRAY (tree)) { size_t i, len = tree->u.array.len; /* len will probably always be 3 as crun is currently only * recording the destination of FD 0, 1 and 2. */ for (i = 0; i < len; ++i) { yajl_val s = tree->u.array.values[i]; if (s && YAJL_IS_STRING (s)) { char *str = YAJL_GET_STRING (s); if (has_prefix (str, "pipe:")) libcriu_wrapper->criu_add_inherit_fd (i, str); } } } yajl_tree_free (tree); } /* work_dir is the place CRIU will put its logfiles. If not explicitly set, * CRIU will put the logfiles into the images_dir from above. No need for * crun to set it if the user has not selected a specific directory. */ if (cr_options->work_path != NULL) { work_fd = open (cr_options->work_path, O_DIRECTORY | O_CLOEXEC); if (UNLIKELY (work_fd == -1)) return crun_make_error (err, errno, "error opening CRIU work directory `%s`", cr_options->work_path); libcriu_wrapper->criu_set_work_dir_fd (work_fd); } else { /* This is only for the error message later. */ cr_options->work_path = cr_options->image_path; } /* Tell CRIU about external bind mounts. */ for (i = 0; i < def->mounts_len; i++) { size_t j; for (j = 0; j < def->mounts[i]->options_len; j++) { if (strcmp (def->mounts[i]->options[j], "bind") == 0 || strcmp (def->mounts[i]->options[j], "rbind") == 0) { libcriu_wrapper->criu_add_ext_mount (def->mounts[i]->destination, def->mounts[i]->source); break; } } } for (i = 0; i < def->linux->masked_paths_len; i++) { struct stat statbuf; ret = stat (def->linux->masked_paths[i], &statbuf); if (ret == 0 && S_ISREG (statbuf.st_mode)) libcriu_wrapper->criu_add_ext_mount (def->linux->masked_paths[i], "/dev/null"); } /* do realpath on root */ bundle_cleanup = realpath (status->bundle, NULL); if (UNLIKELY (bundle_cleanup == NULL)) bundle_cleanup = xstrdup (status->bundle); /* Mount the container rootfs for CRIU. */ ret = append_paths (&root, err, bundle_cleanup, "criu-root", NULL); if (UNLIKELY (ret < 0)) return ret; ret = mkdir (root, 0755); if (UNLIKELY (ret == -1)) return crun_make_error (err, errno, "error creating restore directory `%s`", root); ret = mount (status->rootfs, root, NULL, MS_BIND | MS_REC, NULL); if (UNLIKELY (ret == -1)) { ret = crun_make_error (err, errno, "error mounting restore directory `%s`", root); goto out; } /* During initial container creation, crun will create mountpoints * defined in config.json if they do not exist. If we are restoring * we need to make sure these mountpoints also exist. * This is not perfect, as this means crun will modify a rootfs * even if it marked as read-only, but runc already modifies * the rootfs in the same way. */ ret = prepare_restore_mounts (def, root, err); if (UNLIKELY (ret < 0)) goto out_umount; ret = libcriu_wrapper->criu_set_root (root); if (UNLIKELY (ret != 0)) { ret = crun_make_error (err, 0, "error setting CRIU root to `%s`", root); goto out_umount; } /* If a namespace defined in config.json we are telling * CRIU use that namespace when restoring the process tree. * * CRIU expects the information about the namespace like this: * --inherit-fd fd[]: * The needs to be the same as during checkpointing (extRootNetNS). */ for (i = 0; i < def->linux->namespaces_len; i++) { const int open_flags_for_inherit = O_RDONLY; /* Cannot be O_CLOEXEC as it is passed to the child process. */ int value = libcrun_find_namespace (def->linux->namespaces[i]->type); if (UNLIKELY (value < 0)) return crun_make_error (err, 0, "invalid namespace type: `%s`", def->linux->namespaces[i]->type); if (value == CLONE_NEWNET && def->linux->namespaces[i]->path != NULL) { inherit_new_net_fd = open (def->linux->namespaces[i]->path, open_flags_for_inherit); if (UNLIKELY (inherit_new_net_fd < 0)) return crun_make_error (err, errno, "unable to open(): `%s`", def->linux->namespaces[i]->path); libcriu_wrapper->criu_add_inherit_fd (inherit_new_net_fd, CRIU_EXT_NETNS); } if (value == CLONE_NEWPID && def->linux->namespaces[i]->path != NULL) { inherit_new_pid_fd = open (def->linux->namespaces[i]->path, open_flags_for_inherit); if (UNLIKELY (inherit_new_pid_fd < 0)) return crun_make_error (err, errno, "unable to open(): `%s`", def->linux->namespaces[i]->path); libcriu_wrapper->criu_add_inherit_fd (inherit_new_pid_fd, CRIU_EXT_PIDNS); } # ifdef CRIU_JOIN_NS_SUPPORT if (value == CLONE_NEWTIME && def->linux->namespaces[i]->path != NULL) { if (libcriu_wrapper->criu_join_ns_add != NULL) libcriu_wrapper->criu_join_ns_add ("time", def->linux->namespaces[i]->path, NULL); else return crun_make_error (err, 0, "shared time namespace restore is supported in CRIU >= 3.16.1"); } if (value == CLONE_NEWIPC && def->linux->namespaces[i]->path != NULL) { if (libcriu_wrapper->criu_join_ns_add != NULL) libcriu_wrapper->criu_join_ns_add ("ipc", def->linux->namespaces[i]->path, NULL); else return crun_make_error (err, 0, "shared ipc namespace restore is supported in CRIU >= 3.16.1"); } if (value == CLONE_NEWUTS && def->linux->namespaces[i]->path != NULL) { if (libcriu_wrapper->criu_join_ns_add != NULL) libcriu_wrapper->criu_join_ns_add ("uts", def->linux->namespaces[i]->path, NULL); else return crun_make_error (err, 0, "shared uts namespace restore is supported in CRIU >= 3.16.1"); } # endif } /* Tell CRIU if cgroup v1 needs to be handled. */ ret = restore_cgroup_v1_mount (def, err); if (UNLIKELY (ret < 0)) goto out_umount; console_socket = cr_options->console_socket; libcriu_wrapper->criu_set_notify_cb (criu_notify); /* Set boolean options . */ libcriu_wrapper->criu_set_ext_unix_sk (cr_options->ext_unix_sk); libcriu_wrapper->criu_set_shell_job (cr_options->shell_job); libcriu_wrapper->criu_set_tcp_established (cr_options->tcp_established); libcriu_wrapper->criu_set_file_locks (cr_options->file_locks); libcriu_wrapper->criu_set_orphan_pts_master (true); libcriu_wrapper->criu_set_manage_cgroups (true); libcriu_wrapper->criu_set_log_level (4); libcriu_wrapper->criu_set_log_file (CRIU_RESTORE_LOG_FILE); ret = libcriu_wrapper->criu_restore_child (); /* criu_restore() returns the PID of the process of the restored process * tree. This PID will not be the same as status->pid if the container is * running in a PID namespace. But it will always be > 0. */ if (UNLIKELY (ret <= 0)) { ret = crun_make_error (err, 0, "CRIU restoring failed %d. Please check CRIU logfile `%s/%s`", ret, cr_options->work_path, CRIU_RESTORE_LOG_FILE); goto out_umount; } /* Update the status struct with the newly allocated PID. This will * be necessary later when moving the process into its cgroup. */ status->pid = ret; ret = libcrun_save_external_descriptors (container, ret, err); out_umount: ret_out = umount (root); if (UNLIKELY (ret_out == -1)) { rmdir (root); return crun_make_error (err, errno, "error unmounting restore directory `%s`", root); } out: ret_out = rmdir (root); if (UNLIKELY (ret == -1)) return ret; if (UNLIKELY (ret_out == -1)) return crun_make_error (err, errno, "error removing restore directory `%s`", root); return ret; } #endif crun-1.16.1/src/libcrun/custom-handler.c0000644000000000000000000002124314654642544016273 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2020, 2021 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "custom-handler.h" #include "container.h" #include "utils.h" #include "linux.h" #include #include #include #include #include #include #ifdef HAVE_DLOPEN # include #endif #if HAVE_DLOPEN && HAVE_LIBKRUN extern struct custom_handler_s handler_libkrun; #endif #if HAVE_DLOPEN && HAVE_WASMTIME extern struct custom_handler_s handler_wasmtime; #endif #if HAVE_DLOPEN && HAVE_WASMEDGE extern struct custom_handler_s handler_wasmedge; #endif #if HAVE_DLOPEN && HAVE_WASMER extern struct custom_handler_s handler_wasmer; #endif #if HAVE_DLOPEN && HAVE_MONO extern struct custom_handler_s handler_mono; #endif #if HAVE_DLOPEN && HAVE_SPIN extern struct custom_handler_s handler_spin; #endif static struct custom_handler_s *static_handlers[] = { #if HAVE_DLOPEN && HAVE_LIBKRUN &handler_libkrun, #endif #if HAVE_DLOPEN && HAVE_WASMEDGE &handler_wasmedge, #endif #if HAVE_DLOPEN && HAVE_WASMER &handler_wasmer, #endif #if HAVE_DLOPEN && HAVE_WASMTIME &handler_wasmtime, #endif #if HAVE_DLOPEN && HAVE_MONO &handler_mono, #endif #if HAVE_DLOPEN && HAVE_SPIN &handler_spin, #endif NULL, }; struct custom_handler_manager_s { struct custom_handler_s **handlers; void **handles; size_t handlers_len; }; struct custom_handler_manager_s * libcrun_handler_manager_create (libcrun_error_t *err arg_unused) { struct custom_handler_s **handlers = NULL; void **handles = NULL; struct custom_handler_manager_s *m; size_t i, handlers_len; /* Count the static handlers. */ for (handlers_len = 0; static_handlers[handlers_len]; handlers_len++) ; if (handlers_len) { handlers = xmalloc (sizeof (struct custom_handler_s *) * handlers_len); handles = xmalloc0 (sizeof (void *) * handlers_len); } for (i = 0; i < handlers_len; i++) handlers[i] = static_handlers[i]; m = xmalloc0 (sizeof (struct custom_handler_manager_s)); m->handlers = handlers; m->handles = handles; m->handlers_len = handlers_len; return m; } void handler_manager_free (struct custom_handler_manager_s *manager) { size_t i; for (i = 0; i < manager->handlers_len; i++) { #ifdef HAVE_DLOPEN if (manager->handles[i]) dlclose (manager->handles[i]); #endif } free (manager->handlers); free (manager->handles); free (manager); } #ifdef HAVE_DLOPEN static int handler_manager_add_so (struct custom_handler_manager_s *manager, void *handle, libcrun_error_t *err) { struct custom_handler_s *h = NULL; run_oci_get_handler_cb cb; cb = (run_oci_get_handler_cb) dlsym (handle, "run_oci_handler_get_handler"); if (UNLIKELY (cb == NULL)) return crun_make_error (err, 0, "cannot find symbol `run_oci_handler_get_handler`"); h = cb (); if (UNLIKELY (h == NULL)) return crun_make_error (err, 0, "the callback `run_oci_handler_get_handler` didn't return a handler"); manager->handlers = xrealloc (manager->handlers, sizeof (struct custom_handler_s *) * (manager->handlers_len + 1)); manager->handles = xrealloc (manager->handles, sizeof (void *) * (manager->handlers_len + 1)); manager->handlers[manager->handlers_len] = h; manager->handles[manager->handlers_len] = handle; manager->handlers_len++; return 0; } #endif int libcrun_handler_manager_load_directory (struct custom_handler_manager_s *manager, const char *path, libcrun_error_t *err) { #ifdef HAVE_DLOPEN cleanup_dir DIR *dir = NULL; struct dirent *next; dir = opendir (path); if (UNLIKELY (dir == NULL)) return crun_make_error (err, errno, "cannot opendir `%s`", path); for (next = readdir (dir); next; next = readdir (dir)) { cleanup_free char *fpath = NULL; const char *name; void *handle; int ret; name = next->d_name; if (name[0] == '.') continue; ret = append_paths (&fpath, err, path, name, NULL); if (UNLIKELY (ret < 0)) return ret; handle = dlopen (fpath, RTLD_NOW); if (UNLIKELY (handle == NULL)) return crun_make_error (err, 0, "cannot load `%s`: `%s`", fpath, dlerror ()); ret = handler_manager_add_so (manager, handle, err); if (UNLIKELY (ret < 0)) { dlclose (handle); return ret; } } return 0; #else return crun_make_error (err, ENOTSUP, "dlopen not available"); #endif } struct custom_handler_s * handler_by_name (struct custom_handler_manager_s *manager, const char *name) { size_t i; for (i = 0; i < manager->handlers_len; i++) { if (strcmp (manager->handlers[i]->name, name) == 0) return manager->handlers[i]; if (manager->handlers[i]->alias && strcmp (manager->handlers[i]->alias, name) == 0) return manager->handlers[i]; } return NULL; } void libcrun_handler_manager_print_feature_tags (struct custom_handler_manager_s *manager, FILE *out) { size_t i; for (i = 0; i < manager->handlers_len; i++) if (manager->handlers[i]->feature_string) fprintf (out, "+%s ", manager->handlers[i]->feature_string); } static inline struct custom_handler_instance_s * make_custom_handler_instance_s (struct custom_handler_s *vtable) { struct custom_handler_instance_s *ret = xmalloc0 (sizeof (struct custom_handler_instance_s)); ret->vtable = vtable; ret->cookie = NULL; return ret; } static int find_handler_for_container (struct custom_handler_manager_s *manager, libcrun_container_t *container, struct custom_handler_instance_s **out, libcrun_error_t *err) { size_t i; memset (out, 0, sizeof (*out)); for (i = 0; i < manager->handlers_len; i++) { int ret; if (manager->handlers[i]->can_handle_container == NULL) continue; ret = manager->handlers[i]->can_handle_container (container, err); if (UNLIKELY (ret < 0)) return ret; if (ret) { *out = make_custom_handler_instance_s (manager->handlers[i]); if ((*out)->vtable->load) return (*out)->vtable->load (&((*out)->cookie), err); return 0; } } return 0; } int libcrun_configure_handler (struct custom_handler_manager_s *manager, libcrun_context_t *context, libcrun_container_t *container, struct custom_handler_instance_s **out, libcrun_error_t *err) { const char *explicit_handler; const char *annotation; *out = NULL; // Kubernetes sandbox containers must be executed as regular process // Example sandbox container can contain pause process // See: https://github.com/containers/crun/issues/798 // before invoking handler check if this is not a kubernetes sandbox annotation = find_annotation (container, "io.kubernetes.cri.container-type"); if (annotation && (strcmp (annotation, "sandbox") == 0)) return 0; annotation = find_annotation (container, "run.oci.handler"); /* Fail with EACCESS if global handler is already configured and there was an attempt to override it via spec. */ if (context->handler != NULL && annotation != NULL) return crun_make_error (err, EACCES, "invalid attempt to override already configured global handler: `%s`", context->handler); explicit_handler = context->handler ? context->handler : annotation; /* If an explicit handler was requested, use it. */ if (explicit_handler) { struct custom_handler_s *h; if (manager == NULL) return crun_make_error (err, 0, "handler requested but no manager configured: `%s`", explicit_handler); h = handler_by_name (manager, explicit_handler); if (h) { *out = make_custom_handler_instance_s (h); if ((*out)->vtable->load) return (*out)->vtable->load (&((*out)->cookie), err); return 0; } } if (manager == NULL) return 0; return find_handler_for_container (manager, container, out, err); } crun-1.16.1/src/libcrun/ebpf.c0000644000000000000000000003470014561214571014254 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "ebpf.h" #include "utils.h" #include #include #include #ifdef HAVE_EBPF # include # ifndef HAVE_BPF static int syscall_bpf (int cmd, union bpf_attr *attr, unsigned int size) { return (int) syscall (__NR_bpf, cmd, attr, size); } # define bpf syscall_bpf # endif #endif static inline uint64_t ptr_to_u64 (const void *ptr) { return (uint64_t) (unsigned long) ptr; } enum { HAS_WILDCARD = 1 }; struct bpf_program { size_t allocated; size_t used; unsigned int private; char program[]; }; #ifdef HAVE_EBPF # define BPF_ALU32_IMM(OP, DST, IMM) \ ((struct bpf_insn){ .code = BPF_ALU | BPF_OP (OP) | BPF_K, .dst_reg = DST, .src_reg = 0, .off = 0, .imm = IMM }) # define BPF_LDX_MEM(SIZE, DST, SRC, OFF) \ ((struct bpf_insn){ \ .code = BPF_LDX | BPF_SIZE (SIZE) | BPF_MEM, .dst_reg = DST, .src_reg = SRC, .off = OFF, .imm = 0 }) # define BPF_MOV64_REG(DST, SRC) \ ((struct bpf_insn){ .code = BPF_ALU64 | BPF_MOV | BPF_X, .dst_reg = DST, .src_reg = SRC, .off = 0, .imm = 0 }) # define BPF_JMP_A(OFF) \ ((struct bpf_insn){ .code = BPF_JMP | BPF_JA, .dst_reg = 0, .src_reg = 0, .off = OFF, .imm = 0 }) # define BPF_JMP_IMM(OP, DST, IMM, OFF) \ ((struct bpf_insn){ .code = BPF_JMP | BPF_OP (OP) | BPF_K, .dst_reg = DST, .src_reg = 0, .off = OFF, .imm = IMM }) # define BPF_JMP_REG(OP, DST, SRC, OFF) \ ((struct bpf_insn){ .code = BPF_JMP | BPF_OP (OP) | BPF_X, .dst_reg = DST, .src_reg = SRC, .off = OFF, .imm = 0 }) # define BPF_MOV64_IMM(DST, IMM) \ ((struct bpf_insn){ .code = BPF_ALU64 | BPF_MOV | BPF_K, .dst_reg = DST, .src_reg = 0, .off = 0, .imm = IMM }) # define BPF_MOV32_REG(DST, SRC) \ ((struct bpf_insn){ .code = BPF_ALU | BPF_MOV | BPF_X, .dst_reg = DST, .src_reg = SRC, .off = 0, .imm = 0 }) # define BPF_EXIT_INSN() \ ((struct bpf_insn){ .code = BPF_JMP | BPF_EXIT, .dst_reg = 0, .src_reg = 0, .off = 0, .imm = 0 }) #endif #ifdef HAVE_EBPF static size_t bpf_program_instructions (struct bpf_program *program) { return program->used / (sizeof (struct bpf_insn)); } #endif struct bpf_program * bpf_program_new (size_t size) { struct bpf_program *p = xmalloc (size + sizeof (struct bpf_program)); p->used = 0; p->private = 0; p->allocated = size; return p; } struct bpf_program * bpf_program_append (struct bpf_program *p, void *data, size_t size) { if (p->allocated <= p->used + size) { p->allocated += size * 2; p = xrealloc (p, p->allocated + sizeof (struct bpf_program)); } memcpy (p->program + p->used, data, size); p->used += size; return p; } struct bpf_program * bpf_program_init_dev (struct bpf_program *program, libcrun_error_t *err arg_unused) { #ifdef HAVE_EBPF /* taken from systemd. */ struct bpf_insn pre_insn[] = { /* type -> R2. */ BPF_LDX_MEM (BPF_W, BPF_REG_2, BPF_REG_1, 0), BPF_ALU32_IMM (BPF_AND, BPF_REG_2, 0xFFFF), /* access -> R3. */ BPF_LDX_MEM (BPF_W, BPF_REG_3, BPF_REG_1, 0), BPF_ALU32_IMM (BPF_RSH, BPF_REG_3, 16), /* major -> R4. */ BPF_LDX_MEM (BPF_W, BPF_REG_4, BPF_REG_1, 4), /* minor -> R5. */ BPF_LDX_MEM (BPF_W, BPF_REG_5, BPF_REG_1, 8), }; program = bpf_program_append (program, pre_insn, sizeof (pre_insn)); #endif return program; } struct bpf_program * bpf_program_append_dev (struct bpf_program *program, const char *access, char type, int major, int minor, bool accept, libcrun_error_t *err arg_unused) { #ifdef HAVE_EBPF int i; int bpf_access = 0; int bpf_type = type == 'b' ? BPF_DEVCG_DEV_BLOCK : BPF_DEVCG_DEV_CHAR; bool has_type = type != 'a'; bool has_major = major >= 0; bool has_minor = minor >= 0; bool has_access = false; int number_instructions = 0; struct bpf_insn accept_block[] = { BPF_MOV64_IMM (BPF_REG_0, accept ? 1 : 0), BPF_EXIT_INSN (), }; if (access == NULL) access = ""; if (program->private & HAS_WILDCARD) return program; for (i = 0; access[i]; i++) { switch (access[i]) { case 'r': bpf_access |= BPF_DEVCG_ACC_READ; break; case 'w': bpf_access |= BPF_DEVCG_ACC_WRITE; break; case 'm': bpf_access |= BPF_DEVCG_ACC_MKNOD; break; } } /* if (request.type != device.type) goto next_block: if ((request.access & device.access) != request.access) goto next_block: if (device.major != '*' && request.major != device.major) == 0) goto next_block: if (device.minor != '*' && request.minor != device.minor) == 0) goto next_block: return accept_or_reject; next_block: */ /* If the access is rwm, skip the check. */ has_access = bpf_access != (BPF_DEVCG_ACC_READ | BPF_DEVCG_ACC_WRITE | BPF_DEVCG_ACC_MKNOD); /* Number of instructions to skip the ACCEPT BLOCK. */ number_instructions = (has_type ? 1 : 0) + (has_access ? 3 : 0) + (has_major ? 1 : 0) + (has_minor ? 1 : 0) + 1; if (has_type) { struct bpf_insn i[] = { BPF_JMP_IMM (BPF_JNE, BPF_REG_2, bpf_type, number_instructions) }; number_instructions--; program = bpf_program_append (program, i, sizeof (i)); } if (has_access) { struct bpf_insn i[] = { BPF_MOV32_REG (BPF_REG_1, BPF_REG_3), BPF_ALU32_IMM (BPF_AND, BPF_REG_1, bpf_access), BPF_JMP_REG (BPF_JNE, BPF_REG_1, BPF_REG_3, number_instructions - 2), }; number_instructions -= 3; program = bpf_program_append (program, i, sizeof (i)); } if (has_major) { struct bpf_insn i[] = { BPF_JMP_IMM (BPF_JNE, BPF_REG_4, major, number_instructions) }; number_instructions--; program = bpf_program_append (program, i, sizeof (i)); } if (has_minor) { struct bpf_insn i[] = { BPF_JMP_IMM (BPF_JNE, BPF_REG_5, minor, number_instructions) }; number_instructions--; program = bpf_program_append (program, i, sizeof (i)); } if (has_type == 0 && has_access == 0 && has_major == 0 && has_minor == 0) program->private |= HAS_WILDCARD; program = bpf_program_append (program, accept_block, sizeof (accept_block)); #endif (void) access; (void) type; (void) major; (void) minor; (void) accept; return program; } struct bpf_program * bpf_program_complete_dev (struct bpf_program *program, libcrun_error_t *err arg_unused) { #ifdef HAVE_EBPF struct bpf_insn i[] = { BPF_MOV64_IMM (BPF_REG_0, 0), BPF_EXIT_INSN (), }; if (program->private & HAS_WILDCARD) return program; program = bpf_program_append (program, &i, sizeof (i)); #endif return program; } static int read_all_progs (int dirfd, uint32_t **progs_out, size_t *n_progs_out, libcrun_error_t *err) { #ifdef HAVE_EBPF cleanup_free uint32_t *progs = NULL; union bpf_attr attr; int ret; size_t cur_size; /* The kernel 5.7 has a hard limit of 64, let's be safe if the limit will be increased in future and attempt up to 4096. */ for (cur_size = 64; cur_size <= 4096; cur_size *= 2) { progs = xrealloc (progs, sizeof (uint32_t) * cur_size); memset (&attr, 0, sizeof (attr)); attr.query.target_fd = dirfd; attr.query.attach_type = BPF_CGROUP_DEVICE; attr.query.prog_cnt = cur_size; attr.query.prog_ids = ptr_to_u64 (progs); ret = bpf (BPF_PROG_QUERY, &attr, sizeof (attr)); } while (ret < 0 && errno == ENOSPC) ; if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "bpf query"); *progs_out = progs; progs = NULL; *n_progs_out = attr.query.prog_cnt; return 0; #else (void) dirfd; *progs_out = NULL; *n_progs_out = 0; return crun_make_error (err, 0, "eBPF not supported"); #endif } static int remove_all_progs (int dirfd, uint32_t *progs, size_t n_progs, libcrun_error_t *err) { #ifdef HAVE_EBPF union bpf_attr attr; size_t i; for (i = 0; i < n_progs; i++) { cleanup_close int fd = -1; int ret; memset (&attr, 0, sizeof (attr)); attr.prog_id = progs[i]; fd = bpf (BPF_PROG_GET_FD_BY_ID, &attr, sizeof (attr)); if (UNLIKELY (fd < 0)) { /* Already removed. Nothing to do. */ if (errno == ENOENT) continue; return crun_make_error (err, errno, "cannot open existing eBPF program"); } memset (&attr, 0, sizeof (attr)); attr.attach_type = BPF_CGROUP_DEVICE; attr.target_fd = dirfd; attr.attach_bpf_fd = fd; ret = bpf (BPF_PROG_DETACH, &attr, sizeof (attr)); if (UNLIKELY (ret < 0)) { /* Already removed. Nothing to do. */ if (errno == ENOENT) continue; return crun_make_error (err, errno, "cannot detach eBPF program"); } } return 0; #else (void) dirfd; (void) progs; (void) n_progs; return crun_make_error (err, 0, "eBPF not supported"); #endif } static int ebpf_attach_program (int fd, int dirfd, libcrun_error_t *err) { #ifndef HAVE_EBPF (void) fd; (void) dirfd; (void) read_all_progs; (void) remove_all_progs; return crun_make_error (err, 0, "eBPF not supported"); #else # ifdef BPF_F_REPLACE bool skip_replace = false; # endif const int MAX_ATTEMPTS = 20; int attempt; for (attempt = 0;; attempt++) { cleanup_free uint32_t *progs = NULL; cleanup_close int replacefd = -1; union bpf_attr attr; size_t n_progs = 0; int ret; ret = read_all_progs (dirfd, &progs, &n_progs, err); if (UNLIKELY (ret < 0)) return ret; # ifdef BPF_F_REPLACE /* There is just one program installed, let's attempt an atomic replace if supported. */ if (! skip_replace && n_progs == 1) { memset (&attr, 0, sizeof (attr)); attr.prog_id = progs[0]; replacefd = bpf (BPF_PROG_GET_FD_BY_ID, &attr, sizeof (attr)); if (UNLIKELY (replacefd < 0)) { if (errno == ENOENT && attempt < MAX_ATTEMPTS) { /* Another update might have raced and updated, try again. */ continue; } return crun_make_error (err, errno, "cannot open existing eBPF program"); } } # endif memset (&attr, 0, sizeof (attr)); attr.attach_type = BPF_CGROUP_DEVICE; attr.target_fd = dirfd; attr.attach_bpf_fd = fd; attr.attach_flags = BPF_F_ALLOW_MULTI; # ifdef BPF_F_REPLACE if (replacefd >= 0) { attr.attach_flags = BPF_F_ALLOW_MULTI | BPF_F_REPLACE; attr.replace_bpf_fd = replacefd; } # endif ret = bpf (BPF_PROG_ATTACH, &attr, sizeof (attr)); if (UNLIKELY (ret < 0)) { if (errno == ENOENT && replacefd >= 0 && attempt < MAX_ATTEMPTS) { /* Another update might have already updated the cgroup, try again. */ continue; } # ifdef BPF_F_REPLACE if (errno == EINVAL && replacefd >= 0) { skip_replace = true; continue; } # endif return crun_make_error (err, errno, "bpf attach"); } /* Now that the new program is installed, remove all the programs that were previously installed. */ if (replacefd < 0 && n_progs) return remove_all_progs (dirfd, progs, n_progs, err); return 0; } #endif } static void bump_memlock () { struct rlimit limit; int ret; limit.rlim_cur = RLIM_INFINITY; limit.rlim_max = RLIM_INFINITY; ret = setrlimit (RLIMIT_MEMLOCK, &limit); if (ret == 0) return; /* If the above failed, try to set the current limit to the max configured. */ ret = getrlimit (RLIMIT_MEMLOCK, &limit); if (ret < 0) return; limit.rlim_cur = limit.rlim_max; /* Best effort, ignore errors. */ (void) setrlimit (RLIMIT_MEMLOCK, &limit); } int libcrun_ebpf_load (struct bpf_program *program, int dirfd, const char *pin, libcrun_error_t *err) { #ifndef HAVE_EBPF (void) dirfd; (void) program; (void) pin; (void) ebpf_attach_program; return crun_make_error (err, 0, "eBPF not supported"); #else cleanup_close int fd = -1; union bpf_attr attr; int ret; memset (&attr, 0, sizeof (attr)); attr.prog_type = BPF_PROG_TYPE_CGROUP_DEVICE; attr.insns = ptr_to_u64 (program->program); attr.insn_cnt = bpf_program_instructions (program); attr.license = ptr_to_u64 ("GPL"); /* First try without log. */ fd = bpf (BPF_PROG_LOAD, &attr, sizeof (attr)); if (fd < 0) { /* Prior to Linux 5.11, eBPF programs were accounted to the memlock prlimit. Attempt to bump the limit, if possible. */ bump_memlock (); fd = bpf (BPF_PROG_LOAD, &attr, sizeof (attr)); } if (fd < 0) { const size_t max_log_size = 1 << 20; cleanup_free char *log = NULL; size_t log_size = 8192; retry: log = xrealloc (log, log_size); log[0] = '\0'; attr.log_level = 1; attr.log_buf = ptr_to_u64 (log); attr.log_size = log_size; fd = bpf (BPF_PROG_LOAD, &attr, sizeof (attr)); if (fd < 0) { if (errno == ENOSPC && log_size < max_log_size) { /* The provided buffer was not big enough. */ log_size *= 2; goto retry; } return crun_make_error (err, errno, "bpf create `%s`", log); } } ret = ebpf_attach_program (fd, dirfd, err); if (UNLIKELY (ret < 0)) return ret; /* Optionally pin the program to the specified path. */ if (pin) { unlink (pin); memset (&attr, 0, sizeof (attr)); attr.pathname = ptr_to_u64 (pin); attr.bpf_fd = fd; ret = bpf (BPF_OBJ_PIN, &attr, sizeof (attr)); if (ret < 0) return crun_make_error (err, errno, "bpf pin to `%s`", pin); } return 0; #endif } crun-1.16.1/src/libcrun/error.c0000644000000000000000000002603314614667631014501 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include "utils.h" #include #include #ifdef HAVE_SYSTEMD # include #endif #define YAJL_STR(x) ((const unsigned char *) (x)) enum { LOG_FORMAT_TEXT = 0, LOG_FORMAT_JSON, }; static int log_format; static bool log_also_to_stderr; static int output_verbosity = LIBCRUN_VERBOSITY_ERROR; int libcrun_make_error (libcrun_error_t *err, int status, const char *msg, ...) { va_list args_list; libcrun_error_t ptr; va_start (args_list, msg); *err = xmalloc (sizeof (struct libcrun_error_s)); ptr = *err; ptr->status = status; if (vasprintf (&(ptr->msg), msg, args_list) < 0) OOM (); va_end (args_list); return -status - 1; } int crun_error_wrap (libcrun_error_t *err, const char *fmt, ...) { cleanup_free char *msg = NULL; cleanup_free char *tmp = NULL; va_list args_list; char *swap; int ret; if (err == NULL || *err == NULL) return 0; ret = -(*err)->status - 1; va_start (args_list, fmt); if (vasprintf (&msg, fmt, args_list) < 0) { va_end (args_list); msg = NULL; return ret; } va_end (args_list); xasprintf (&tmp, "%s: %s", msg, (*err)->msg); swap = tmp; tmp = (*err)->msg; (*err)->msg = swap; return ret; } int crun_error_release (libcrun_error_t *err) { libcrun_error_t ptr; if (err == NULL) return 0; ptr = *err; if (ptr == NULL) return 0; free (ptr->msg); free (ptr); *err = NULL; return 0; } int libcrun_error_release (libcrun_error_t *err) { return crun_error_release (err); } void crun_error_write_warning_and_release (FILE *out, libcrun_error_t **err) { libcrun_error_t ref; if (out == NULL) out = stderr; if (err == NULL || *err == NULL) return; ref = **err; if (ref->status) fprintf (out, "%s: %s\n", ref->msg, strerror (ref->status)); else fprintf (out, "%s\n", ref->msg); free (ref->msg); free (ref); **err = NULL; } void libcrun_error_write_warning_and_release (FILE *out, libcrun_error_t **err) { return crun_error_write_warning_and_release (out, err); } int crun_error_get_errno (libcrun_error_t *err) { if (err == NULL || *err == NULL) return 0; return (*err)->status; } typedef char timestamp_t[64]; static void get_timestamp (timestamp_t *timestamp, const char *suffix) { struct timeval tv; struct tm now; gettimeofday (&tv, NULL); gmtime_r (&tv.tv_sec, &now); strftime ((char *) timestamp, 64, "%Y-%m-%dT%H:%M:%S", &now); sprintf (((char *) timestamp) + 19, ".%06lldZ%.8s", (long long int) tv.tv_usec, suffix); } static void * init_syslog (const char *id) { openlog (id, 0, LOG_USER); return NULL; } enum { LOG_TYPE_FILE = 1, LOG_TYPE_SYSLOG = 2, LOG_TYPE_JOURNALD = 3 }; static int get_log_type (const char *log, const char **data) { char *sep = strchr (log, ':'); if (sep == NULL) { *data = log; return LOG_TYPE_FILE; } *data = sep + 1; if (has_prefix (log, "syslog:")) return LOG_TYPE_SYSLOG; if (has_prefix (log, "journald:")) return LOG_TYPE_JOURNALD; if (has_prefix (log, "file:")) return LOG_TYPE_FILE; return -1; } int libcrun_init_logging (crun_output_handler *new_output_handler, void **new_output_handler_arg, const char *id, const char *log, libcrun_error_t *err) { if (log == NULL) { *new_output_handler = log_write_to_stderr; *new_output_handler_arg = NULL; } else { const char *arg = NULL; int log_type = get_log_type (log, &arg); if (log_type < 0) return crun_make_error (err, errno, "unknown log type `%s`", log); switch (log_type) { case LOG_TYPE_FILE: *new_output_handler = log_write_to_stream; *new_output_handler_arg = fopen (arg, "a+e"); if (*new_output_handler_arg == NULL) return crun_make_error (err, errno, "open log file `%s`", log); if (output_verbosity >= LIBCRUN_VERBOSITY_WARNING) setlinebuf (*new_output_handler_arg); break; case LOG_TYPE_SYSLOG: *new_output_handler_arg = init_syslog (arg[0] ? arg : id); *new_output_handler = log_write_to_syslog; break; case LOG_TYPE_JOURNALD: *new_output_handler = log_write_to_journald; *new_output_handler_arg = NULL; break; } } crun_set_output_handler (*new_output_handler, *new_output_handler_arg, log != NULL); return 0; } void log_write_to_stream (int errno_, const char *msg, bool warning, void *arg) { timestamp_t timestamp = { 0, }; FILE *stream = arg; int tty = isatty (fileno (stream)); const char *color_begin = ""; const char *color_end = ""; if (tty) { color_begin = warning ? "\x1b[1;33m" : "\x1b[1;31m"; color_end = "\x1b[0m"; if (log_format == LOG_FORMAT_TEXT) get_timestamp (×tamp, ": "); } if (errno_) fprintf (stream, "%s%s%s: %s%s\n", color_begin, timestamp, msg, strerror (errno_), color_end); else fprintf (stream, "%s%s%s%s\n", color_begin, timestamp, msg, color_end); } void log_write_to_stderr (int errno_, const char *msg, bool warning, void *arg arg_unused) { log_write_to_stream (errno_, msg, warning, stderr); } void log_write_to_syslog (int errno_, const char *msg, bool warning, void *arg arg_unused) { if (errno_ == 0) syslog (warning ? LOG_WARNING : LOG_ERR, "%s", msg); else syslog (warning ? LOG_WARNING : LOG_ERR, "%s: %s", msg, strerror (errno_)); } void log_write_to_journald (int errno_, const char *msg, bool warning, void *arg arg_unused) { (void) errno_; (void) msg; (void) warning; #ifdef HAVE_SYSTEMD if (errno_ == 0) sd_journal_send ("PRIORITY=%d", warning ? LOG_WARNING : LOG_ERR, "MESSAGE=%s", msg, "ID=%s", arg, NULL); else sd_journal_send ("PRIORITY=%d", warning ? LOG_WARNING : LOG_ERR, "MESSAGE=%s: %s", msg, strerror (errno_), "ID=%s", arg, NULL); #endif } static crun_output_handler output_handler = log_write_to_stderr; static void *output_handler_arg = NULL; void libcrun_set_verbosity (int verbosity) { output_verbosity = verbosity; } int libcrun_get_verbosity () { return output_verbosity; } void crun_set_output_handler (crun_output_handler handler, void *arg, bool log_to_stderr) { output_handler = handler; output_handler_arg = arg; log_also_to_stderr = log_to_stderr; } static char * make_json_error (const char *msg, int errno_, bool warning) { const char *level = warning ? "warning" : "error"; const unsigned char *buf = NULL; yajl_gen gen = NULL; char *ret = NULL; size_t buf_len; timestamp_t timestamp = { 0, }; gen = yajl_gen_alloc (NULL); if (gen == NULL) return NULL; get_timestamp (×tamp, ""); yajl_gen_map_open (gen); yajl_gen_string (gen, YAJL_STR ("msg"), strlen ("msg")); if (errno_ == 0) yajl_gen_string (gen, YAJL_STR (msg), strlen (msg)); else { cleanup_free char *tmp = NULL; xasprintf (&tmp, "%s: %s", msg, strerror (errno_)); yajl_gen_string (gen, YAJL_STR (tmp), strlen (tmp)); } yajl_gen_string (gen, YAJL_STR ("level"), strlen ("level")); yajl_gen_string (gen, YAJL_STR (level), strlen (level)); yajl_gen_string (gen, YAJL_STR ("time"), strlen ("time")); yajl_gen_string (gen, YAJL_STR (timestamp), strlen (timestamp)); yajl_gen_map_close (gen); yajl_gen_get_buf (gen, &buf, &buf_len); if (buf) ret = strdup ((const char *) buf); yajl_gen_free (gen); return ret; } static void write_log (int errno_, bool warning, const char *msg, va_list args_list) { int ret; cleanup_free char *output = NULL; cleanup_free char *json = NULL; if (warning && output_verbosity < LIBCRUN_VERBOSITY_WARNING) return; ret = vasprintf (&output, msg, args_list); if (UNLIKELY (ret < 0)) OOM (); if (log_also_to_stderr) log_write_to_stderr (errno_, output, warning, NULL); switch (log_format) { case LOG_FORMAT_TEXT: output_handler (errno_, output, warning, output_handler_arg); break; case LOG_FORMAT_JSON: json = make_json_error (output, errno_, warning); if (json) output_handler (0, json, warning, output_handler_arg); else output_handler (errno_, output, warning, output_handler_arg); break; } } void libcrun_warning (const char *msg, ...) { va_list args_list; va_start (args_list, msg); write_log (0, true, msg, args_list); va_end (args_list); } void libcrun_error (int errno_, const char *msg, ...) { va_list args_list; va_start (args_list, msg); write_log (errno_, false, msg, args_list); va_end (args_list); } void __attribute__ ((noreturn)) libcrun_fail_with_error (int errno_, const char *msg, ...) { va_list args_list; va_start (args_list, msg); write_log (errno_, false, msg, args_list); va_end (args_list); exit (EXIT_FAILURE); } int libcrun_set_log_format (const char *format, libcrun_error_t *err) { if (strcmp (format, "text") == 0) log_format = LOG_FORMAT_TEXT; else if (strcmp (format, "json") == 0) log_format = LOG_FORMAT_JSON; else return crun_make_error (err, 0, "unknown log format type `%s`", format); return 0; } int yajl_error_to_crun_error (int yajl_status, libcrun_error_t *err) { switch (yajl_status) { case yajl_gen_status_ok: return 0; case yajl_gen_keys_must_be_strings: return crun_make_error (err, 0, "generate JSON document: gen keys must be strings"); case yajl_max_depth_exceeded: return crun_make_error (err, 0, "generate JSON document: max depth exceeded"); case yajl_gen_in_error_state: return crun_make_error (err, 0, "generate JSON document: complete JSON document generated"); case yajl_gen_generation_complete: return crun_make_error (err, 0, "generate JSON document: called while in error state"); case yajl_gen_invalid_number: return crun_make_error (err, 0, "generate JSON document: invalid number"); case yajl_gen_no_buf: return crun_make_error (err, 0, "generate JSON document: no buffer provided"); case yajl_gen_invalid_string: return crun_make_error (err, 0, "generate JSON document: invalid string"); default: return crun_make_error (err, 0, "generate JSON document"); } } crun-1.16.1/src/libcrun/intelrdt.c0000644000000000000000000002046614514171717015173 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2023 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "linux.h" #include "utils.h" #include "intelrdt.h" #include #include #include #include #define INTEL_RDT_MOUNT_POINT "/sys/fs/resctrl" #define SCHEMATA_FILE "schemata" #define TASKS_FILE "tasks" #define RDTGROUP_SUPER_MAGIC 0x7655821 static int is_rdt_mounted (libcrun_error_t *err) { struct statfs sfs; int ret; ret = statfs (INTEL_RDT_MOUNT_POINT, &sfs); if (ret < 0) return crun_make_error (err, errno, "statfs `%s`", INTEL_RDT_MOUNT_POINT); return sfs.f_type == RDTGROUP_SUPER_MAGIC; } static int get_rdt_value (char **out, const char *l3_cache_schema, const char *mem_bw_schema) { return xasprintf (out, "%s%s%s\n", l3_cache_schema ?: "", (l3_cache_schema && mem_bw_schema) ? "\n" : "", mem_bw_schema ?: ""); } struct key_value { int key; int value; }; static int kv_cmp (const void *p1, const void *p2) { const struct key_value *kv1 = p1; const struct key_value *kv2 = p2; return kv1->key - kv2->key; } static int count_parts (const char *str) { const char *it; int ret = 0; for (it = str; *it; it++) { if (*it == ';' || *(it + 1) == '\0') ret++; } return ret; } static int read_kv (const char *value, struct key_value *out) { char *endptr; out->key = strtoll (value, &endptr, 10); if (*endptr != '=') return 1; endptr++; out->value = strtoll (endptr, NULL, 16); return 0; } int compare_rdt_configurations (const char *a, const char *b) { cleanup_free struct key_value *kv = NULL; size_t i, n_parts_a = 0, n_parts_b = 0; cleanup_free char *a_copy = NULL; cleanup_free char *b_copy = NULL; const char *it; char *end; int ret; it = strchr (a, ':'); a = it ? it + 1 : a; it = strchr (b, ':'); b = it ? it + 1 : b; n_parts_a = count_parts (a); n_parts_b = count_parts (b); if (n_parts_a != n_parts_b) return 1; kv = xmalloc (sizeof (struct key_value) * (n_parts_a + 1)); end = a_copy = xstrdup (a); i = 0; while ((it = strsep (&end, ";"))) { if (it[0] == '\0') break; ret = read_kv (it, &(kv[i])); if (ret) return 1; i++; } qsort (kv, i, sizeof (struct key_value), kv_cmp); end = b_copy = xstrdup (b); while ((it = strsep (&end, ";"))) { struct key_value key; struct key_value *res; if (it[0] == '\0') break; ret = read_kv (it, &key); if (ret) return 1; res = bsearch (&key, kv, n_parts_a, sizeof (struct key_value), kv_cmp); if (res == NULL || res->value != key.value) return 1; } return 0; } static int validate_rdt_configuration (const char *name, const char *l3_cache_schema, const char *mem_bw_schema, libcrun_error_t *err) { cleanup_free char *existing_content = NULL; cleanup_free char *path = NULL; char *it, *end; int ret; ret = append_paths (&path, err, INTEL_RDT_MOUNT_POINT, name, SCHEMATA_FILE, NULL); if (UNLIKELY (ret < 0)) return ret; ret = read_all_file (path, &existing_content, NULL, err); if (UNLIKELY (ret < 0)) return ret; end = existing_content; while ((it = strsep (&end, "\n"))) { ret = 0; if (mem_bw_schema && has_prefix (it, "MB:")) ret = compare_rdt_configurations (it, mem_bw_schema); if (l3_cache_schema && has_prefix (it, "L3:")) ret = compare_rdt_configurations (it, l3_cache_schema); if (ret) return crun_make_error (err, 0, "the resctl group `%s` has a different configuration", name); } return 0; } static int write_intelrdt_string (int fd, const char *file, const char *l3_cache_schema, const char *mem_bw_schema, libcrun_error_t *err) { cleanup_free char *formatted = NULL; int len, ret; len = get_rdt_value (&formatted, l3_cache_schema, mem_bw_schema); if (len < 0) return crun_make_error (err, errno, "internal error get_rdt_value"); ret = write (fd, formatted, len); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write `%s`", file); return 0; } /* filter any line in the l3_cache_schema that starts with MB:. */ char * intelrdt_clean_l3_cache_schema (const char *l3_cache_schema) { size_t i, j, len = strlen (l3_cache_schema); char *ret; ret = xmalloc (len + 1); for (i = 0, j = 0; i < len; i++) { if (l3_cache_schema[i] == 'M' && l3_cache_schema[i + 1] == 'B' && l3_cache_schema[i + 2] == ':') { i += 3; while (l3_cache_schema[i] != '\n' && l3_cache_schema[i] != '\0') i++; continue; } ret[j++] = l3_cache_schema[i]; } ret[j] = '\0'; return ret; } int resctl_create (const char *name, bool explicit_clos_id, bool *created, const char *l3_cache_schema, const char *mem_bw_schema, libcrun_error_t *err) { cleanup_free char *cleaned_l3_cache_schema = NULL; cleanup_free char *path = NULL; int exist; int ret; ret = is_rdt_mounted (err); if (UNLIKELY (ret < 0)) return ret; if (ret == 0) return crun_make_error (err, 0, "the resctl file system is not mounted"); ret = append_paths (&path, err, INTEL_RDT_MOUNT_POINT, name, NULL); if (UNLIKELY (ret < 0)) return ret; exist = crun_path_exists (path, err); if (UNLIKELY (exist < 0)) return exist; if (l3_cache_schema && strstr (l3_cache_schema, "MB:")) l3_cache_schema = cleaned_l3_cache_schema = intelrdt_clean_l3_cache_schema (l3_cache_schema); /* If the closID was specified and both l3cache and bwSchema are unset, the group must exist. */ if (explicit_clos_id && l3_cache_schema == NULL && mem_bw_schema == NULL) { if (exist) return 0; return crun_make_error (err, 0, "the resctl group `%s` does not exist", name); } /* If the closID exists then it must match the specified configuration. */ if (exist && (l3_cache_schema != NULL || mem_bw_schema != NULL)) return validate_rdt_configuration (name, l3_cache_schema, mem_bw_schema, err); /* At this point, assume it was created. */ *created = true; return crun_ensure_directory (path, 0755, true, err); } int resctl_move_task_to (const char *name, pid_t pid, libcrun_error_t *err) { cleanup_free char *path = NULL; char pid_str[32]; int len; int ret; ret = append_paths (&path, err, INTEL_RDT_MOUNT_POINT, name, TASKS_FILE, NULL); if (UNLIKELY (ret < 0)) return ret; len = sprintf (pid_str, "%d", pid); return write_file (path, pid_str, len, err); } int resctl_update (const char *name, const char *l3_cache_schema, const char *mem_bw_schema, libcrun_error_t *err) { cleanup_free char *cleaned_l3_cache_schema = NULL; cleanup_free char *path = NULL; cleanup_close int fd = -1; int ret; /* Nothing to do. */ if (l3_cache_schema == NULL && mem_bw_schema == NULL) return 0; ret = append_paths (&path, err, INTEL_RDT_MOUNT_POINT, name, SCHEMATA_FILE, NULL); if (UNLIKELY (ret < 0)) return ret; if (l3_cache_schema && strstr (l3_cache_schema, "MB:")) l3_cache_schema = cleaned_l3_cache_schema = intelrdt_clean_l3_cache_schema (l3_cache_schema); fd = open (path, O_WRONLY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `%s`", path); ret = write_intelrdt_string (fd, path, l3_cache_schema, mem_bw_schema, err); if (UNLIKELY (ret < 0)) return ret; return 0; } int resctl_destroy (const char *name, libcrun_error_t *err) { cleanup_free char *path = NULL; int ret; ret = append_paths (&path, err, INTEL_RDT_MOUNT_POINT, name, NULL); if (UNLIKELY (ret < 0)) return ret; ret = rmdir (path); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "rmdir `%s`", path); return 0; } crun-1.16.1/src/libcrun/io_priority.c0000644000000000000000000000474014614667631015721 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2023 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #ifdef HAVE_LINUX_IOPRIO_H # include #endif #include "linux.h" #include "utils.h" #include "io_priority.h" #include #ifdef HAVE_LINUX_IOPRIO_H static int syscall_ioprio_set (int which, int who, int ioprio) { # ifdef __NR_ioprio_set return syscall (__NR_ioprio_set, which, who, ioprio); # else (void) which; (void) who; (void) ioprio; errno = ENOSYS; return -1; # endif } #endif int libcrun_set_io_priority (pid_t pid, runtime_spec_schema_config_schema_process *process, libcrun_error_t *err) { #ifdef HAVE_LINUX_IOPRIO_H int ret, i, class_value, value; struct { const char *name; int value; } classes[] = { { "IOPRIO_CLASS_RT", IOPRIO_CLASS_RT }, { "IOPRIO_CLASS_BE", IOPRIO_CLASS_BE }, { "IOPRIO_CLASS_IDLE", IOPRIO_CLASS_IDLE }, { NULL, 0 }, }; if (process == NULL || process->io_priority == NULL) return 0; class_value = -1; for (i = 0; classes[i].name; i++) if (strcmp (process->io_priority->_class, classes[i].name) == 0) { class_value = i; break; } if (UNLIKELY (class_value < 0)) return crun_make_error (err, 0, "invalid io priority `%s`", process->io_priority->_class); value = IOPRIO_PRIO_VALUE (classes[class_value].value, process->io_priority->priority); ret = syscall_ioprio_set (IOPRIO_WHO_PROCESS, pid, value); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "failed to set io priority"); return 0; #else // If io_priority is not set then return without doing // anything. if (process == NULL || process->io_priority == NULL) return 0; (void) pid; (void) process; return crun_make_error (err, 0, "io priority not supported"); #endif } crun-1.16.1/src/libcrun/linux.c0000644000000000000000000052603114656670105014506 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "linux.h" #include "utils.h" #include #include #include #include #include #ifdef HAVE_FSCONFIG_CMD_CREATE_LINUX_MOUNT_H # include #endif #if defined HAVE_FSCONFIG_CMD_CREATE_LINUX_MOUNT_H || defined HAVE_FSCONFIG_CMD_CREATE_SYS_MOUNT_H # define HAVE_NEW_MOUNT_API #endif #include #ifdef HAVE_CAP # include #endif #include #include #include #include #include #include #include #include "terminal.h" #include "cgroup.h" #include "cgroup-utils.h" #include "status.h" #include "criu.h" #include "scheduler.h" #include "intelrdt.h" #include "io_priority.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "mount_flags.h" #define YAJL_STR(x) ((const unsigned char *) (x)) #ifndef RLIMIT_RTTIME # define RLIMIT_RTTIME 15 #endif #ifndef OPEN_TREE_CLONE # define OPEN_TREE_CLONE 1 #endif #ifndef OPEN_TREE_CLOEXEC # define OPEN_TREE_CLOEXEC O_CLOEXEC #endif #ifndef MOVE_MOUNT_F_EMPTY_PATH # define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 #endif #ifndef MOVE_MOUNT_T_EMPTY_PATH # define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 #endif #ifndef FSOPEN_CLOEXEC # define FSOPEN_CLOEXEC 0x00000001 #endif #ifndef FSMOUNT_CLOEXEC # define FSMOUNT_CLOEXEC 0x00000001 #endif #ifndef FSCONFIG_CMD_CREATE # define FSCONFIG_CMD_CREATE 6 #endif struct remount_s { struct remount_s *next; char *target; int targetfd; unsigned long flags; char *data; }; struct private_data_s { struct remount_s *remounts; /* Filled by libcrun_run_linux_container(). Useful to query what namespaces are available. */ int unshare_flags; #if CLONE_NEWCGROUP int unshare_cgroupns; #endif char *host_notify_socket_path; char *container_notify_socket_path; bool mount_dev_from_host; unsigned long rootfs_propagation; bool deny_setgroups; const char *rootfs; int rootfsfd; size_t rootfs_len; int notify_socket_tree_fd; struct libcrun_fd_map *mount_fds; struct libcrun_fd_map *dev_fds; /* Used to save stdin, stdout, stderr during checkpointing to descriptors.json * and needed during restore. */ char *external_descriptors; }; struct linux_namespace_s { const char *name; const char *ns_file; int value; }; static void cleanup_private_data (void *private_data) { struct private_data_s *p = private_data; if (p->rootfsfd >= 0) TEMP_FAILURE_RETRY (close (p->rootfsfd)); if (p->mount_fds) cleanup_close_mapp (&(p->mount_fds)); if (p->dev_fds) cleanup_close_mapp (&(p->dev_fds)); free (p->host_notify_socket_path); free (p->container_notify_socket_path); free (p->external_descriptors); free (p); } static struct private_data_s * get_private_data (struct libcrun_container_s *container) { if (container->private_data == NULL) { struct private_data_s *p = xmalloc0 (sizeof (*p)); container->private_data = p; p->rootfsfd = -1; p->notify_socket_tree_fd = -1; container->cleanup_private_data = cleanup_private_data; } return container->private_data; } #ifndef CLONE_NEWTIME # define CLONE_NEWTIME 0 #endif #ifndef CLONE_NEWCGROUP # define CLONE_NEWCGROUP 0 #endif #ifndef AT_RECURSIVE # define AT_RECURSIVE 0x8000 #endif static struct linux_namespace_s namespaces[] = { { "mount", "mnt", CLONE_NEWNS }, { "network", "net", CLONE_NEWNET }, { "ipc", "ipc", CLONE_NEWIPC }, { "pid", "pid", CLONE_NEWPID }, { "uts", "uts", CLONE_NEWUTS }, { "user", "user", CLONE_NEWUSER }, #if CLONE_NEWCGROUP { "cgroup", "cgroup", CLONE_NEWCGROUP }, #endif #if CLONE_NEWTIME { "time", "time", CLONE_NEWTIME }, #endif { NULL, NULL, 0 } }; static int get_and_reset (int *old) { int tmp = *old; *old = -1; return tmp; } int libcrun_find_namespace (const char *name) { struct linux_namespace_s *it; for (it = namespaces; it->name; it++) if (strcmp (it->name, name) == 0) return it->value; return -1; } #ifndef __aligned_u64 # define __aligned_u64 uint64_t __attribute__ ((aligned (8))) #endif #ifndef CLONE_INTO_CGROUP # define CLONE_INTO_CGROUP 0x200000000ULL #endif struct _clone3_args { __aligned_u64 flags; __aligned_u64 pidfd; __aligned_u64 child_tid; __aligned_u64 parent_tid; __aligned_u64 exit_signal; __aligned_u64 stack; __aligned_u64 stack_size; __aligned_u64 tls; __aligned_u64 set_tid; __aligned_u64 set_tid_size; __aligned_u64 cgroup; }; static int syscall_getcwd (char *path, size_t len) { return (int) syscall (__NR_getcwd, path, len); } static int syscall_clone3 (struct _clone3_args *args) { #ifdef __NR_clone3 return (int) syscall (__NR_clone3, args, sizeof (*args)); #else (void) args; errno = ENOSYS; return -1; #endif } static int syscall_fsopen (const char *fs_name, unsigned int flags) { #if defined __NR_fsopen return (int) syscall (__NR_fsopen, fs_name, flags); #else (void) fs_name; (void) flags; errno = ENOSYS; return -1; #endif } static int syscall_fsmount (int fsfd, unsigned int flags, unsigned int attr_flags) { #if defined __NR_fsmount return (int) syscall (__NR_fsmount, fsfd, flags, attr_flags); #else (void) fsfd; (void) flags; (void) attr_flags; errno = ENOSYS; return -1; #endif } static int syscall_fsconfig (int fsfd, unsigned int cmd, const char *key, const void *val, int aux) { #if defined __NR_fsconfig return (int) syscall (__NR_fsconfig, fsfd, cmd, key, val, aux); #else (void) fsfd; (void) cmd; (void) key; (void) val; (void) aux; errno = ENOSYS; return -1; #endif } static int syscall_move_mount (int from_dfd, const char *from_pathname, int to_dfd, const char *to_pathname, unsigned int flags) { #if defined __NR_move_mount return (int) syscall (__NR_move_mount, from_dfd, from_pathname, to_dfd, to_pathname, flags); #else (void) from_dfd; (void) from_pathname; (void) to_dfd; (void) to_pathname; (void) flags; errno = ENOSYS; return -1; #endif } /* ignore this being unused - it's (currently) only unused if not building with systemd, but conditioning the definition of syscall_open_tree on HAVE_SYSTEMD seems pretty silly */ __attribute__ ((unused)) static int syscall_open_tree (int dfd, const char *pathname, unsigned int flags) { #if defined __NR_open_tree return (int) syscall (__NR_open_tree, dfd, pathname, flags); #else (void) dfd; (void) pathname; (void) flags; errno = ENOSYS; return -1; #endif } struct mount_attr_s { uint64_t attr_set; uint64_t attr_clr; uint64_t propagation; uint64_t userns_fd; }; #ifndef MOUNT_ATTR_RDONLY # define MOUNT_ATTR_RDONLY 0x00000001 /* Mount read-only */ #endif #ifndef MOUNT_ATTR_IDMAP # define MOUNT_ATTR_IDMAP 0x00100000 /* Idmap mount to @userns_fd in struct mount_attr. */ #endif static int syscall_mount_setattr (int dfd, const char *path, unsigned int flags, struct mount_attr_s *attr) { #ifdef __NR_mount_setattr return (int) syscall (__NR_mount_setattr, dfd, path, flags, attr, sizeof (*attr)); #else (void) dfd; (void) path; (void) flags; (void) attr; errno = ENOSYS; return -1; #endif } static int syscall_keyctl_join (const char *name) { #define KEYCTL_JOIN_SESSION_KEYRING 0x1 return (int) syscall (__NR_keyctl, KEYCTL_JOIN_SESSION_KEYRING, name, 0); } static int syscall_pidfd_open (pid_t pid, unsigned int flags) { #if defined __NR_pidfd_open return (int) syscall (__NR_pidfd_open, pid, flags); #else (void) pid; (void) flags; errno = ENOSYS; return -1; #endif } static int syscall_pidfd_send_signal (int pidfd, int sig, siginfo_t *info, unsigned int flags) { #if defined __NR_pidfd_send_signal return (int) syscall (__NR_pidfd_send_signal, pidfd, sig, info, flags); #else (void) pidfd; (void) sig; (void) info; (void) flags; errno = ENOSYS; return -1; #endif } static int do_mount_setattr (const char *target, int targetfd, uint64_t clear, uint64_t set, libcrun_error_t *err) { struct mount_attr_s attr = { 0, }; int ret; attr.attr_set = set; attr.attr_clr = clear; ret = syscall_mount_setattr (targetfd, "", AT_RECURSIVE | AT_EMPTY_PATH, &attr); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "mount_setattr `/%s`", target); return 0; } static int get_bind_mount (int dirfd, const char *src, bool recursive, bool rdonly, libcrun_error_t *err) { cleanup_close int open_tree_fd = -1; struct mount_attr_s attr = { 0, }; int recursive_flag = (recursive ? AT_RECURSIVE : 0); int ret; if (rdonly) attr.attr_set = MS_RDONLY; errno = 0; open_tree_fd = syscall_open_tree (dirfd, src, AT_NO_AUTOMOUNT | OPEN_TREE_CLOEXEC | OPEN_TREE_CLONE | recursive_flag); if (UNLIKELY (open_tree_fd < 0)) return crun_make_error (err, errno, "open_tree `%s`", src); ret = syscall_mount_setattr (open_tree_fd, "", AT_EMPTY_PATH | recursive_flag, &attr); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "mount_setattr `%s`", src); return get_and_reset (&open_tree_fd); } int parse_idmapped_mount_option (runtime_spec_schema_config_schema *def, bool is_uids, char *option, char **out, size_t *len, libcrun_error_t *err) { size_t written = 0, allocated = 256; cleanup_free char *mappings = NULL; const char *it; mappings = xmalloc (allocated); for (it = option; *it;) { bool relative = false; long value[3]; size_t i; if (*it == '\0') break; if (*it == '#') it++; if (*it == '@') { relative = true; it++; } /* read a triplet: file system id - host id - size. */ for (i = 0; i < 3; i++) { char *endptr = NULL; if (i > 0 && *it == '-') it++; if (*it == '\0') return crun_make_error (err, errno, "invalid mapping specified `%s`", option); errno = 0; value[i] = strtol (it, &endptr, 10); if (errno || endptr == it) return crun_make_error (err, errno, "invalid mapping specified `%s`", option); it = endptr; } if (relative) { runtime_spec_schema_defs_id_mapping **mappings; size_t mappings_len; if (def == NULL || def->linux == NULL || (is_uids && def->linux->uid_mappings_len == 0) || (! is_uids && def->linux->gid_mappings_len == 0)) return crun_make_error (err, 0, "specified a relative mapping without user namespace mappings"); mappings_len = (is_uids ? def->linux->uid_mappings_len : def->linux->gid_mappings_len); mappings = is_uids ? def->linux->uid_mappings : def->linux->gid_mappings; for (i = 0; i < mappings_len; i++) if (value[1] >= mappings[i]->container_id && value[1] < mappings[i]->container_id + mappings[i]->size) break; if (i == mappings_len) return crun_make_error (err, 0, "could not find a user namespace mapping for the relative mapping `%s`", option); value[1] += mappings[i]->host_id - mappings[i]->container_id; } if (written > allocated - 64) { allocated += 256; mappings = xrealloc (mappings, allocated); } written += sprintf (mappings + written, "%ld %ld %ld\n", value[0], value[1], value[2]); } *(mappings + written) = '\0'; *len = written; *out = mappings; mappings = NULL; return 0; } static char * format_mount_mappings (runtime_spec_schema_defs_id_mapping **mappings, size_t mappings_len, size_t *written) { /* 64 is more than enough room to print 3 uint32. */ const size_t max_len_mapping = 64; char *ret; size_t s; *written = 0; ret = xmalloc (max_len_mapping * mappings_len + 1); for (s = 0; s < mappings_len; s++) { size_t len; len = snprintf (ret + *written, max_len_mapping, "%" PRIu32 " %" PRIu32 " %" PRIu32 "\n", mappings[s]->container_id, mappings[s]->host_id, mappings[s]->size); *written += len; } return ret; } static char * format_mount_mapping (uint32_t container_id, uint32_t host_id, uint32_t size, size_t *written) { runtime_spec_schema_defs_id_mapping mapping = { .container_id = container_id, .host_id = host_id, .size = size, }; runtime_spec_schema_defs_id_mapping *mappings[] = { &mapping, NULL, }; return format_mount_mappings (mappings, 1, written); } static bool has_same_mappings (runtime_spec_schema_config_schema *def, runtime_spec_schema_defs_mount *mnt) { size_t s; if (def->linux == NULL) return mnt->uid_mappings_len == 0 && mnt->gid_mappings_len == 0; if (mnt->uid_mappings_len != def->linux->uid_mappings_len) return false; if (mnt->gid_mappings_len != def->linux->gid_mappings_len) return false; for (s = 0; s < mnt->uid_mappings_len; s++) { if (mnt->uid_mappings[s]->container_id != def->linux->uid_mappings[s]->container_id) return false; if (mnt->uid_mappings[s]->host_id != def->linux->uid_mappings[s]->host_id) return false; if (mnt->uid_mappings[s]->size != def->linux->uid_mappings[s]->size) return false; } for (s = 0; s < mnt->gid_mappings_len; s++) { if (mnt->gid_mappings[s]->container_id != def->linux->gid_mappings[s]->container_id) return false; if (mnt->gid_mappings[s]->host_id != def->linux->gid_mappings[s]->host_id) return false; if (mnt->gid_mappings[s]->size != def->linux->gid_mappings[s]->size) return false; } return true; } static pid_t maybe_create_userns_for_idmapped_mount (runtime_spec_schema_config_schema *def, runtime_spec_schema_defs_mount *mnt, const char *options, pid_t *pid_out, libcrun_error_t *err) { cleanup_pid pid_t pid = -1; char proc_file[64]; bool need_new_userns = mnt->uid_mappings_len ? ! has_same_mappings (def, mnt) : options != NULL; if (! need_new_userns) return 0; pid = syscall_clone (CLONE_NEWUSER | SIGCHLD, NULL); if (UNLIKELY (pid < 0)) return crun_make_error (err, errno, "clone"); if (pid == 0) { prctl (PR_SET_PDEATHSIG, SIGKILL); while (1) pause (); _exit (EXIT_SUCCESS); } if (mnt->uid_mappings_len) { cleanup_free char *uid_map = NULL; cleanup_free char *gid_map = NULL; size_t written = 0; int ret; uid_map = format_mount_mappings (mnt->uid_mappings, mnt->uid_mappings_len, &written); sprintf (proc_file, "/proc/%d/uid_map", pid); ret = write_file (proc_file, uid_map, written, err); if (UNLIKELY (ret < 0)) return ret; gid_map = format_mount_mappings (mnt->gid_mappings, mnt->gid_mappings_len, &written); sprintf (proc_file, "/proc/%d/gid_map", pid); ret = write_file (proc_file, gid_map, written, err); if (UNLIKELY (ret < 0)) return ret; } else { cleanup_free char *dup_options = NULL; char *option, *saveptr = NULL; if (! options) return crun_make_error (err, 0, "internal error: no mappings found"); dup_options = xstrdup (options); /* If there are no OCI mappings specified, then parse the annotation. */ for (option = strtok_r (dup_options, ";", &saveptr); option; option = strtok_r (NULL, ";", &saveptr)) { cleanup_free char *mappings = NULL; bool is_uids = false; size_t len = 0; int ret; if (has_prefix (option, "uids=")) { is_uids = true; sprintf (proc_file, "/proc/%d/uid_map", pid); } else if (has_prefix (option, "gids=")) sprintf (proc_file, "/proc/%d/gid_map", pid); else return crun_make_error (err, 0, "invalid option `%s` specified", option); ret = parse_idmapped_mount_option (def, is_uids, option + 5 /* strlen ("uids="), strlen ("gids=")*/, &mappings, &len, err); if (UNLIKELY (ret < 0)) return ret; ret = write_file (proc_file, mappings, len, err); if (UNLIKELY (ret < 0)) return ret; } } *pid_out = pid; pid = -1; return 0; } int libcrun_create_keyring (const char *name, const char *label, libcrun_error_t *err) { const char *const keycreate = "/proc/self/attr/keycreate"; cleanup_close int labelfd = -1; bool label_set = false; int ret; if (label) { labelfd = open (keycreate, O_WRONLY | O_CLOEXEC); if (UNLIKELY (labelfd < 0)) { if (errno != ENOENT) return crun_make_error (err, errno, "open `%s`", keycreate); } else { ret = write (labelfd, label, strlen (label)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write to `%s`", keycreate); label_set = true; } } ret = syscall_keyctl_join (name); if (UNLIKELY (ret < 0)) { if (errno == ENOSYS) { libcrun_warning ("could not create a new keyring: keyctl_join is not supported"); ret = 0; goto out; } ret = crun_make_error (err, errno, "create keyring `%s`", name); goto out; } out: /* Best effort attempt to reset the SELinux label used for new keyrings. */ if (label_set && write (labelfd, "", 0) < 0) { /* Braces around empty body, to fix warning for [-Wunused-result] and error for [-Werror=empty-body]. */ } return ret; } static void get_uid_gid_from_def (runtime_spec_schema_config_schema *def, uid_t *uid, gid_t *gid) { *uid = 0; *gid = 0; if (def->process && def->process->user) { if (def->process->user->uid) *uid = def->process->user->uid; if (def->process->user->gid) *gid = def->process->user->gid; } } static unsigned long get_mount_flags (const char *name, int current_flags, int *found, unsigned long *extra_flags, uint64_t *rec_clear, uint64_t *rec_set) { const struct propagation_flags_s *prop; prop = libcrun_str2mount_flags (name); if (found) *found = prop ? 1 : 0; if (prop == NULL) return 0; if (prop->extra_flags & OPTION_RECURSIVE) { if (rec_clear && prop->clear) *rec_clear |= prop->flags; if (rec_set && ! prop->clear) *rec_set |= prop->flags; } if (extra_flags) *extra_flags |= prop->extra_flags; if (prop->clear) return current_flags & ~prop->flags; return current_flags | prop->flags; } static unsigned long get_mount_flags_or_option (const char *name, int current_flags, unsigned long *extra_flags, char **option, uint64_t *rec_clear, uint64_t *rec_set) { int found; __attribute__ ((unused)) cleanup_free char *prev = NULL; unsigned long flags = get_mount_flags (name, current_flags, &found, extra_flags, rec_clear, rec_set); if (found) return flags; prev = *option; if (*option && **option) xasprintf (option, "%s,%s", *option, name); else *option = xstrdup (name); return 0; } int pivot_root (const char *new_root, const char *put_old) { return syscall (__NR_pivot_root, new_root, put_old); } static void free_remount (struct remount_s *r) { if (r->targetfd >= 0) close (r->targetfd); free (r->data); free (r->target); free (r); } static struct remount_s * make_remount (int targetfd, const char *target, unsigned long flags, const char *data, struct remount_s *next) { struct remount_s *ret = xmalloc (sizeof (*ret)); ret->target = xstrdup (target); ret->flags = flags; ret->data = data ? xstrdup (data) : NULL; ret->next = next; ret->targetfd = targetfd; return ret; } static int do_remount (int targetfd, const char *target, unsigned long flags, const char *data, libcrun_error_t *err) { int ret; proc_fd_path_t target_buffer; const char *real_target = target; if (targetfd >= 0) { get_proc_self_fd_path (target_buffer, targetfd); real_target = target_buffer; } /* Older kernels (seen on 4.18) fail with EINVAL if data is set when setting MS_RDONLY. */ if (flags & (MS_REMOUNT | MS_RDONLY)) data = NULL; ret = mount (NULL, real_target, NULL, flags, data); if (UNLIKELY (ret < 0)) { unsigned long remount_flags; struct statfs sfs; ret = statfs (real_target, &sfs); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "statfs `%s`", real_target); remount_flags = sfs.f_flags & (MS_NOSUID | MS_NODEV | MS_NOEXEC); if ((flags | remount_flags) != flags) { ret = mount (NULL, real_target, NULL, flags | remount_flags, data); if (LIKELY (ret == 0)) return 0; /* If it still fails and MS_RDONLY is present in the mount, try adding it. */ if (sfs.f_flags & MS_RDONLY) { remount_flags = sfs.f_flags & (MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_RDONLY); ret = mount (NULL, real_target, NULL, flags | remount_flags, data); } } if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "remount `%s`", target); } return 0; } static int finalize_mounts (libcrun_container_t *container, libcrun_error_t *err) { int ret = 0; struct remount_s *r = get_private_data (container)->remounts; while (r) { struct remount_s *next = r->next; ret = do_remount (r->targetfd, r->target, r->flags, r->data, err); if (UNLIKELY (ret < 0)) goto cleanup; free_remount (r); r = next; } cleanup: while (r) { struct remount_s *next = r->next; free_remount (r); r = next; } get_private_data (container)->remounts = NULL; return ret; } static int open_mount_target (libcrun_container_t *container, const char *target_rel, libcrun_error_t *err) { const char *rootfs = get_private_data (container)->rootfs; size_t rootfs_len = get_private_data (container)->rootfs_len; int rootfsfd = get_private_data (container)->rootfsfd; if (rootfsfd < 0) return crun_make_error (err, 0, "invalid rootfs state"); return safe_openat (rootfsfd, rootfs, rootfs_len, target_rel, O_PATH | O_CLOEXEC, 0, err); } /* Attempt to open a mount of the specified type. */ static int fsopen_mount (const char *type, const char *labeltype, const char *label) { #ifdef HAVE_NEW_MOUNT_API cleanup_close int fsfd = -1; int ret; fsfd = syscall_fsopen (type, FSOPEN_CLOEXEC); if (UNLIKELY (fsfd < 0)) return fsfd; if (labeltype) { ret = syscall_fsconfig (fsfd, FSCONFIG_SET_STRING, labeltype, label, 0); if (UNLIKELY (ret < 0)) return ret; } ret = syscall_fsconfig (fsfd, FSCONFIG_CMD_CREATE, NULL, NULL, 0); if (UNLIKELY (ret < 0)) return ret; return syscall_fsmount (fsfd, FSMOUNT_CLOEXEC, 0); #else (void) type; (void) syscall_fsopen; (void) syscall_fsconfig; (void) syscall_fsmount; errno = ENOSYS; return -1; #endif } static int fs_move_mount_to (int fd, int dirfd, const char *name) { #ifdef HAVE_NEW_MOUNT_API if (name) return syscall_move_mount (fd, "", dirfd, name, MOVE_MOUNT_F_EMPTY_PATH); return syscall_move_mount (fd, "", dirfd, "", MOVE_MOUNT_T_EMPTY_PATH | MOVE_MOUNT_F_EMPTY_PATH); #else (void) fd; (void) dirfd; (void) name; (void) syscall_move_mount; errno = ENOSYS; return -1; #endif } enum { /* Do not apply any label to the mount. */ LABEL_NONE = 0, /* Apply the label as a mount option. */ LABEL_MOUNT, /* Apply the label using setxattr. */ LABEL_XATTR, }; static int do_mount (libcrun_container_t *container, const char *source, int targetfd, const char *target, const char *fstype, unsigned long mountflags, const void *data, int label_how, libcrun_error_t *err); static bool has_mount_for (libcrun_container_t *container, const char *destination) { size_t i; runtime_spec_schema_config_schema *def = container->container_def; for (i = 0; i < def->mounts_len; i++) { if (strcmp (def->mounts[i]->destination, destination) == 0) return true; } return false; } static int do_masked_or_readonly_path (libcrun_container_t *container, const char *rel_path, bool readonly, bool keep_flags, libcrun_error_t *err) { unsigned long mount_flags = 0; size_t rootfs_len = get_private_data (container)->rootfs_len; const char *rootfs = get_private_data (container)->rootfs; int rootfsfd = get_private_data (container)->rootfsfd; cleanup_close int pathfd = -1; struct statfs sfs; int ret; mode_t mode; if (rel_path[0] == '/') rel_path++; pathfd = safe_openat (rootfsfd, rootfs, rootfs_len, rel_path, O_PATH | O_CLOEXEC, 0, err); if (UNLIKELY (pathfd < 0)) { if (errno != ENOENT && errno != EACCES) return crun_make_error (err, errno, "open `%s`", rel_path); crun_error_release (err); return 0; } if (readonly) { proc_fd_path_t source_buffer; get_proc_self_fd_path (source_buffer, pathfd); mount_flags = MS_BIND | MS_PRIVATE | MS_RDONLY | MS_REC; if (keep_flags) { ret = statfs (source_buffer, &sfs); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "statfs `%s`", source_buffer); mount_flags = mount_flags | sfs.f_flags; // Parent might contain `MS_REMOUNT` but the new readonly path is not // actually mounted. Specifically in the case of `/proc` this will end // up with EINVAL therefore remove `MS_REMOUNT` if it's getting // inherited from the parent. mount_flags = mount_flags & ~MS_REMOUNT; } ret = do_mount (container, source_buffer, pathfd, rel_path, NULL, mount_flags, NULL, LABEL_NONE, err); if (UNLIKELY (ret < 0)) return ret; } else { ret = get_file_type_fd (pathfd, &mode); if (UNLIKELY (ret < 0)) return ret; if ((mode & S_IFMT) == S_IFDIR) ret = do_mount (container, "tmpfs", pathfd, rel_path, "tmpfs", MS_RDONLY, "size=0k", LABEL_MOUNT, err); else ret = do_mount (container, "/dev/null", pathfd, rel_path, NULL, MS_BIND | MS_RDONLY, NULL, LABEL_MOUNT, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static inline const char * get_selinux_context_type (libcrun_container_t *container) { const char *context_type; context_type = find_annotation (container, "run.oci.mount_context_type"); if (context_type) return context_type; return "context"; } static int do_mount (libcrun_container_t *container, const char *source, int targetfd, const char *target, const char *fstype, unsigned long mountflags, const void *data, int label_how, libcrun_error_t *err) { cleanup_free char *data_with_label = NULL; cleanup_close int ms_move_fd = -1; const char *real_target = target; bool single_instance = false; proc_fd_path_t target_buffer; bool needs_remount = false; cleanup_close int fd = -1; const char *label = NULL; int ret = 0; #define ALL_PROPAGATIONS_NO_REC (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE) #define ALL_PROPAGATIONS (MS_REC | ALL_PROPAGATIONS_NO_REC) if (container->container_def->linux && container->container_def->linux->mount_label) label = container->container_def->linux->mount_label; else label_how = LABEL_NONE; if (targetfd >= 0) { get_proc_self_fd_path (target_buffer, targetfd); real_target = target_buffer; needs_remount = true; } if (label_how == LABEL_MOUNT) { const char *context_type = get_selinux_context_type (container); ret = add_selinux_mount_label (&data_with_label, data, label, context_type, err); if (ret < 0) return ret; data = data_with_label; } if (mountflags & MS_MOVE) { if ((mountflags & MS_BIND) || fstype) return crun_make_error (err, 0, "internal error: cannot use MS_MOVE with MS_BIND or fstype"); ret = mount (source, real_target, NULL, MS_MOVE, NULL); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "move mount `%s` to `%s`", source, target); mountflags &= ~MS_MOVE; /* We need to reopen the path as the previous targetfd is underneath the new mountpoint. */ ms_move_fd = open_mount_target (container, target, err); if (UNLIKELY (ms_move_fd < 0)) return fd; targetfd = ms_move_fd; } if ((fstype && fstype[0]) || (mountflags & MS_BIND)) { unsigned long flags = mountflags & ~(ALL_PROPAGATIONS_NO_REC | MS_RDONLY); ret = mount (source, real_target, fstype, flags, data); if (UNLIKELY (ret < 0)) { int saved_errno = errno; if ((mountflags & MS_RDONLY) && targetfd > 0 && fstype && strcmp (fstype, "sysfs") == 0) { /* If we are running in an user namespace, just bind mount /sys if creating sysfs failed. */ ret = check_running_in_user_namespace (err); if (UNLIKELY (ret < 0)) return ret; if (ret > 0) { cleanup_close int mountfd = -1; if (! has_mount_for (container, "/sys/fs/cgroup")) { ret = mount ("/sys", real_target, NULL, MS_BIND | MS_REC, NULL); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "bind mount `/sys` from the host"); return do_masked_or_readonly_path (container, "/sys/fs/cgroup", false, false, err); } mountfd = get_bind_mount (-1, "/sys", true, true, err); if (UNLIKELY (mountfd < 0)) return mountfd; ret = fs_move_mount_to (mountfd, targetfd, NULL); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "move mount to `%s`", real_target); return 0; } } return crun_make_error (err, saved_errno, "mount `%s` to `%s`", source, target); } if (targetfd >= 0) { /* We need to reopen the path as the previous targetfd is underneath the new mountpoint. */ fd = open_mount_target (container, target, err); if (UNLIKELY (fd < 0)) return fd; #ifdef HAVE_FGETXATTR if (label_how == LABEL_XATTR) { proc_fd_path_t proc_file; get_proc_self_fd_path (proc_file, fd); /* We need to go through the proc_file since fd itself is opened as O_PATH. */ (void) setxattr (proc_file, "security.selinux", label, strlen (label), 0); } #endif targetfd = fd; get_proc_self_fd_path (target_buffer, targetfd); real_target = target_buffer; } } if (mountflags & ALL_PROPAGATIONS) { unsigned long rec = mountflags & MS_REC; unsigned long propagation = mountflags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE); if (propagation) { ret = mount (NULL, real_target, NULL, rec | propagation, NULL); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "set propagation for `%s`", target); } } if (mountflags & (MS_BIND | MS_RDONLY)) needs_remount = true; if (data && fstype && strcmp (fstype, "proc") == 0) { single_instance = true; needs_remount = true; } if (needs_remount) { unsigned long remount_flags = MS_REMOUNT | (single_instance ? 0 : MS_BIND) | (mountflags & ~ALL_PROPAGATIONS); if ((remount_flags & MS_RDONLY) == 0) { ret = do_remount (fd, real_target, remount_flags, data, err); if (UNLIKELY (ret < 0)) return ret; } else { struct remount_s *r; if (fd < 0) { fd = dup (targetfd); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "dup `%d`", targetfd); } /* The remount owns the fd. */ r = make_remount (get_and_reset (&fd), target, remount_flags, data, get_private_data (container)->remounts); get_private_data (container)->remounts = r; } } return ret; } static void try_umount (int targetfd, const char *target) { const char *real_target = target; proc_fd_path_t target_buffer; if (targetfd >= 0) { /* Best effort cleanup for the tmpfs. */ get_proc_self_fd_path (target_buffer, targetfd); real_target = target_buffer; } umount2 (real_target, MNT_DETACH); } static bool container_has_cgroupns (libcrun_container_t *container) { bool has_cgroupns = false; #if CLONE_NEWCGROUP has_cgroupns = get_private_data (container)->unshare_flags & CLONE_NEWCGROUP; #endif return has_cgroupns; } static int do_mount_cgroup_v2 (libcrun_container_t *container, int targetfd, const char *target, unsigned long mountflags, const char *unified_cgroup_path, libcrun_error_t *err) { int ret; int cgroup_mode; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; ret = do_mount (container, "cgroup2", targetfd, target, "cgroup2", mountflags, NULL, LABEL_NONE, err); if (UNLIKELY (ret < 0)) { errno = crun_error_get_errno (err); if (errno == EPERM || errno == EBUSY) { const char *src_cgroup; crun_error_release (err); if (errno == EBUSY) { /* If we got EBUSY it means the cgroup file system is already mounted at the targetfd and we cannot stack another one on top of it. First attempt with a temporary mount and then move it to the destination directory. If that cannot be used try mounting a tmpfs below the cgroup mount. */ cleanup_free char *state_dir = NULL; state_dir = libcrun_get_state_directory (container->context->state_root, container->context->id); if (state_dir) { cleanup_free char *tmp_mount_dir = NULL; ret = append_paths (&tmp_mount_dir, err, state_dir, "tmpmount", NULL); if (UNLIKELY (ret < 0)) return ret; ret = crun_ensure_directory (tmp_mount_dir, 0700, true, err); if (ret == 0) { ret = mount ("cgroup2", tmp_mount_dir, "cgroup2", 0, NULL); if (LIKELY (ret == 0)) { ret = do_mount (container, tmp_mount_dir, targetfd, target, NULL, MS_MOVE | mountflags, NULL, LABEL_NONE, err); if (LIKELY (ret == 0)) return 0; /* Best-effort cleanup of now-unused temporary mount */ umount2 (tmp_mount_dir, MNT_DETACH); crun_error_release (err); } } rmdir (tmp_mount_dir); } ret = do_mount (container, "tmpfs", targetfd, target, "tmpfs", MS_PRIVATE, "nr_blocks=1,nr_inodes=1", LABEL_NONE, err); if (LIKELY (ret == 0)) { ret = do_mount (container, "cgroup2", targetfd, target, "cgroup2", mountflags, NULL, LABEL_NONE, err); if (LIKELY (ret == 0)) return ret; /* Best-effort cleanup for the tmpfs, if it fails there is nothing to worry about. */ try_umount (targetfd, target); } /* If the previous method failed, fall back to bind mounting the current cgroup. */ crun_error_release (err); } /* If everything else failed, bind mount from the current cgroup. */ src_cgroup = unified_cgroup_path && container_has_cgroupns (container) ? unified_cgroup_path : CGROUP_ROOT; return do_mount (container, src_cgroup, targetfd, target, NULL, MS_BIND | mountflags, NULL, LABEL_NONE, err); } return ret; } return 0; } static int do_mount_cgroup_systemd_v1 (libcrun_container_t *container, const char *source, int targetfd, const char *target, unsigned long mountflags, libcrun_error_t *err) { int ret; cleanup_close int fd = -1; const char *subsystem = "systemd"; cleanup_free char *subsystem_path = NULL; cleanup_close int tmpfsdirfd = -1; mountflags = mountflags & ~MS_BIND; ret = do_mount (container, source, targetfd, target, "tmpfs", mountflags, "size=1024k", LABEL_NONE, err); if (UNLIKELY (ret < 0)) return ret; /* Get a reference to the newly created cgroup directory. */ tmpfsdirfd = open_mount_target (container, target, err); if (UNLIKELY (tmpfsdirfd < 0)) return tmpfsdirfd; targetfd = tmpfsdirfd; ret = mkdirat (targetfd, subsystem, 0755); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "mkdir `%s`", subsystem); fd = openat (targetfd, subsystem, O_CLOEXEC | O_DIRECTORY | O_NOFOLLOW); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `%s`", subsystem_path); ret = append_paths (&subsystem_path, err, target, subsystem, NULL); if (UNLIKELY (ret < 0)) return ret; return do_mount (container, "cgroup", fd, subsystem_path, "cgroup", mountflags, "none,name=systemd,xattr", LABEL_NONE, err); } static int do_mount_cgroup_v1 (libcrun_container_t *container, const char *source, int targetfd, const char *target, unsigned long mountflags, libcrun_error_t *err) { int ret; cleanup_free char *content = NULL; char *from; cleanup_close int tmpfsdirfd = -1; char *saveptr = NULL; ret = do_mount (container, source, targetfd, target, "tmpfs", mountflags & ~MS_RDONLY, "size=1024k", LABEL_MOUNT, err); if (UNLIKELY (ret < 0)) return ret; tmpfsdirfd = open_mount_target (container, target, err); if (UNLIKELY (tmpfsdirfd < 0)) return tmpfsdirfd; targetfd = tmpfsdirfd; ret = read_all_file (PROC_SELF_CGROUP, &content, NULL, err); if (UNLIKELY (ret < 0)) return ret; if (UNLIKELY (content == NULL || content[0] == '\0')) return crun_make_error (err, 0, "invalid content from `%s`", PROC_SELF_CGROUP); for (from = strtok_r (content, "\n", &saveptr); from; from = strtok_r (NULL, "\n", &saveptr)) { cleanup_free char *source_path = NULL; cleanup_free char *source_subsystem = NULL; cleanup_free char *subsystem_path = NULL; char *subpath, *subsystem, *subsystem_fqn, *it; cleanup_close int subsystemfd = -1; subsystem = strchr (from, ':') + 1; subpath = strchr (subsystem, ':') + 1; *(subpath - 1) = '\0'; if (subsystem[0] == '\0') continue; /* subsystem_fqn includes name= for named hierarchies. */ subsystem_fqn = subsystem; it = strstr (subsystem, "name="); if (it) subsystem = it + 5; if (strcmp (subsystem, "net_prio,net_cls") == 0) subsystem = "net_cls,net_prio"; if (strcmp (subsystem, "cpuacct,cpu") == 0) subsystem = "cpu,cpuacct"; ret = append_paths (&source_subsystem, err, CGROUP_ROOT, subsystem, NULL); if (UNLIKELY (ret < 0)) return ret; /* if there is already a mount specified, do not add a default one. */ if (has_mount_for (container, source_subsystem)) continue; ret = append_paths (&source_path, err, source_subsystem, subpath, NULL); if (UNLIKELY (ret < 0)) return ret; ret = append_paths (&subsystem_path, err, target, subsystem, NULL); if (UNLIKELY (ret < 0)) return ret; ret = mkdirat (targetfd, subsystem, 0755); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "mkdir `%s`", subsystem_path); subsystemfd = openat (targetfd, subsystem, O_CLOEXEC | O_DIRECTORY | O_NOFOLLOW); if (UNLIKELY (subsystemfd < 0)) return crun_make_error (err, errno, "open `%s`", subsystem_path); if (container_has_cgroupns (container)) { ret = do_mount (container, source_path, subsystemfd, subsystem_path, "cgroup", mountflags, subsystem_fqn, LABEL_NONE, err); if (UNLIKELY (ret < 0)) { if (crun_error_get_errno (err) == ENOENT || crun_error_get_errno (err) == ENODEV) { /* We are trying to mount a subsystem that is not present. */ crun_error_release (err); continue; } return ret; } } else { ret = do_mount (container, source_path, subsystemfd, subsystem_path, NULL, MS_BIND | mountflags, NULL, LABEL_NONE, err); if (UNLIKELY (ret < 0)) { if (crun_error_get_errno (err) != ENOENT) return ret; crun_error_release (err); /* We might already be in a container. Mount the source subsystem. */ ret = do_mount (container, source_subsystem, subsystemfd, subsystem_path, NULL, MS_BIND | mountflags, NULL, LABEL_NONE, err); if (UNLIKELY (ret < 0)) { /* If it still fails with ENOENT, ignore the error as the controller might have been dropped and doesn't exist. */ if (crun_error_get_errno (err) != ENOENT) return ret; crun_error_release (err); } } } } ret = libcrun_cgroups_create_symlinks (targetfd, err); if (UNLIKELY (ret < 0)) return ret; return 0; } static int do_mount_cgroup (libcrun_container_t *container, const char *source, int targetfd, const char *target, unsigned long mountflags, const char *unified_cgroup_path, libcrun_error_t *err) { int cgroup_mode; cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; switch (cgroup_mode) { case CGROUP_MODE_UNIFIED: return do_mount_cgroup_v2 (container, targetfd, target, mountflags, unified_cgroup_path, err); case CGROUP_MODE_LEGACY: case CGROUP_MODE_HYBRID: return do_mount_cgroup_v1 (container, source, targetfd, target, mountflags, err); } return crun_make_error (err, 0, "unknown cgroup mode `%d`", cgroup_mode); } struct device_s needed_devs[] = { { "/dev/null", "c", 1, 3, 0666, 0, 0 }, { "/dev/zero", "c", 1, 5, 0666, 0, 0 }, { "/dev/full", "c", 1, 7, 0666, 0, 0 }, { "/dev/tty", "c", 5, 0, 0666, 0, 0 }, { "/dev/random", "c", 1, 8, 0666, 0, 0 }, { "/dev/urandom", "c", 1, 9, 0666, 0, 0 }, {} }; /* Check if the specified path is a direct child of /dev. If it is return a pointer to the basename. */ static const char * relative_path_under_dev (const char *path) { if (path[0] != '/') return path; if (strncmp (path, "/dev/", 5) == 0) { if (strchr (path + 5, '/')) return NULL; return path + 5; } return NULL; } int libcrun_create_dev (libcrun_container_t *container, int devfd, int srcfd, struct device_s *device, bool binds, bool ensure_parent_dir, libcrun_error_t *err) { int ret; dev_t dev; mode_t type = (device->type[0] == 'b') ? S_IFBLK : ((device->type[0] == 'p') ? S_IFIFO : S_IFCHR); const char *fullname = device->path; cleanup_close int fd = -1; int rootfsfd = get_private_data (container)->rootfsfd; const char *rootfs = get_private_data (container)->rootfs; size_t rootfs_len = get_private_data (container)->rootfs_len; const char *rel_dev = relative_path_under_dev (device->path); if (binds) { cleanup_close int fd = -1; if (rel_dev) { fd = openat (devfd, rel_dev, O_NOFOLLOW | O_CLOEXEC | O_PATH | O_NONBLOCK); if (UNLIKELY (fd < 0)) { if (errno == ENOENT) fd = openat (devfd, rel_dev, O_CREAT | O_NOFOLLOW | O_CLOEXEC | O_NONBLOCK, 0700); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "create device `%s`", device->path); } } else { const char *rel_path = consume_slashes (device->path); fd = crun_safe_create_and_open_ref_at (false, rootfsfd, rootfs, rootfs_len, rel_path, 0755, err); if (UNLIKELY (fd < 0)) return fd; } if (srcfd >= 0) { ret = syscall_move_mount (srcfd, "", fd, "", MOVE_MOUNT_T_EMPTY_PATH | MOVE_MOUNT_F_EMPTY_PATH); if (LIKELY (ret >= 0)) return 0; } ret = do_mount (container, fullname, fd, device->path, NULL, MS_BIND | MS_PRIVATE | MS_NOEXEC | MS_NOSUID, NULL, LABEL_MOUNT, err); if (UNLIKELY (ret < 0)) return ret; } else { proc_fd_path_t fd_buffer; dev = makedev (device->major, device->minor); /* Check whether the path is directly under /dev. Since we already have an open fd to /dev and mknodat(2) fails when the destination already exists or is a symlink, it is safe to use it directly. If it is not a direct child, then first get a fd to the dirfd. */ if (rel_dev) { ret = mknodat (devfd, rel_dev, device->mode | type, dev); /* We don't fail when the file already exists. */ if (UNLIKELY (ret < 0 && errno == EEXIST)) return 0; if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "mknod `%s`", device->path); fd = safe_openat (devfd, rootfs, rootfs_len, rel_dev, O_PATH | O_CLOEXEC, 0, err); if (UNLIKELY (fd < 0)) return fd; get_proc_self_fd_path (fd_buffer, fd); ret = chmod (fd_buffer, device->mode); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "fchmodat `%s`", device->path); ret = chown (fd_buffer, device->uid, device->gid); /* lgtm [cpp/toctou-race-condition] */ if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chown `%s`", device->path); } else { char *dirname; cleanup_free char *buffer = NULL; cleanup_close int dirfd = -1; char *basename, *tmp; buffer = xstrdup (device->path); dirname = buffer; tmp = strrchr (buffer, '/'); *tmp = '\0'; basename = tmp + 1; if (dirname[0] == '\0') dirfd = dup (rootfsfd); else { dirfd = safe_openat (rootfsfd, rootfs, rootfs_len, dirname, O_DIRECTORY | O_PATH | O_CLOEXEC, 0, err); if (dirfd < 0 && ensure_parent_dir) { crun_error_release (err); dirfd = crun_safe_create_and_open_ref_at (true, rootfsfd, rootfs, rootfs_len, dirname, 0755, err); } } if (UNLIKELY (dirfd < 0)) return dirfd; ret = mknodat (dirfd, basename, device->mode | type, dev); /* We don't fail when the file already exists. */ if (UNLIKELY (ret < 0 && errno == EEXIST)) return 0; if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "mknod `%s`", device->path); fd = safe_openat (dirfd, rootfs, rootfs_len, basename, O_PATH | O_CLOEXEC, 0, err); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `%s`", device->path); get_proc_self_fd_path (fd_buffer, fd); ret = chmod (fd_buffer, device->mode); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chmod `%s`", device->path); ret = chown (fd_buffer, device->uid, device->gid); /* lgtm [cpp/toctou-race-condition] */ if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chown `%s`", device->path); } } return 0; } struct symlink_s { const char *path; const char *target; bool force; }; static struct symlink_s symlinks[] = { { "/proc/self/fd", "fd", false }, { "/proc/self/fd/0", "stdin", false }, { "/proc/self/fd/1", "stdout", false }, { "/proc/self/fd/2", "stderr", false }, { "/proc/kcore", "core", false }, { "pts/ptmx", "ptmx", true }, { NULL, NULL, false } }; static int create_missing_devs (libcrun_container_t *container, bool binds, libcrun_error_t *err) { int ret; size_t i; struct device_s *it; cleanup_close int devfd = -1; runtime_spec_schema_config_schema *def = container->container_def; const char *rootfs = get_private_data (container)->rootfs; int rootfsfd = get_private_data (container)->rootfsfd; cleanup_close_map struct libcrun_fd_map *dev_fds = NULL; dev_fds = get_private_data (container)->dev_fds; get_private_data (container)->dev_fds = NULL; devfd = openat (rootfsfd, "dev", O_CLOEXEC | O_RDONLY | O_DIRECTORY); if (UNLIKELY (devfd < 0)) return crun_make_error (err, errno, "open /dev directory in `%s`", rootfs); for (i = 0; i < def->linux->devices_len; i++) { struct device_s device = { def->linux->devices[i]->path, def->linux->devices[i]->type, def->linux->devices[i]->major, def->linux->devices[i]->minor, def->linux->devices[i]->file_mode, def->linux->devices[i]->uid, def->linux->devices[i]->gid, }; if (! def->linux->devices[i]->file_mode_present) device.mode = 0666; ret = libcrun_create_dev (container, devfd, dev_fds->fds[i], &device, binds, true, err); if (UNLIKELY (ret < 0)) return ret; } for (it = needed_devs; it->path; it++) { /* make sure the parent directory exists only on the first iteration. */ ret = libcrun_create_dev (container, devfd, -1, it, binds, it == needed_devs, err); if (UNLIKELY (ret < 0)) return ret; } for (i = 0; symlinks[i].target; i++) { retry_symlink: ret = symlinkat (symlinks[i].path, devfd, symlinks[i].target); if (UNLIKELY (ret < 0)) { int saved_errno = errno; if (errno == EEXIST && ! symlinks[i].force) continue; /* If the symlink should be forced, make sure to unlink any existing file at the same path. */ if (errno == EEXIST) { retry_unlink: ret = unlinkat (devfd, symlinks[i].target, 0); if (ret < 0 && errno == EISDIR) ret = unlinkat (devfd, symlinks[i].target, AT_REMOVEDIR); if (ret < 0 && errno == EBUSY) { cleanup_close int tfd = openat (devfd, symlinks[i].target, O_CLOEXEC | O_PATH | O_NOFOLLOW); if (tfd >= 0) { proc_fd_path_t procpath; get_proc_self_fd_path (procpath, tfd); if (umount2 (procpath, MNT_DETACH) == 0) goto retry_unlink; } } if (ret == 0) goto retry_symlink; } return crun_make_error (err, saved_errno, "creating symlink for `/dev/%s`", symlinks[i].target); } } if (container->container_def->process && container->container_def->process->terminal) { ret = crun_ensure_file_at (devfd, "console", 0620, true, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int do_masked_and_readonly_paths (libcrun_container_t *container, libcrun_error_t *err) { size_t i; int ret; runtime_spec_schema_config_schema *def = container->container_def; for (i = 0; i < def->linux->masked_paths_len; i++) { ret = do_masked_or_readonly_path (container, def->linux->masked_paths[i], false, false, err); if (UNLIKELY (ret < 0)) return ret; } for (i = 0; i < def->linux->readonly_paths_len; i++) { ret = do_masked_or_readonly_path (container, def->linux->readonly_paths[i], true, true, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int do_pivot (libcrun_container_t *container, const char *rootfs, libcrun_error_t *err) { int ret; cleanup_close int oldrootfd = open ("/", O_DIRECTORY | O_PATH | O_CLOEXEC); cleanup_close int newrootfd = open (rootfs, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (oldrootfd < 0)) return crun_make_error (err, errno, "open `/`"); if (UNLIKELY (newrootfd < 0)) return crun_make_error (err, errno, "open `%s`", rootfs); ret = fchdir (newrootfd); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "fchdir `%s`", rootfs); ret = pivot_root (".", "."); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "pivot_root"); ret = fchdir (oldrootfd); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "fchdir `%s`", rootfs); ret = do_mount (container, NULL, -1, ".", NULL, MS_REC | MS_PRIVATE, NULL, LABEL_MOUNT, err); if (UNLIKELY (ret < 0)) return ret; ret = umount2 (".", MNT_DETACH); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "umount oldroot"); do { ret = umount2 (".", MNT_DETACH); if (ret < 0 && errno == EINVAL) break; if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "umount oldroot"); } while (ret == 0); ret = chdir ("/"); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chdir to newroot"); return 0; } static int append_tmpfs_mode_if_missing (libcrun_container_t *container, runtime_spec_schema_defs_mount *mount, char **data, libcrun_error_t *err) { size_t rootfs_len = get_private_data (container)->rootfs_len; const char *rootfs = get_private_data (container)->rootfs; int rootfsfd = get_private_data (container)->rootfsfd; bool empty_data = is_empty_string (*data); cleanup_close int fd = -1; struct stat st; int ret; if (*data != NULL && strstr (*data, "mode=")) return 0; fd = safe_openat (rootfsfd, rootfs, rootfs_len, mount->destination, O_CLOEXEC | O_RDONLY, 0, err); if (fd < 0) { if (crun_error_get_errno (err) != ENOENT) return fd; crun_error_release (err); return 0; } ret = fstat (fd, &st); if (ret < 0) return crun_make_error (err, errno, "fstat `%s`", mount->destination); xasprintf (data, "%s%smode=%o", empty_data ? "" : *data, empty_data ? "" : ",", st.st_mode & 07777); return 0; } static int get_default_flags (libcrun_container_t *container, const char *destination, char **data) { if (strcmp (destination, "/proc") == 0) return 0; if (strcmp (destination, "/dev/cgroup") == 0 || strcmp (destination, "/sys/fs/cgroup") == 0) { *data = xstrdup ("none,name="); return MS_NOEXEC | MS_NOSUID | MS_STRICTATIME; } if (strcmp (destination, "/dev") == 0) { *data = xstrdup ("mode=755"); return MS_NOEXEC | MS_STRICTATIME; } if (strcmp (destination, "/dev/shm") == 0) { *data = xstrdup ("mode=1777,size=65536k"); return MS_NOEXEC | MS_NOSUID | MS_NODEV; } if (strcmp (destination, "/dev/mqueue") == 0) return MS_NOEXEC | MS_NOSUID | MS_NODEV; if (strcmp (destination, "/dev/pts") == 0) { if (container->host_uid == 0) *data = xstrdup ("newinstance,ptmxmode=0666,mode=620,gid=5"); else *data = xstrdup ("newinstance,ptmxmode=0666,mode=620"); return MS_NOEXEC | MS_NOSUID; } if (strcmp (destination, "/sys") == 0) return MS_NOEXEC | MS_NOSUID | MS_NODEV; return 0; } static char * append_mode_if_missing (char *data, const char *mode) { char *new_data; bool append; if (data != NULL && strstr (data, "mode=")) return data; append = data != NULL && data[0] != '\0'; if (append) xasprintf (&new_data, "%s,%s", data, mode); else new_data = xstrdup (mode); free (data); return new_data; } static int safe_create_symlink (int rootfsfd, const char *rootfs, size_t rootfs_len, const char *target, const char *destination, libcrun_error_t *err) { cleanup_close int parent_dir_fd = -1; cleanup_free char *buffer = NULL; char *part; int ret; if (is_empty_string (destination)) return crun_make_error (err, 0, "empty destination for symlink `%s`", target); buffer = xstrdup (destination); part = dirname (buffer); parent_dir_fd = crun_safe_create_and_open_ref_at (true, rootfsfd, rootfs, rootfs_len, part, 0755, err); if (UNLIKELY (parent_dir_fd < 0)) return crun_make_error (err, errno, "symlink creation"); /* It is safe to reuse the buffer since it was created with xstrdup (destination). */ strcpy (buffer, destination); part = basename (buffer); ret = symlinkat (target, parent_dir_fd, part); if (UNLIKELY (ret < 0)) { /* If it exists, check if it has the same content, if so just ignore the error. */ if (errno == EEXIST) { cleanup_free char *link = NULL; ssize_t len; len = safe_readlinkat (parent_dir_fd, part, &link, 0, err); if (UNLIKELY (len < 0)) return len; if ((((size_t) len) == strlen (target)) && strncmp (link, target, len) == 0) return 0; return crun_make_error (err, 0, "symlink `%s` already exists with a different content", destination); } return crun_make_error (err, errno, "symlink creation `%s`", target); } return 0; } static const char * get_force_cgroup_v1_annotation (libcrun_container_t *container) { return find_annotation (container, "run.oci.systemd.force_cgroup_v1"); } static int do_mounts (libcrun_container_t *container, int rootfsfd, const char *rootfs, const char *unified_cgroup_path, libcrun_error_t *err) { size_t i; int ret; runtime_spec_schema_config_schema *def = container->container_def; size_t rootfs_len = get_private_data (container)->rootfs_len; const char *systemd_cgroup_v1 = get_force_cgroup_v1_annotation (container); cleanup_close_map struct libcrun_fd_map *mount_fds = NULL; mount_fds = get_private_data (container)->mount_fds; get_private_data (container)->mount_fds = NULL; for (i = 0; i < def->mounts_len; i++) { const char *target = consume_slashes (def->mounts[i]->destination); cleanup_free char *data = NULL; char *type; char *source; unsigned long flags = 0; unsigned long extra_flags = 0; mode_t src_mode = S_IFDIR; cleanup_close int copy_from_fd = -1; cleanup_close int targetfd = -1; bool mounted = false; bool is_sysfs_or_proc; uint64_t rec_clear = 0; uint64_t rec_set = 0; type = def->mounts[i]->type; if (def->mounts[i]->options == NULL) flags = get_default_flags (container, def->mounts[i]->destination, &data); else { size_t j; for (j = 0; j < def->mounts[i]->options_len; j++) flags |= get_mount_flags_or_option (def->mounts[i]->options[j], flags, &extra_flags, &data, &rec_clear, &rec_set); } if (type == NULL && (flags & MS_BIND) == 0) return crun_make_error (err, 0, "invalid mount type for `%s`", def->mounts[i]->destination); if (flags & MS_BIND) { if (path_is_slash_dev (def->mounts[i]->destination)) get_private_data (container)->mount_dev_from_host = true; /* It is used only for error messages. */ type = "bind"; } is_sysfs_or_proc = strcmp (type, "sysfs") == 0 || strcmp (type, "proc") == 0; if (strcmp (type, "tmpfs") == 0) { ret = append_tmpfs_mode_if_missing (container, def->mounts[i], &data, err); if (UNLIKELY (ret < 0)) return ret; } if (def->mounts[i]->source && (flags & MS_BIND)) { proc_fd_path_t proc_buf; const char *path = def->mounts[i]->source; /* If copy-symlink is provided, ignore the pre-opened file descriptor since its source was resolved. */ if (mount_fds->fds[i] >= 0 && ! (extra_flags & OPTION_COPY_SYMLINK)) { get_proc_self_fd_path (proc_buf, mount_fds->fds[i]); path = proc_buf; } ret = get_file_type (&src_mode, (extra_flags & OPTION_COPY_SYMLINK) ? true : false, path); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot stat `%s`", path); data = append_mode_if_missing (data, "mode=1755"); } if (S_ISLNK (src_mode)) { cleanup_free char *target = NULL; ssize_t len; /* If we got here, it means the OPTION_COPY_SYMLINK was provided, so we need to copy the origin symlink instead of performing the mount operation. */ len = safe_readlinkat (AT_FDCWD, def->mounts[i]->source, &target, 0, err); if (UNLIKELY (len < 0)) return len; ret = safe_create_symlink (rootfsfd, rootfs, rootfs_len, target, def->mounts[i]->destination, err); if (UNLIKELY (ret < 0)) return ret; mounted = true; } else if (is_sysfs_or_proc) { /* Enforce sysfs and proc to be mounted on a regular directory. */ ret = openat (rootfsfd, target, O_CLOEXEC | O_NOFOLLOW | O_DIRECTORY); if (UNLIKELY (ret < 0)) { if (errno == ENOENT) { if (strchr (target, '/')) return crun_make_error (err, 0, "invalid target `%s`: it must be mounted at the root", target); ret = mkdirat (rootfsfd, target, 0755); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot mkdir `%s`", target); /* Try opening it again. */ ret = openat (rootfsfd, target, O_CLOEXEC | O_NOFOLLOW | O_DIRECTORY); } else if (errno == ENOTDIR) return crun_make_error (err, errno, "the target `/%s` is invalid", target); if (ret < 0) return crun_make_error (err, errno, "cannot open `%s`", target); } targetfd = ret; } else { bool is_dir = S_ISDIR (src_mode); /* Make sure any other directory/file is created and take a O_PATH reference to it. */ ret = crun_safe_create_and_open_ref_at (is_dir, rootfsfd, rootfs, rootfs_len, target, is_dir ? 01755 : 0755, err); if (UNLIKELY (ret < 0)) return ret; targetfd = ret; } if (extra_flags & OPTION_TMPCOPYUP) { if (strcmp (type, "tmpfs") != 0) return crun_make_error (err, 0, "tmpcopyup can be used only with tmpfs"); /* targetfd is opened with O_PATH, reopen the fd so it can read. */ copy_from_fd = openat (targetfd, ".", O_CLOEXEC | O_RDONLY | O_DIRECTORY); if (UNLIKELY (copy_from_fd < 0)) { if (errno != ENOTDIR) return crun_make_error (err, errno, "cannot reopen `%s`", target); crun_error_release (err); } } source = def->mounts[i]->source ? def->mounts[i]->source : type; /* Check if there is already a mount for the requested file system. */ if (! mounted && mount_fds && mount_fds->fds[i] >= 0) { cleanup_close int mfd = get_and_reset (&(mount_fds->fds[i])); ret = fs_move_mount_to (mfd, targetfd, NULL); if (LIKELY (ret == 0)) { /* Force no MS_BIND flag to not attempt again the bind mount. */ ret = do_mount (container, NULL, mfd, target, NULL, flags & ~MS_BIND, data, LABEL_NONE, err); if (UNLIKELY (ret < 0)) return ret; mounted = true; } } if (! mounted) { if (systemd_cgroup_v1 && strcmp (def->mounts[i]->destination, systemd_cgroup_v1) == 0) { /* Override the cgroup mount with a single named cgroup name=systemd. */ ret = do_mount_cgroup_systemd_v1 (container, source, targetfd, target, flags, err); if (UNLIKELY (ret < 0)) return ret; } else if (strcmp (type, "cgroup") == 0) { ret = do_mount_cgroup (container, source, targetfd, target, flags, unified_cgroup_path, err); if (UNLIKELY (ret < 0)) return ret; } else { int label_how = LABEL_MOUNT; if (is_sysfs_or_proc) label_how = LABEL_NONE; else if (strcmp (type, "mqueue") == 0) label_how = LABEL_XATTR; ret = do_mount (container, source, targetfd, target, type, flags, data, label_how, err); if (UNLIKELY (ret < 0)) return ret; } } if (copy_from_fd >= 0) { int destfd, tmpfd; destfd = safe_openat (rootfsfd, rootfs, rootfs_len, target, O_CLOEXEC | O_DIRECTORY, 0, err); if (UNLIKELY (destfd < 0)) return crun_error_wrap (err, "open target to write for tmpcopyup"); /* take ownership for the fd. */ tmpfd = get_and_reset (©_from_fd); ret = copy_recursive_fd_to_fd (tmpfd, destfd, target, target, err); if (UNLIKELY (ret < 0)) return ret; } if (rec_clear || rec_set) { const bool is_dir = S_ISDIR (src_mode); cleanup_close int dfd = -1; dfd = safe_openat (rootfsfd, rootfs, rootfs_len, target, O_RDONLY | O_PATH | O_CLOEXEC | (is_dir ? O_DIRECTORY : 0), 0, err); if (UNLIKELY (dfd < 0)) return crun_make_error (err, errno, "open mount target `/%s`", target); ret = do_mount_setattr (target, dfd, rec_clear, rec_set, err); if (UNLIKELY (ret < 0)) return ret; } } return 0; } /* * libcrun_container_do_bind_mount * * Allows external plugins and handlers to perform bind `mounts` on container. * returns: 0 if successful anything else states `error` and configures `err` with relevant error. */ int libcrun_container_do_bind_mount (libcrun_container_t *container, char *mount_source, char *mount_destination, char **mount_options, size_t mount_options_len, libcrun_error_t *err) { int ret, rootfsfd; size_t rootfs_len = get_private_data (container)->rootfs_len; const char *target = consume_slashes (mount_destination); cleanup_free char *data = NULL; unsigned long flags = 0; unsigned long extra_flags = 0; cleanup_close int targetfd = -1; int is_dir = 1; uint64_t rec_clear = 0; uint64_t rec_set = 0; const char *rootfs = get_private_data (container)->rootfs; rootfsfd = get_private_data (container)->rootfsfd; if ((rootfsfd < 0) || (rootfs == NULL)) return crun_make_error (err, 0, "invalid rootfs state while performing bind mount from external plugin or handler"); if (mount_options == NULL) flags = get_default_flags (container, mount_destination, &data); else { size_t j; for (j = 0; j < mount_options_len; j++) flags |= get_mount_flags_or_option (mount_options[j], flags, &extra_flags, &data, &rec_clear, &rec_set); } if (path_is_slash_dev (mount_destination)) get_private_data (container)->mount_dev_from_host = true; if (mount_source && (flags & MS_BIND)) { is_dir = crun_dir_p (mount_source, false, err); if (UNLIKELY (is_dir < 0)) return is_dir; data = append_mode_if_missing (data, "mode=1755"); } /* Make sure any other directory/file is created and take a O_PATH reference to it. */ ret = crun_safe_create_and_open_ref_at (is_dir, rootfsfd, rootfs, rootfs_len, target, is_dir ? 01755 : 0755, err); if (UNLIKELY (ret < 0)) return ret; targetfd = ret; int label_how = LABEL_MOUNT; ret = do_mount (container, mount_source, targetfd, target, "bind", flags, data, label_how, err); if (UNLIKELY (ret < 0)) return ret; return 0; } /* Open a fd to the NOTIFY_SOCKET end on the host. If CONTAINER is NULL, then CONTEXT is used to retrieve the path to the socket. */ int get_notify_fd (libcrun_context_t *context, libcrun_container_t *container, int *notify_socket_out, libcrun_error_t *err) { #ifdef HAVE_SYSTEMD cleanup_close int notify_fd = -1; cleanup_free char *host_notify_socket_path = NULL; cleanup_free char *state_dir = NULL; char *host_path = NULL; int ret; if (container && get_private_data (container)->host_notify_socket_path) { const char *parent_dir; parent_dir = get_private_data (container)->host_notify_socket_path; ret = append_paths (&host_notify_socket_path, err, parent_dir, "notify", NULL); if (UNLIKELY (ret < 0)) return ret; host_path = host_notify_socket_path; } *notify_socket_out = -1; if (host_path == NULL) { state_dir = libcrun_get_state_directory (context->state_root, context->id); ret = append_paths (&host_notify_socket_path, err, state_dir, "notify/notify", NULL); if (UNLIKELY (ret < 0)) return ret; host_path = host_notify_socket_path; } notify_fd = open_unix_domain_socket (host_path, 1, err); if (UNLIKELY (notify_fd < 0)) return notify_fd; if (UNLIKELY (chmod (host_path, 0777) < 0)) return crun_make_error (err, errno, "chmod `%s`", host_path); # ifdef HAVE_FGETXATTR if (container && container->container_def->linux && container->container_def->linux->mount_label) { /* Ignore the error. The worst that can happen is that the container fails to notify it is ready. */ (void) setxattr (host_path, "security.selinux", container->container_def->linux->mount_label, strlen (container->container_def->linux->mount_label), 0); } # endif *notify_socket_out = get_and_reset (¬ify_fd); return 1; #else (void) context; (void) container; (void) err; *notify_socket_out = -1; return 0; #endif } #ifdef HAVE_SYSTEMD static int do_notify_socket (libcrun_container_t *container, const char *rootfs, libcrun_error_t *err) { int ret; const char *notify_socket = container->context->notify_socket; cleanup_free char *host_notify_socket_path = NULL; cleanup_free char *container_notify_socket_path = NULL; cleanup_free char *state_dir = libcrun_get_state_directory (container->context->state_root, container->context->id); uid_t container_root_uid = -1; gid_t container_root_gid = -1; int notify_socket_tree_fd; if (notify_socket == NULL) return 0; ret = append_paths (&container_notify_socket_path, err, rootfs, notify_socket, "notify", NULL); if (UNLIKELY (ret < 0)) return ret; ret = append_paths (&host_notify_socket_path, err, state_dir, "notify", NULL); if (UNLIKELY (ret < 0)) return ret; ret = mkdir (host_notify_socket_path, 0700); if (ret < 0) return crun_make_error (err, errno, "mkdir `%s`", host_notify_socket_path); if (get_private_data (container)->unshare_flags & CLONE_NEWUSER) { get_root_in_the_userns (container->container_def, 0, 0, &container_root_uid, &container_root_gid); if (container_root_uid != ((uid_t) -1) && container_root_gid != ((gid_t) -1)) { ret = chown (host_notify_socket_path, container_root_uid, container_root_gid); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chown `%d:%d` `%s`", container_root_uid, container_root_gid, host_notify_socket_path); } } notify_socket_tree_fd = syscall_open_tree (AT_FDCWD, host_notify_socket_path, OPEN_TREE_CLONE | AT_RECURSIVE | OPEN_TREE_CLOEXEC); if (notify_socket_tree_fd >= 0) /* open_tree worked */ get_private_data (container)->notify_socket_tree_fd = notify_socket_tree_fd; else if (errno == EPERM) /* this can happen when trying to run a rootless container; this function is called in the original namespace where the caller is _not_ CAP_SYS_ADMIN - in that case, do nothing, because the bind mount of host_notify_socket_path directly should succeed since it will be readable by the container user. */ ; else if (errno == ENOSYS) /* if open_tree(2) is not available, do nothing; we will try mount(2) in do_finalize_notify_socket */ ; else /* some other error */ return crun_make_error (err, errno, "open_tree `%s`", host_notify_socket_path); get_private_data (container)->host_notify_socket_path = host_notify_socket_path; get_private_data (container)->container_notify_socket_path = container_notify_socket_path; host_notify_socket_path = container_notify_socket_path = NULL; return 0; } #endif static int do_finalize_notify_socket (libcrun_container_t *container, libcrun_error_t *err) { int ret; cleanup_free char *host_notify_socket_path = NULL; cleanup_free char *container_notify_socket_path = NULL; cleanup_free char *container_notify_socket_path_dir_alloc = NULL; char *container_notify_socket_path_dir = NULL; cleanup_close int notify_socket_tree_fd = -1; int did_mount_with_move_mount = 0; host_notify_socket_path = get_private_data (container)->host_notify_socket_path; get_private_data (container)->host_notify_socket_path = NULL; container_notify_socket_path = get_private_data (container)->container_notify_socket_path; get_private_data (container)->container_notify_socket_path = NULL; if (host_notify_socket_path == NULL || container_notify_socket_path == NULL) return 0; container_notify_socket_path_dir_alloc = xstrdup (container_notify_socket_path); container_notify_socket_path_dir = dirname (container_notify_socket_path_dir_alloc); ret = crun_ensure_directory (container_notify_socket_path_dir, 0755, false, err); if (UNLIKELY (ret < 0)) return ret; notify_socket_tree_fd = get_private_data (container)->notify_socket_tree_fd; /* the FD will be unconditionally closed at the end of this function due to cleanup_close above */ get_private_data (container)->notify_socket_tree_fd = -1; if (notify_socket_tree_fd >= 0) { ret = syscall_move_mount (notify_socket_tree_fd, "", AT_FDCWD, container_notify_socket_path_dir, MOVE_MOUNT_F_EMPTY_PATH); if (ret >= 0) /* if move_mount(2) worked, make sure we don't try mount(2) */ did_mount_with_move_mount = 1; else if (errno == ENOSYS) /* do nothing; we will try mount(2) next */ ; else return crun_make_error (err, errno, "move_mount `%d` -> `%s`", notify_socket_tree_fd, container_notify_socket_path_dir); } if (! did_mount_with_move_mount) { ret = do_mount (container, host_notify_socket_path, -1, container_notify_socket_path_dir, NULL, MS_BIND | MS_REC | MS_PRIVATE, NULL, LABEL_MOUNT, err); if (UNLIKELY (ret < 0)) return ret; } return 0; } static int make_parent_mount_private (const char *rootfs, libcrun_error_t *err) { cleanup_close int rootfsfd = -1; proc_fd_path_t proc_path; size_t n_slashes = 1; const char *it; for (it = rootfs; *it; it++) if (*it == '/') n_slashes++; /* rootfs could be a relative path. */ rootfsfd = open (rootfs, O_PATH | O_CLOEXEC); if (UNLIKELY (rootfsfd < 0)) return crun_make_error (err, errno, "open `%s`", rootfs); /* prevent a potential infinite loop. */ while (n_slashes-- > 0) { int ret; errno = 0; cleanup_close int parentfd = -1; get_proc_self_fd_path (proc_path, rootfsfd); ret = mount (NULL, proc_path, NULL, MS_PRIVATE, NULL); if (ret == 0) return 0; parentfd = openat (rootfsfd, "..", O_PATH | O_CLOEXEC); if (parentfd < 0) { ret = faccessat (rootfsfd, "..", X_OK, AT_EACCESS); if (ret != 0) return crun_make_error (err, EACCES, "make `%s` private: a component is not accessible", rootfs); } close_and_reset (&rootfsfd); rootfsfd = get_and_reset (&parentfd); } /* should never get this far. */ return crun_make_error (err, 0, "make `%s` private", rootfs); } int libcrun_set_mounts (struct container_entrypoint_s *entrypoint_args, libcrun_container_t *container, const char *rootfs, set_mounts_cb_t cb, void *cb_data, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; cleanup_free char *unified_cgroup_path = NULL; cleanup_close int rootfsfd_cleanup = -1; unsigned long rootfs_propagation = 0; int rootfsfd = -1; int cgroup_mode; int is_user_ns = 0; int ret = 0; if (rootfs == NULL || def->mounts == NULL) return 0; if (def->linux->rootfs_propagation) rootfs_propagation = get_mount_flags (def->linux->rootfs_propagation, 0, NULL, NULL, NULL, NULL); if ((rootfs_propagation & (MS_SHARED | MS_SLAVE | MS_PRIVATE | MS_UNBINDABLE)) == 0) rootfs_propagation = MS_REC | MS_PRIVATE; get_private_data (container)->rootfs_propagation = rootfs_propagation; if (get_private_data (container)->unshare_flags & CLONE_NEWNS) { ret = do_mount (container, NULL, -1, "/", NULL, rootfs_propagation, NULL, LABEL_MOUNT, err); if (UNLIKELY (ret < 0)) return ret; ret = make_parent_mount_private (rootfs, err); if (UNLIKELY (ret < 0)) return ret; ret = do_mount (container, rootfs, -1, rootfs, NULL, MS_BIND | MS_REC | MS_PRIVATE, NULL, LABEL_MOUNT, err); if (UNLIKELY (ret < 0)) return ret; } if (rootfs == NULL) rootfsfd = AT_FDCWD; else { rootfsfd = rootfsfd_cleanup = open (rootfs, O_PATH | O_CLOEXEC); if (UNLIKELY (rootfsfd < 0)) return crun_make_error (err, errno, "open `%s`", rootfs); } get_private_data (container)->rootfs = rootfs; get_private_data (container)->rootfsfd = rootfsfd; get_private_data (container)->rootfs_len = rootfs ? strlen (rootfs) : 0; // configure handler mounts ret = libcrun_container_notify_handler (entrypoint_args, HANDLER_CONFIGURE_MOUNTS, container, rootfs, err); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "failed configuring mounts for handler at phase: HANDLER_CONFIGURE_MOUNTS"); if (def->root->readonly) { struct remount_s *r; unsigned long remount_flags = MS_REMOUNT | MS_BIND | MS_RDONLY; int fd; fd = dup (rootfsfd); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "dup fd for `%s`", rootfs); r = make_remount (fd, rootfs, remount_flags, NULL, get_private_data (container)->remounts); get_private_data (container)->remounts = r; } cgroup_mode = libcrun_get_cgroup_mode (err); if (UNLIKELY (cgroup_mode < 0)) return cgroup_mode; if (cgroup_mode == CGROUP_MODE_UNIFIED) { /* Read the cgroup path before we enter the cgroupns. */ ret = libcrun_get_current_unified_cgroup (&unified_cgroup_path, true, err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_container_enter_cgroup_ns (container, err); if (UNLIKELY (ret < 0)) return ret; ret = do_mounts (container, rootfsfd, rootfs, unified_cgroup_path, err); if (UNLIKELY (ret < 0)) return ret; free (unified_cgroup_path); unified_cgroup_path = NULL; is_user_ns = (get_private_data (container)->unshare_flags & CLONE_NEWUSER); if (! is_user_ns) { is_user_ns = check_running_in_user_namespace (err); if (UNLIKELY (is_user_ns < 0)) return is_user_ns; } if (! get_private_data (container)->mount_dev_from_host) { ret = create_missing_devs (container, is_user_ns ? true : false, err); if (UNLIKELY (ret < 0)) return ret; } /* Notify the callback after all the mounts are ready but before making them read-only. */ if (cb) { ret = cb (cb_data, err); if (UNLIKELY (ret < 0)) return ret; } ret = do_finalize_notify_socket (container, err); if (UNLIKELY (ret < 0)) return ret; if (def->process && def->process->cwd) { libcrun_error_t tmp_err = NULL; const char *rel_cwd = consume_slashes (def->process->cwd); /* Ignore errors here and let it fail later. */ (void) crun_safe_ensure_directory_at (rootfsfd, rootfs, strlen (rootfs), rel_cwd, 0755, &tmp_err); crun_error_release (&tmp_err); } ret = do_masked_and_readonly_paths (container, err); if (UNLIKELY (ret < 0)) return ret; ret = finalize_mounts (container, err); if (UNLIKELY (ret < 0)) return ret; // configure handler mounts for phase: HANDLER_CONFIGURE_AFTER_MOUNTS ret = libcrun_container_notify_handler (entrypoint_args, HANDLER_CONFIGURE_AFTER_MOUNTS, container, rootfs, err); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "failed configuring mounts for handler at phase: HANDLER_CONFIGURE_AFTER_MOUNTS"); get_private_data (container)->rootfsfd = -1; return 0; } static int umount_or_hide (const char *target, libcrun_error_t *err) { int ret; ret = umount2 (target, MNT_DETACH); if (UNLIKELY (ret < 0)) { int saved_errno = errno; /* If the umount2 failed with EINVAL then the mount could be locked. Hide it by mounting a tmpfs on top of it. */ if (errno == EINVAL) { ret = mount (NULL, target, "tmpfs", 0, "size=0k"); if (LIKELY (ret == 0)) return 0; } return crun_make_error (err, saved_errno, "umount `%s`", target); } return ret; } static int move_root (const char *rootfs, libcrun_error_t *err) { int ret; ret = chdir (rootfs); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chdir to `%s`", rootfs); ret = umount_or_hide ("/sys", err); if (UNLIKELY (ret < 0)) return ret; ret = umount_or_hide ("/proc", err); if (UNLIKELY (ret < 0)) return ret; ret = mount (rootfs, "/", "", MS_MOVE, ""); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "mount MS_MOVE to `/`"); ret = chroot ("."); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chroot to `%s`", rootfs); ret = chdir ("/"); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chdir to `%s`", rootfs); return 0; } int libcrun_do_pivot_root (libcrun_container_t *container, bool no_pivot, const char *rootfs, libcrun_error_t *err) { int ret; if (get_private_data (container)->unshare_flags & CLONE_NEWNS) { if (no_pivot) { ret = move_root (rootfs, err); if (UNLIKELY (ret < 0)) return ret; } else { ret = do_pivot (container, rootfs, err); if (UNLIKELY (ret < 0)) return ret; } ret = do_mount (container, NULL, -1, "/", NULL, get_private_data (container)->rootfs_propagation, NULL, LABEL_MOUNT, err); if (UNLIKELY (ret < 0)) return ret; } else { ret = chroot (rootfs); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chroot to `%s`", rootfs); } ret = chdir ("/"); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chdir to `/`"); return 0; } /* If one of stdin, stdout, stderr are pointing to /dev/null on * the outside of the container, this moves it to /dev/null inside * of the container. This needs to run after pivot/chroot-ing. */ int libcrun_reopen_dev_null (libcrun_error_t *err) { struct stat dev_null; struct stat statbuf; cleanup_close int fd; int i; /* Open /dev/null inside of the container. */ fd = open ("/dev/null", O_RDWR | O_CLOEXEC); if (UNLIKELY (fd == -1)) return crun_make_error (err, errno, "failed open()ing `/dev/null`"); if (UNLIKELY (fstat (fd, &dev_null) == -1)) return crun_make_error (err, errno, "failed stat()ing `/dev/null`"); for (i = 0; i <= 2; i++) { if (UNLIKELY (fstat (i, &statbuf) == -1)) return crun_make_error (err, errno, "failed stat()ing fd `%d`", i); if (statbuf.st_rdev == dev_null.st_rdev) { /* This FD is pointing to /dev/null. Point it to /dev/null inside * of the container. */ if (UNLIKELY (dup2 (fd, i) == -1)) return crun_make_error (err, errno, "failed dup2()ing `%d`", i); } } return 0; } static int uidgidmap_helper (char *helper, pid_t pid, char *map_file, libcrun_error_t *err) { #define MAX_ARGS 20 char pid_fmt[16]; char *args[MAX_ARGS + 1]; char *next; size_t nargs = 0; args[nargs++] = helper; sprintf (pid_fmt, "%d", pid); args[nargs++] = pid_fmt; next = map_file; while (nargs < MAX_ARGS) { char *p = strsep (&next, " \n"); if (next == NULL) break; args[nargs++] = p; } args[nargs++] = NULL; return run_process (args, err) ? -1 : 0; } static int newgidmap (pid_t pid, char *map_file, libcrun_error_t *err) { return uidgidmap_helper ("newgidmap", pid, map_file, err); } static int newuidmap (pid_t pid, char *map_file, libcrun_error_t *err) { return uidgidmap_helper ("newuidmap", pid, map_file, err); } static int deny_setgroups (libcrun_container_t *container, pid_t pid, libcrun_error_t *err) { int ret; cleanup_free char *groups_file = NULL; xasprintf (&groups_file, "/proc/%d/setgroups", pid); ret = write_file (groups_file, "deny", 4, err); if (ret >= 0) get_private_data (container)->deny_setgroups = true; return ret; } static int can_setgroups (libcrun_container_t *container, libcrun_error_t *err) { int ret; cleanup_free char *content = NULL; if (get_private_data (container)->deny_setgroups) return 0; if (container->container_def->annotations) { const char *annotation; /* Skip setgroups if the annotation is set to anything different than "0". */ annotation = find_annotation (container, "run.oci.keep_original_groups"); if (annotation) return strcmp (annotation, "0") == 0 ? 1 : 0; } ret = read_all_file ("/proc/self/setgroups", &content, NULL, err); if (ret < 0) return ret; return strncmp (content, "deny", 4) == 0 ? 0 : 1; } int libcrun_container_setgroups (libcrun_container_t *container, runtime_spec_schema_config_schema_process *process, libcrun_error_t *err) { gid_t *additional_gids = NULL; size_t additional_gids_len = 0; int can_do_setgroups; int ret; if (process != NULL && process->user != NULL) { additional_gids = process->user->additional_gids; additional_gids_len = process->user->additional_gids_len; } can_do_setgroups = can_setgroups (container, err); if (UNLIKELY (can_do_setgroups < 0)) return can_do_setgroups; if (can_do_setgroups == 0) return 0; ret = setgroups (additional_gids_len, additional_gids); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "setgroups"); return 0; } int libcrun_container_enter_cgroup_ns (libcrun_container_t *container, libcrun_error_t *err) { #if CLONE_NEWCGROUP if (get_private_data (container)->unshare_cgroupns) { int ret = unshare (CLONE_NEWCGROUP); if (UNLIKELY (ret < 0)) { if (errno != EINVAL) return crun_make_error (err, errno, "unshare (CLONE_NEWCGROUP)"); } } #endif return 0; } // determine whether the uid/gid mappings only contain a single entry // that maps the host uid/gid on the process->user->uid/gid int is_single_mapping (runtime_spec_schema_defs_id_mapping **mappings, size_t len, uint32_t host_id, uint32_t container_id) { if (len != 1) return 0; if (mappings[0]->size != 1) return 0; if (mappings[0]->container_id != container_id || mappings[0]->host_id != host_id) return 0; return 1; } int libcrun_set_usernamespace (libcrun_container_t *container, pid_t pid, libcrun_error_t *err) { cleanup_free char *uid_map_file = NULL; cleanup_free char *gid_map_file = NULL; cleanup_free char *uid_map = NULL; cleanup_free char *gid_map = NULL; size_t uid_map_len = 0, gid_map_len = 0; int ret = 0; runtime_spec_schema_config_schema *def = container->container_def; if ((get_private_data (container)->unshare_flags & CLONE_NEWUSER) == 0) return 0; if (def->linux->uid_mappings_len) uid_map = format_mount_mappings (def->linux->uid_mappings, def->linux->uid_mappings_len, &uid_map_len); else { uid_map_len = format_default_id_mapping (&uid_map, container->container_uid, container->host_uid, container->host_uid, 1); if (uid_map == NULL) uid_map = format_mount_mapping (0, container->host_uid, container->host_uid + 1, &uid_map_len); } if (def->linux->gid_mappings_len) gid_map = format_mount_mappings (def->linux->gid_mappings, def->linux->gid_mappings_len, &gid_map_len); else { gid_map_len = format_default_id_mapping (&gid_map, container->container_gid, container->host_uid, container->host_gid, 0); if (gid_map == NULL) gid_map = format_mount_mapping (0, container->host_gid, container->host_gid + 1, &gid_map_len); } if (container->host_uid) ret = newgidmap (pid, gid_map, err); if (container->host_uid == 0 || ret < 0) { if (ret < 0) { if (! def->linux->uid_mappings_len) libcrun_warning ("unable to invoke `newgidmap`, will try creating a user namespace with single mapping as an alternative"); crun_error_release (err); } xasprintf (&gid_map_file, "/proc/%d/gid_map", pid); ret = write_file (gid_map_file, gid_map, gid_map_len, err); if (ret < 0 && (! def->linux->gid_mappings_len || is_single_mapping (def->linux->gid_mappings, def->linux->gid_mappings_len, container->host_gid, container->container_gid))) { size_t single_mapping_len; cleanup_free char *single_mapping = NULL; crun_error_release (err); ret = deny_setgroups (container, pid, err); if (UNLIKELY (ret < 0)) return ret; single_mapping = format_mount_mapping (container->container_gid, container->host_gid, 1, &single_mapping_len); ret = write_file (gid_map_file, single_mapping, single_mapping_len, err); } } if (UNLIKELY (ret < 0)) return ret; if (container->host_uid) ret = newuidmap (pid, uid_map, err); if (container->host_uid == 0 || ret < 0) { if (ret < 0) { if (! def->linux->uid_mappings_len) libcrun_warning ("unable to invoke `newuidmap`, will try creating a user namespace with single mapping as an alternative"); crun_error_release (err); } xasprintf (&uid_map_file, "/proc/%d/uid_map", pid); ret = write_file (uid_map_file, uid_map, uid_map_len, err); if (ret < 0 && (! def->linux->uid_mappings_len || is_single_mapping (def->linux->uid_mappings, def->linux->uid_mappings_len, container->host_uid, container->container_uid))) { size_t single_mapping_len; cleanup_free char *single_mapping = NULL; crun_error_release (err); if (! get_private_data (container)->deny_setgroups) { ret = deny_setgroups (container, pid, err); if (UNLIKELY (ret < 0)) return ret; } single_mapping = format_mount_mapping (container->container_uid, container->host_uid, 1, &single_mapping_len); ret = write_file (uid_map_file, single_mapping, single_mapping_len, err); } } if (UNLIKELY (ret < 0)) return ret; return 0; } #define CAP_TO_MASK_0(x) (1L << ((x) & 31)) #define CAP_TO_MASK_1(x) CAP_TO_MASK_0 (x - 32) struct all_caps_s { unsigned long effective[2]; unsigned long permitted[2]; unsigned long inheritable[2]; unsigned long ambient[2]; unsigned long bounding[2]; }; static int has_cap_on (int cap, long unsigned *caps) { if (cap < 32) return CAP_TO_MASK_0 (cap) & caps[0]; return (CAP_TO_MASK_1 (cap) & caps[1]); } static unsigned long cap_last_cap; int libcrun_init_caps (libcrun_error_t *err) { const char *const cap_last_cap_file = "/proc/sys/kernel/cap_last_cap"; cleanup_close int fd = -1; int ret; char buffer[16]; fd = open (cap_last_cap_file, O_RDONLY | O_CLOEXEC); if (fd < 0) return crun_make_error (err, errno, "open `%s`", cap_last_cap_file); ret = TEMP_FAILURE_RETRY (read (fd, buffer, sizeof (buffer))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "read from `%s`", cap_last_cap_file); errno = 0; cap_last_cap = strtoul (buffer, NULL, 10); if (errno != 0) return crun_make_error (err, errno, "strtoul() from `%s`", cap_last_cap_file); return 0; } static int set_required_caps (struct all_caps_s *caps, uid_t uid, gid_t gid, int no_new_privs, libcrun_error_t *err) { #ifdef HAVE_CAP unsigned long cap; int ret; struct __user_cap_header_struct hdr = { _LINUX_CAPABILITY_VERSION_3, 0 }; struct __user_cap_data_struct data[2] = { { 0 } }; if (cap_last_cap == 0) return crun_make_error (err, 0, "internal error: max number of capabilities not initialized"); for (cap = 0; cap <= cap_last_cap; cap++) if (! has_cap_on (cap, caps->bounding)) { ret = prctl (PR_CAPBSET_DROP, cap, 0, 0, 0); if (UNLIKELY (ret < 0 && ! (errno == EINVAL))) return crun_make_error (err, errno, "prctl drop bounding"); } data[0].effective = caps->effective[0]; data[1].effective = caps->effective[1]; data[0].inheritable = caps->inheritable[0]; data[1].inheritable = caps->inheritable[1]; data[0].permitted = caps->permitted[0]; data[1].permitted = caps->permitted[1]; ret = prctl (PR_SET_KEEPCAPS, 1, 0, 0, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "error while setting `PR_SET_KEEPCAPS`"); ret = setresgid (gid, gid, gid); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot setresgid to `%d`", gid); ret = setresuid (uid, uid, uid); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot setresuid to `%d`", uid); ret = capset (&hdr, data); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "capset"); # ifdef PR_CAP_AMBIENT ret = prctl (PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0); if (UNLIKELY (ret < 0 && ! (errno == EINVAL || errno == EPERM))) return crun_make_error (err, errno, "prctl reset ambient"); for (cap = 0; cap <= cap_last_cap; cap++) if (has_cap_on (cap, caps->ambient)) { ret = prctl (PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, cap, 0, 0); if (UNLIKELY (ret < 0 && ! (errno == EINVAL || errno == EPERM))) return crun_make_error (err, errno, "prctl ambient raise"); } # endif #endif if (no_new_privs) if (UNLIKELY (prctl (PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0)) return crun_make_error (err, errno, "no new privs"); return 0; } static int read_caps (unsigned long caps[2], char **values, size_t len) { #ifdef HAVE_CAP size_t i; for (i = 0; i < len; i++) { cap_value_t cap; if (cap_from_name (values[i], &cap) < 0) { libcrun_warning ("unknown cap: `%s`", values[i]); continue; } if (cap < 32) caps[0] |= CAP_TO_MASK_0 (cap); else caps[1] |= CAP_TO_MASK_1 (cap); } #else caps[0] = 0; caps[1] = 0; #endif return 0; } int libcrun_set_selinux_label (runtime_spec_schema_config_schema_process *proc, bool now, libcrun_error_t *err) { if (proc->selinux_label) return set_selinux_label (proc->selinux_label, now, err); return 0; } int libcrun_set_apparmor_profile (runtime_spec_schema_config_schema_process *proc, bool now, libcrun_error_t *err) { if (proc->apparmor_profile) return set_apparmor_profile (proc->apparmor_profile, proc->no_new_privileges, now, err); return 0; } int libcrun_set_caps (runtime_spec_schema_config_schema_process_capabilities *capabilities, uid_t uid, gid_t gid, int no_new_privileges, libcrun_error_t *err) { struct all_caps_s caps = {}; if (capabilities) { read_caps (caps.effective, capabilities->effective, capabilities->effective_len); read_caps (caps.inheritable, capabilities->inheritable, capabilities->inheritable_len); read_caps (caps.ambient, capabilities->ambient, capabilities->ambient_len); read_caps (caps.bounding, capabilities->bounding, capabilities->bounding_len); read_caps (caps.permitted, capabilities->permitted, capabilities->permitted_len); } return set_required_caps (&caps, uid, gid, no_new_privileges, err); } struct rlimit_s { const char *name; int value; }; struct rlimit_s rlimits[] = { { "RLIMIT_AS", RLIMIT_AS }, { "RLIMIT_CORE", RLIMIT_CORE }, { "RLIMIT_CPU", RLIMIT_CPU }, { "RLIMIT_DATA", RLIMIT_DATA }, { "RLIMIT_FSIZE", RLIMIT_FSIZE }, { "RLIMIT_LOCKS", RLIMIT_LOCKS }, { "RLIMIT_MEMLOCK", RLIMIT_MEMLOCK }, { "RLIMIT_MSGQUEUE", RLIMIT_MSGQUEUE }, { "RLIMIT_NICE", RLIMIT_NICE }, { "RLIMIT_NOFILE", RLIMIT_NOFILE }, { "RLIMIT_NPROC", RLIMIT_NPROC }, { "RLIMIT_RSS", RLIMIT_RSS }, { "RLIMIT_RTPRIO", RLIMIT_RTPRIO }, { "RLIMIT_RTTIME", RLIMIT_RTTIME }, { "RLIMIT_SIGPENDING", RLIMIT_SIGPENDING }, { "RLIMIT_STACK", RLIMIT_STACK }, { NULL, 0 } }; static int get_rlimit_resource (const char *name) { struct rlimit_s *it; for (it = rlimits; it->name; it++) if (strcmp (it->name, name) == 0) return it->value; return -1; } int libcrun_set_rlimits (runtime_spec_schema_config_schema_process_rlimits_element **new_rlimits, size_t len, libcrun_error_t *err) { size_t i; for (i = 0; i < len; i++) { struct rlimit limit; char *type = new_rlimits[i]->type; int resource = get_rlimit_resource (type); if (UNLIKELY (resource < 0)) return crun_make_error (err, 0, "invalid rlimit `%s`", type); limit.rlim_cur = new_rlimits[i]->soft; limit.rlim_max = new_rlimits[i]->hard; if (UNLIKELY (setrlimit (resource, &limit) < 0)) return crun_make_error (err, errno, "setrlimit `%s`", type); } return 0; } int libcrun_set_hostname (libcrun_container_t *container, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; int has_uts = get_private_data (container)->unshare_flags & CLONE_NEWUTS; int ret; if (def->hostname == NULL || def->hostname[0] == '\0') return 0; if (! has_uts) return crun_make_error (err, 0, "hostname requires the UTS namespace"); ret = sethostname (def->hostname, strlen (def->hostname)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "sethostname"); return 0; } int libcrun_set_domainname (libcrun_container_t *container, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; int has_uts = get_private_data (container)->unshare_flags & CLONE_NEWUTS; int ret; if (is_empty_string (def->domainname)) return 0; if (! has_uts) return crun_make_error (err, 0, "domainname requires the UTS namespace"); ret = setdomainname (def->domainname, strlen (def->domainname)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "setdomainname"); return 0; } int libcrun_set_oom (libcrun_container_t *container, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; cleanup_close int fd = -1; int ret; char oom_buffer[16]; if (def->process == NULL || ! def->process->oom_score_adj_present) return 0; sprintf (oom_buffer, "%i", def->process->oom_score_adj); fd = open ("/proc/self/oom_score_adj", O_RDWR | O_CLOEXEC); if (fd < 0) return crun_make_error (err, errno, "open `/proc/self/oom_score_adj`"); ret = TEMP_FAILURE_RETRY (write (fd, oom_buffer, strlen (oom_buffer))); if (ret < 0) return crun_make_error (err, errno, "write to `/proc/self/oom_score_adj`"); return 0; } const char *sysctlRequiringIPC[] = { "kernel/msgmax", "kernel/msgmnb", "kernel/msgmni", "kernel/sem", "kernel/shmall", "kernel/shmmax", "kernel/shmmni", "kernel/shm_rmid_forced", NULL }; static int validate_sysctl (const char *original_key, const char *original_value, const char *name, unsigned long namespaces_created, runtime_spec_schema_config_schema *def, libcrun_error_t *err) { const char *namespace = ""; name = consume_slashes (name); if (has_prefix (name, "fs/mqueue/")) { if (namespaces_created & CLONE_NEWIPC) return 0; namespace = "IPC"; goto fail; } if (has_prefix (name, "kernel/")) { size_t i; for (i = 0; sysctlRequiringIPC[i]; i++) if (strcmp (sysctlRequiringIPC[i], name) == 0) { if (namespaces_created & CLONE_NEWIPC) return 0; namespace = "IPC"; goto fail; } if (strcmp (name, "kernel/domainname") == 0) { // Value of sysctl `kernel/domainname` is going to // conflict with already set field `domainname` in // OCI spec, in such scenario crun will fail to prevent // unexpected behaviour for end user. if (! is_empty_string (def->domainname) && (strcmp (original_value, def->domainname) != 0)) return crun_make_error (err, 0, "the sysctl `%s` conflicts with OCI field `domainname`", original_key); if (namespaces_created & CLONE_NEWUTS) return 0; namespace = "UTS"; goto fail; } if (strcmp (name, "kernel/hostname") == 0) return crun_make_error (err, 0, "the sysctl `%s` conflicts with OCI field `hostname`", original_key); } if (has_prefix (name, "net/")) { if (namespaces_created & CLONE_NEWNET) return 0; namespace = "network"; goto fail; } return crun_make_error (err, 0, "the sysctl `%s` is not namespaced", original_key); fail: return crun_make_error (err, 0, "the sysctl `%s` requires a new %s namespace", original_key, namespace); } int libcrun_set_sysctl (libcrun_container_t *container, libcrun_error_t *err) { size_t i; cleanup_close int dirfd = -1; unsigned long namespaces_created = 0; runtime_spec_schema_config_schema *def = container->container_def; if (def->linux == NULL || def->linux->sysctl == NULL || def->linux->sysctl->len == 0) return 0; for (i = 0; i < def->linux->namespaces_len; i++) { int value; value = libcrun_find_namespace (def->linux->namespaces[i]->type); if (UNLIKELY (value < 0)) return crun_make_error (err, 0, "invalid namespace type: `%s`", def->linux->namespaces[i]->type); namespaces_created |= value; } get_private_data (container); dirfd = open ("/proc/sys", O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dirfd < 0)) return crun_make_error (err, errno, "open `/proc/sys`"); for (i = 0; i < def->linux->sysctl->len; i++) { cleanup_free char *name = NULL; cleanup_close int fd = -1; int ret; char *it; name = xstrdup (def->linux->sysctl->keys[i]); for (it = name; *it; it++) if (*it == '.') *it = '/'; ret = validate_sysctl (def->linux->sysctl->keys[i], def->linux->sysctl->values[i], name, namespaces_created, def, err); if (UNLIKELY (ret < 0)) return ret; fd = openat (dirfd, name, O_WRONLY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `/proc/sys/%s`", name); ret = TEMP_FAILURE_RETRY (write (fd, def->linux->sysctl->values[i], strlen (def->linux->sysctl->values[i]))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write to `/proc/sys/%s`", name); } return 0; } static int open_terminal (char **pty, runtime_spec_schema_config_schema_process *process, libcrun_error_t *err) { cleanup_close int fd = -1; uid_t uid = 0; int ret; if (process && process->user) uid = process->user->uid; fd = libcrun_new_terminal (pty, err); if (UNLIKELY (fd < 0)) return fd; ret = libcrun_set_stdio (*pty, err); if (UNLIKELY (ret < 0)) return ret; if (uid) { ret = chown (*pty, uid, -1); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chown `%s`", *pty); } ret = get_and_reset (&fd); return ret; } char * libcrun_get_external_descriptors (libcrun_container_t *container) { return get_private_data (container)->external_descriptors; } int libcrun_save_external_descriptors (libcrun_container_t *container, pid_t pid, libcrun_error_t *err) { const unsigned char *buf = NULL; yajl_gen gen = NULL; size_t buf_len; int ret; int i; gen = yajl_gen_alloc (NULL); if (gen == NULL) return crun_make_error (err, errno, "yajl_gen_alloc"); ret = yajl_gen_array_open (gen); if (UNLIKELY (ret != yajl_gen_status_ok)) goto yajl_error; /* Remember original stdin, stdout, stderr for container restore. */ for (i = 0; i < 3; i++) { proc_fd_path_t fd_path; char link_path[PATH_MAX]; get_proc_fd_path (fd_path, pid, i); ret = readlink (fd_path, link_path, PATH_MAX - 1); if (UNLIKELY (ret < 0)) { /* The fd could not exist. */ if (errno == ENOENT) { strcpy (link_path, "/dev/null"); ret = 9; /* strlen ("/dev/null"). */ } else { yajl_gen_free (gen); return crun_make_error (err, errno, "readlink `%s`", fd_path); } } link_path[ret] = 0; ret = yajl_gen_string (gen, YAJL_STR (link_path), ret); if (UNLIKELY (ret != yajl_gen_status_ok)) goto yajl_error; } ret = yajl_gen_array_close (gen); if (UNLIKELY (ret != yajl_gen_status_ok)) goto yajl_error; ret = yajl_gen_get_buf (gen, &buf, &buf_len); if (UNLIKELY (ret != yajl_gen_status_ok)) goto yajl_error; if (buf) { char *b = xmalloc (buf_len + 1); memcpy (b, buf, buf_len); b[buf_len] = '\0'; get_private_data (container)->external_descriptors = b; } yajl_gen_free (gen); return 0; yajl_error: if (gen) yajl_gen_free (gen); return yajl_error_to_crun_error (ret, err); } int libcrun_set_terminal (libcrun_container_t *container, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; cleanup_free char *pty = NULL; cleanup_close int fd = -1; int ret; if (def->process == NULL || ! def->process->terminal) return 0; fd = open_terminal (&pty, def->process, err); if (UNLIKELY (fd < 0)) return fd; if (def->process->console_size) { ret = libcrun_terminal_setup_size (0, def->process->console_size->height, def->process->console_size->width, err); if (UNLIKELY (ret < 0)) return ret; } ret = do_mount (container, pty, -1, "/dev/console", NULL, MS_BIND, NULL, LABEL_MOUNT, err); if (UNLIKELY (ret < 0)) return ret; return get_and_reset (&fd); } static bool read_error_from_sync_socket (int sync_socket_fd, int *error, char **str) { cleanup_free char *b = NULL; size_t size; int code; int ret; if (*error == 0) { ret = TEMP_FAILURE_RETRY (read (sync_socket_fd, &code, sizeof (code))); if (UNLIKELY (ret < 0)) return false; *error = code; } ret = TEMP_FAILURE_RETRY (read (sync_socket_fd, &size, sizeof (size))); if (UNLIKELY (ret < 0)) return false; if (size == 0) return false; if (size > 1024) size = 1024; b = xmalloc (size + 1); ret = TEMP_FAILURE_RETRY (read (sync_socket_fd, b, size)); if (UNLIKELY (ret < 0)) return false; b[ret] = '\0'; *str = b; b = NULL; return true; } static bool send_error_to_sync_socket (int sync_socket_fd, bool has_fd, libcrun_error_t *err) { size_t size; int ret; int code; char *msg; if (err == NULL || *err == NULL) return false; code = crun_error_get_errno (err); if (has_fd) { /* dummy terminal fd. */ ret = TEMP_FAILURE_RETRY (write (sync_socket_fd, "1", 1)); if (UNLIKELY (ret < 0)) return false; } ret = TEMP_FAILURE_RETRY (write (sync_socket_fd, &code, sizeof (code))); if (UNLIKELY (ret < 0)) return false; msg = (*err)->msg; size = strlen (msg) + 1; ret = TEMP_FAILURE_RETRY (write (sync_socket_fd, &size, sizeof (size))); if (UNLIKELY (ret < 0)) return false; ret = TEMP_FAILURE_RETRY (write (sync_socket_fd, msg, size)); if (UNLIKELY (ret < 0)) return false; return true; } static inline int send_success_to_sync_socket (int sync_socket, libcrun_error_t *err) { const int success = 0; int ret; ret = TEMP_FAILURE_RETRY (write (sync_socket, &success, sizeof (success))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write to sync socket"); return 0; } static __attribute__ ((noreturn)) void send_error_to_sync_socket_and_die (int sync_socket_fd, bool has_terminal, libcrun_error_t *err) { char *msg; if (err == NULL || *err == NULL) _exit (EXIT_FAILURE); if (! send_error_to_sync_socket (sync_socket_fd, has_terminal, err)) { errno = crun_error_get_errno (err); msg = (*err)->msg; libcrun_fail_with_error (errno, "%s", msg); } _exit (EXIT_FAILURE); } static int expect_success_from_sync_socket (int sync_fd, libcrun_error_t *err) { cleanup_free char *err_str = NULL; int res = 1; int ret; ret = TEMP_FAILURE_RETRY (read (sync_fd, &res, sizeof (res))); if (UNLIKELY (ret != sizeof (res))) return crun_make_error (err, errno, "read status from sync socket"); if (res == 0) return 0; if (read_error_from_sync_socket (sync_fd, &res, &err_str)) return crun_make_error (err, res, "%s", err_str); return crun_make_error (err, 0, "read from sync socket"); } static int join_namespaces (runtime_spec_schema_config_schema *def, int *namespaces_to_join, int n_namespaces_to_join, int *namespaces_to_join_index, bool ignore_join_errors, libcrun_error_t *err) { int ret; int i; for (i = 0; i < n_namespaces_to_join; i++) { cleanup_free char *cwd = NULL; int orig_index = namespaces_to_join_index[i]; int value; if (namespaces_to_join[i] < 0) continue; /* Skip the user namespace. */ value = libcrun_find_namespace (def->linux->namespaces[orig_index]->type); if (value == CLONE_NEWUSER) continue; if (value == CLONE_NEWNS) { cwd = getcwd (NULL, 0); if (UNLIKELY (cwd == NULL)) return crun_make_error (err, errno, "cannot get current working directory"); } ret = setns (namespaces_to_join[i], value); if (UNLIKELY (ret < 0)) { if (ignore_join_errors) continue; return crun_make_error (err, errno, "cannot setns `%s`", def->linux->namespaces[orig_index]->path); } close_and_reset (&namespaces_to_join[i]); if (value == CLONE_NEWNS) { ret = chdir (cwd); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chdir(.)"); } } return 0; } #define MAX_NAMESPACES 10 struct init_status_s { /* fd to the namespace to join. */ int fd[MAX_NAMESPACES + 1]; /* Index into def->linux->namespaces. */ int index[MAX_NAMESPACES]; /* CLONE_* value. */ int value[MAX_NAMESPACES]; /* How many namespaces to join. */ size_t fd_len; bool join_pidns; bool join_ipcns; /* Must create the user namespace after joining some existing namespaces. */ bool delayed_userns_create; /* Need to fork again once in the container. */ bool must_fork; /* fd index for userns. */ int userns_index; /* def->linux->namespaces userns. */ int userns_index_origin; /* All namespaces created/joined by the container. */ int all_namespaces; /* What namespaces are still missing to be created. */ int namespaces_to_unshare; /* Index in fd[] for the pidns that must be joined before any other namespace. */ int idx_pidns_to_join_immediately; /* Index in fd[] for the timens that must be joined before any other namespace. */ int idx_timens_to_join_immediately; }; void cleanup_free_init_statusp (struct init_status_s *ns) { size_t i; for (i = 0; i < ns->fd_len; i++) TEMP_FAILURE_RETRY (close (ns->fd[i])); } static int configure_init_status (struct init_status_s *ns, libcrun_container_t *container, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; size_t i; for (i = 0; i < MAX_NAMESPACES + 1; i++) ns->fd[i] = -1; ns->fd_len = 0; ns->all_namespaces = 0; ns->namespaces_to_unshare = 0; ns->join_pidns = false; ns->join_ipcns = false; ns->must_fork = false; ns->delayed_userns_create = false; ns->userns_index = -1; ns->userns_index_origin = -1; ns->idx_pidns_to_join_immediately = -1; ns->idx_timens_to_join_immediately = -1; for (i = 0; i < def->linux->namespaces_len; i++) { int value = libcrun_find_namespace (def->linux->namespaces[i]->type); if (UNLIKELY (value < 0)) return crun_make_error (err, 0, "invalid namespace type: `%s`", def->linux->namespaces[i]->type); ns->all_namespaces |= value; if (def->linux->namespaces[i]->path == NULL) ns->namespaces_to_unshare |= value; else { int fd; if (ns->fd_len >= MAX_NAMESPACES) return crun_make_error (err, 0, "too many namespaces to join"); fd = open (def->linux->namespaces[i]->path, O_RDONLY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `%s`", def->linux->namespaces[i]->path); if (value == CLONE_NEWUSER) { ns->userns_index = ns->fd_len; ns->userns_index_origin = i; } ns->fd[ns->fd_len] = fd; ns->index[ns->fd_len] = i; ns->value[ns->fd_len] = value; ns->fd_len++; ns->fd[ns->fd_len] = -1; } } if (container->host_uid && (ns->all_namespaces & CLONE_NEWUSER) == 0) { libcrun_warning ("non root user need to have an 'user' namespace"); ns->all_namespaces |= CLONE_NEWUSER; ns->namespaces_to_unshare |= CLONE_NEWUSER; } return 0; } /* Detect if root is available in the container. */ static bool root_mapped_in_container_p (runtime_spec_schema_defs_id_mapping **mappings, size_t len) { size_t i; for (i = 0; i < len; i++) if (mappings[i]->container_id == 0) return true; return false; } static struct libcrun_fd_map * get_devices_fd_map (libcrun_container_t *container) { struct libcrun_fd_map *dev_fds = get_private_data (container)->dev_fds; if (dev_fds == NULL) { runtime_spec_schema_config_schema *def = container->container_def; size_t len = def->linux ? def->linux->devices_len : 0; dev_fds = make_libcrun_fd_map (len); get_private_data (container)->dev_fds = dev_fds; } return dev_fds; } static struct libcrun_fd_map * get_fd_map (libcrun_container_t *container) { struct libcrun_fd_map *mount_fds = get_private_data (container)->mount_fds; if (mount_fds == NULL) { runtime_spec_schema_config_schema *def = container->container_def; mount_fds = make_libcrun_fd_map (def->mounts_len); get_private_data (container)->mount_fds = mount_fds; } return mount_fds; } static bool is_bind_mount (runtime_spec_schema_defs_mount *mnt, bool *recursive) { size_t i; for (i = 0; i < mnt->options_len; i++) { if (strcmp (mnt->options[i], "bind") == 0) { *recursive = false; return true; } if (strcmp (mnt->options[i], "rbind") == 0) { *recursive = true; return true; } } return false; } static char * get_idmapped_option (runtime_spec_schema_defs_mount *mnt, bool *recursive) { size_t i; for (i = 0; i < mnt->options_len; i++) { if (has_prefix (mnt->options[i], "idmap")) { *recursive = false; return mnt->options[i]; } if (has_prefix (mnt->options[i], "ridmap")) { *recursive = true; return mnt->options[i]; } } return NULL; } static int maybe_get_idmapped_mount (runtime_spec_schema_config_schema *def, runtime_spec_schema_defs_mount *mnt, pid_t pid, int *out_fd, libcrun_error_t *err) { cleanup_close int newfs_fd = -1; cleanup_pid pid_t created_pid = -1; struct mount_attr_s attr = { 0, }; bool recursive_bind_mount = false; cleanup_close int fd = -1; const char *idmap_option; bool recursive = false; const char *options = NULL; char proc_path[64]; bool has_mappings; int ret; char *extra_msg = ""; *out_fd = -1; idmap_option = get_idmapped_option (mnt, &recursive); has_mappings = mnt->uid_mappings_len > 0 || mnt->gid_mappings_len > 0 || (idmap_option != NULL); if (! has_mappings) return 0; if ((mnt->uid_mappings == NULL) != (mnt->gid_mappings == NULL)) return crun_make_error (err, 0, "invalid mappings specified for the mount on `%s`", mnt->destination); /* If there are options specified, create a new user namespace with the configured mappings. */ if (idmap_option) { options = strchr (idmap_option, '='); if (options) { /* Skip the '=' itself. */ options++; if (options[0] == '\0') options = NULL; } } ret = maybe_create_userns_for_idmapped_mount (def, mnt, options, &created_pid, err); if (UNLIKELY (ret < 0)) return ret; if (created_pid > 0) pid = created_pid; sprintf (proc_path, "/proc/%d/ns/user", pid); fd = open (proc_path, O_RDONLY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `%s`", proc_path); if (is_bind_mount (mnt, &recursive_bind_mount)) { newfs_fd = syscall_open_tree (-1, mnt->source, (recursive_bind_mount ? AT_RECURSIVE : 0) | AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | OPEN_TREE_CLOEXEC | OPEN_TREE_CLONE); if (UNLIKELY (newfs_fd < 0)) return crun_make_error (err, errno, "open `%s`", mnt->source); } else { cleanup_close int fsopen_fd = -1; fsopen_fd = syscall_fsopen (mnt->type, FSOPEN_CLOEXEC); if (UNLIKELY (fsopen_fd < 0)) return crun_make_error (err, errno, "fsopen `%s`", mnt->type); ret = syscall_fsconfig (fsopen_fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "fsconfig create `%s`", mnt->type); newfs_fd = syscall_fsmount (fsopen_fd, FSMOUNT_CLOEXEC, 0); if (UNLIKELY (newfs_fd < 0)) return crun_make_error (err, errno, "fsmount `%s`", mnt->type); } attr.attr_set = MOUNT_ATTR_IDMAP; attr.userns_fd = fd; ret = syscall_mount_setattr (newfs_fd, "", AT_EMPTY_PATH | (recursive ? AT_RECURSIVE : 0), &attr); if (UNLIKELY (ret < 0)) { if (errno == EINVAL) { extra_msg = " (maybe the file system used doesn't support idmap mounts on this kernel?)"; } return crun_make_error (err, errno, "mount_setattr `%s`%s", mnt->destination, extra_msg); } *out_fd = get_and_reset (&newfs_fd); return 0; } static uid_t get_id_in_user_namespace (uid_t id, bool is_uid, runtime_spec_schema_config_schema *def) { runtime_spec_schema_defs_id_mapping **mappings; size_t len; size_t i; mappings = is_uid ? def->linux->uid_mappings : def->linux->gid_mappings; len = is_uid ? def->linux->uid_mappings_len : def->linux->gid_mappings_len; for (i = 0; i < len; i++) { if (mappings[i]->container_id <= id && id < mappings[i]->container_id + mappings[i]->size) return id - mappings[i]->container_id + mappings[i]->host_id; } return is_uid ? get_overflow_uid () : get_overflow_gid (); } static int precreate_device (libcrun_container_t *container, int devs_dirfd, size_t i, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; runtime_spec_schema_defs_linux_device *device; uid_t uid = get_overflow_uid (); gid_t gid = get_overflow_gid (); char name[64]; mode_t type; dev_t dev; int ret; snprintf (name, sizeof (name), "%zu", i); device = def->linux->devices[i]; type = (device->type[0] == 'b') ? S_IFBLK : ((device->type[0] == 'p') ? S_IFIFO : S_IFCHR); dev = makedev (device->major, device->minor); ret = mknodat (devs_dirfd, name, device->file_mode | type, dev); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "mknod `%s`", device->path); if (def->linux) { uid = get_id_in_user_namespace (device->uid, true, def); gid = get_id_in_user_namespace (device->gid, false, def); } ret = fchownat (devs_dirfd, name, uid, gid, 0); /* lgtm [cpp/toctou-race-condition] */ if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chown `%s`", device->path); return get_bind_mount (devs_dirfd, name, false, false, err); } static int send_mounts (int sync_socket_host, struct libcrun_fd_map *fds, size_t how_many, size_t total, libcrun_error_t *err) { size_t i; int ret; ret = TEMP_FAILURE_RETRY (write (sync_socket_host, &how_many, sizeof (how_many))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write to sync socket"); for (i = 0; i < total; i++) { if (fds->fds[i] >= 0) { ret = send_fd_to_socket_with_payload (sync_socket_host, fds->fds[i], (char *) &i, sizeof (i), err); if (UNLIKELY (ret < 0)) return ret; } } return 0; } static int prepare_and_send_mount_mounts (libcrun_container_t *container, pid_t pid, int sync_socket_host, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; cleanup_close_map struct libcrun_fd_map *mount_fds = NULL; bool has_userns = (get_private_data (container)->unshare_flags & CLONE_NEWUSER) ? true : false; size_t how_many = 0; size_t i; int ret; if (def->mounts_len == 0) return 0; if (! has_userns) { int is_in_userns; is_in_userns = check_running_in_user_namespace (err); if (UNLIKELY (is_in_userns < 0)) return is_in_userns; if (is_in_userns > 0) has_userns = true; } mount_fds = make_libcrun_fd_map (def->mounts_len); for (i = 0; i < def->mounts_len; i++) { bool recursive = false; mount_fds->fds[i] = -1; ret = maybe_get_idmapped_mount (def, def->mounts[i], pid, &(mount_fds->fds[i]), err); if (UNLIKELY (ret < 0)) return ret; if (mount_fds->fds[i] < 0 && has_userns && is_bind_mount (def->mounts[i], &recursive)) { mount_fds->fds[i] = get_bind_mount (-1, def->mounts[i]->source, recursive, false, err); if (UNLIKELY (mount_fds->fds[i] < 0)) crun_error_release (err); } if (mount_fds->fds[i] >= 0) how_many++; } return send_mounts (sync_socket_host, mount_fds, how_many, def->mounts_len, err); } static int prepare_and_send_dev_mounts (libcrun_container_t *container, int sync_socket_host, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; cleanup_close_map struct libcrun_fd_map *dev_fds = NULL; bool has_userns = (get_private_data (container)->unshare_flags & CLONE_NEWUSER) ? true : false; cleanup_close int current_mountns = -1; cleanup_free char *state_dir = NULL; cleanup_free char *devs_path = NULL; cleanup_close int devs_mountfd = -1; cleanup_close int targetfd = -1; const char *context_type = NULL; const char *label = NULL; size_t how_many = 0; size_t i; int ret; if (def->linux == NULL || def->linux->devices_len == 0) return 0; dev_fds = make_libcrun_fd_map (def->linux->devices_len); if (! has_userns || is_empty_string (container->context->id) || geteuid () > 0) return send_mounts (sync_socket_host, dev_fds, how_many, def->linux->devices_len, err); state_dir = libcrun_get_state_directory (container->context->state_root, container->context->id); if (state_dir == NULL) return send_mounts (sync_socket_host, dev_fds, how_many, def->linux->devices_len, err); ret = append_paths (&devs_path, err, state_dir, "devs", NULL); if (UNLIKELY (ret < 0)) return ret; ret = mkdir (devs_path, 0700); if (UNLIKELY (ret < 0) && errno != EEXIST) return crun_make_error (err, errno, "mkdir `%s`", devs_path); current_mountns = open ("/proc/self/ns/mnt", O_RDONLY | O_CLOEXEC); if (UNLIKELY (current_mountns < 0)) return crun_make_error (err, errno, "open `/proc/self/ns/mnt`"); ret = unshare (CLONE_NEWNS); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "unshare `CLONE_NEWNS`"); ret = mount (NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL); if (UNLIKELY (ret < 0)) { ret = crun_make_error (err, errno, "mount `MS_REC | MS_PRIVATE`"); goto restore_mountns; } if (container->container_def->linux && container->container_def->linux->mount_label) { label = container->container_def->linux->mount_label; context_type = get_selinux_context_type (container); } devs_mountfd = fsopen_mount ("tmpfs", context_type, label); if (UNLIKELY (devs_mountfd < 0)) { ret = crun_make_error (err, errno, "fsopen_mount `tmpfs`"); goto restore_mountns; } targetfd = open (devs_path, O_DIRECTORY | O_CLOEXEC); if (targetfd < 0) { ret = crun_make_error (err, errno, "open `%s`", devs_path); goto restore_mountns; } ret = fs_move_mount_to (devs_mountfd, targetfd, NULL); if (UNLIKELY (ret < 0)) { ret = crun_make_error (err, errno, "fs_move_mount_to `%s`", devs_path); goto restore_mountns; } close_and_reset (&targetfd); targetfd = openat (devs_mountfd, ".", O_DIRECTORY | O_CLOEXEC); if (targetfd < 0) { ret = crun_make_error (err, errno, "open `%s`", devs_path); goto restore_mountns; } for (i = 0; i < def->linux->devices_len; i++) { ret = precreate_device (container, targetfd, i, err); if (UNLIKELY (ret < 0)) { crun_error_release (err); continue; } dev_fds->fds[i] = ret; if (dev_fds->fds[i] >= 0) how_many++; } ret = send_mounts (sync_socket_host, dev_fds, how_many, def->linux->devices_len, err); restore_mountns: { int setns_ret; setns_ret = setns (current_mountns, CLONE_NEWNS); if (UNLIKELY (setns_ret < 0 && ret >= 0)) return crun_make_error (err, errno, "setns `CLONE_NEWNS`"); } return ret; } static int prepare_and_send_mounts (libcrun_container_t *container, pid_t pid, int sync_socket_host, libcrun_error_t *err) { int ret; ret = expect_success_from_sync_socket (sync_socket_host, err); if (UNLIKELY (ret < 0)) return ret; ret = prepare_and_send_mount_mounts (container, pid, sync_socket_host, err); if (UNLIKELY (ret < 0)) return ret; ret = prepare_and_send_dev_mounts (container, sync_socket_host, err); if (UNLIKELY (ret < 0)) return ret; return 0; } static int receive_mounts (struct libcrun_fd_map *fds, int sync_socket_container, libcrun_error_t *err) { size_t i, how_many = 0; int ret; if (fds->nfds == 0) return 0; ret = TEMP_FAILURE_RETRY (read (sync_socket_container, &how_many, sizeof (how_many))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "read from sync socket"); for (i = 0; i < how_many; i++) { size_t index; ret = receive_fd_from_socket_with_payload (sync_socket_container, (char *) &index, sizeof (index), err); if (UNLIKELY (ret < 0)) return ret; if (index >= fds->nfds) return crun_make_error (err, 0, "invalid mount data received"); if (fds->fds[index] >= 0) TEMP_FAILURE_RETRY (close (fds->fds[index])); fds->fds[index] = ret; } return 0; } static int set_id_init (libcrun_container_t *container, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; uid_t uid = 0; gid_t gid = 0; int ret; if (def->process && def->process->user && def->linux) { /* If it is running in a user namespace and root is not mapped use the UID/GID specified for running the container. */ bool root_mapped = false; if (def->linux->uid_mappings_len != 0) { root_mapped = root_mapped_in_container_p (def->linux->uid_mappings, def->linux->uid_mappings_len); if (! root_mapped) uid = def->process->user->uid; } if (def->linux->gid_mappings_len != 0) { root_mapped = root_mapped_in_container_p (def->linux->gid_mappings, def->linux->gid_mappings_len); if (! root_mapped) gid = def->process->user->gid; } } ret = setresuid (uid, uid, uid); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "setresuid to `%d`", uid); ret = setresgid (gid, gid, gid); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "setresgid to `%d`", gid); return 0; } static int init_container (libcrun_container_t *container, int sync_socket_container, struct init_status_s *init_status, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; struct libcrun_fd_map *mount_fds = get_fd_map (container); pid_t pid_container = 0; size_t i; int ret; if (init_status->idx_pidns_to_join_immediately >= 0 || init_status->idx_timens_to_join_immediately >= 0) { pid_t new_pid; if (init_status->idx_pidns_to_join_immediately >= 0) { ret = setns (init_status->fd[init_status->idx_pidns_to_join_immediately], CLONE_NEWPID); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot setns to target pidns"); close_and_reset (&init_status->fd[init_status->idx_pidns_to_join_immediately]); } if (init_status->idx_timens_to_join_immediately >= 0) { ret = setns (init_status->fd[init_status->idx_timens_to_join_immediately], CLONE_NEWTIME); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot setns to target timens"); close_and_reset (&init_status->fd[init_status->idx_timens_to_join_immediately]); } new_pid = fork (); if (UNLIKELY (new_pid < 0)) return crun_make_error (err, errno, "fork"); if (new_pid) { /* Report the new PID to the parent and exit immediately. */ ret = send_success_to_sync_socket (sync_socket_container, err); if (UNLIKELY (ret < 0)) kill (new_pid, SIGKILL); ret = TEMP_FAILURE_RETRY (write (sync_socket_container, &new_pid, sizeof (new_pid))); if (UNLIKELY (ret < 0)) kill (new_pid, SIGKILL); _exit (0); } /* In the new process. Wait for the parent to receive the new PID. */ ret = expect_success_from_sync_socket (sync_socket_container, err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_set_oom (container, err); if (UNLIKELY (ret < 0)) return ret; if (init_status->fd_len > 0) { ret = join_namespaces (def, init_status->fd, init_status->fd_len, init_status->index, true, err); if (UNLIKELY (ret < 0)) return ret; } /* If the container needs to join an existing PID namespace, take a reference to it before creating a new user namespace, as we could lose the access to the existing namespace. This cannot be done in the parent process (by `prepare_and_send_mounts`), since it is necessary to first join the target namespaces and then create the mount. */ if ((init_status->all_namespaces & CLONE_NEWUSER) && (init_status->join_pidns || init_status->join_ipcns)) { for (i = 0; i < def->mounts_len; i++) { int fd = -1; /* If for any reason the mount cannot be opened, ignore errors and continue. An error will be generated later if it is not possible to join the namespace. */ if (init_status->join_pidns && strcmp (def->mounts[i]->type, "proc") == 0) fd = fsopen_mount (def->mounts[i]->type, NULL, NULL); if (init_status->join_ipcns && strcmp (def->mounts[i]->type, "mqueue") == 0) fd = fsopen_mount (def->mounts[i]->type, NULL, NULL); if (fd >= 0) { if (mount_fds->fds[i] >= 0) TEMP_FAILURE_RETRY (close (mount_fds->fds[i])); mount_fds->fds[i] = fd; } } } if (init_status->all_namespaces & CLONE_NEWUSER) { if (init_status->delayed_userns_create) { ret = unshare (CLONE_NEWUSER); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "unshare (CLONE_NEWUSER)"); init_status->namespaces_to_unshare &= ~CLONE_NEWUSER; ret = send_success_to_sync_socket (sync_socket_container, err); if (UNLIKELY (ret < 0)) return ret; } if (init_status->userns_index < 0) { ret = expect_success_from_sync_socket (sync_socket_container, err); if (UNLIKELY (ret < 0)) return ret; } else { /* If we need to join another user namespace, do it immediately before creating any other namespace. */ ret = setns (init_status->fd[init_status->userns_index], CLONE_NEWUSER); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot setns `%s`", def->linux->namespaces[init_status->userns_index_origin]->path); } ret = set_id_init (container, err); if (UNLIKELY (ret < 0)) return ret; } ret = join_namespaces (def, init_status->fd, init_status->fd_len, init_status->index, false, err); if (UNLIKELY (ret < 0)) return ret; if (init_status->namespaces_to_unshare & ~CLONE_NEWCGROUP) { /* New namespaces to create for the container. */ ret = unshare (init_status->namespaces_to_unshare & ~CLONE_NEWCGROUP); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "unshare"); } if (def->linux->time_offsets) { const char *const timens_offsets_file = "/proc/self/timens_offsets"; char fmt_buffer[128]; cleanup_close int fd = -1; fd = open (timens_offsets_file, O_WRONLY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `%s`", timens_offsets_file); if (def->linux->time_offsets->boottime) { sprintf (fmt_buffer, "boottime %" PRIi64 " %" PRIu32, def->linux->time_offsets->boottime->secs, def->linux->time_offsets->boottime->nanosecs); ret = write (fd, fmt_buffer, strlen (fmt_buffer)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write `%s`", timens_offsets_file); } if (def->linux->time_offsets->monotonic) { sprintf (fmt_buffer, "monotonic %" PRIi64 " %" PRIu32, def->linux->time_offsets->monotonic->secs, def->linux->time_offsets->monotonic->nanosecs); ret = write (fd, fmt_buffer, strlen (fmt_buffer)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write `%s`", timens_offsets_file); } } ret = prctl (PR_SET_DUMPABLE, 0, 0, 0, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "prctl (PR_SET_DUMPABLE)"); if (init_status->must_fork) { /* A PID and a time namespace are joined when the new process is created. */ pid_container = fork (); if (UNLIKELY (pid_container < 0)) return crun_make_error (err, errno, "cannot fork"); /* Report back the new PID. */ if (pid_container) { ret = send_success_to_sync_socket (sync_socket_container, err); if (UNLIKELY (ret < 0)) return ret; ret = TEMP_FAILURE_RETRY (write (sync_socket_container, &pid_container, sizeof (pid_container))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write to sync socket"); _exit (EXIT_SUCCESS); } ret = expect_success_from_sync_socket (sync_socket_container, err); if (UNLIKELY (ret < 0)) return ret; } ret = send_success_to_sync_socket (sync_socket_container, err); if (UNLIKELY (ret < 0)) return ret; /* Receive the mounts sent by `prepare_and_send_mounts`. */ ret = receive_mounts (get_fd_map (container), sync_socket_container, err); if (UNLIKELY (ret < 0)) return ret; ret = receive_mounts (get_devices_fd_map (container), sync_socket_container, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_container_setgroups (container, container->container_def->process, err); if (UNLIKELY (ret < 0)) return ret; return 0; } static int handle_pidfd_receiver (pid_t pid, libcrun_container_t *container, libcrun_error_t *err) { cleanup_close int client_fd = -1; cleanup_close int pidfd = -1; const char *v; v = find_annotation (container, "run.oci.pidfd_receiver"); if (v == NULL) return 0; pidfd = syscall_pidfd_open (pid, 0); if (UNLIKELY (pidfd < 0)) return crun_make_error (err, errno, "pidfd_open"); client_fd = open_unix_domain_client_socket (v, 0, err); if (UNLIKELY (client_fd < 0)) return client_fd; return send_fd_to_socket (client_fd, pidfd, err); } pid_t libcrun_run_linux_container (libcrun_container_t *container, container_entrypoint_t entrypoint, void *args, int *sync_socket_out, struct libcrun_dirfd_s *cgroup_dirfd, libcrun_error_t *err) { __attribute__ ((cleanup (cleanup_free_init_statusp))) struct init_status_s init_status; runtime_spec_schema_config_schema *def = container->container_def; cleanup_close int sync_socket_container = -1; char *notify_socket_env = NULL; cleanup_close int sync_socket_host = -1; __attribute__ ((unused)) cleanup_close int restore_pidns = -1; int first_clone_args = 0; int sync_socket[2]; pid_t pid; size_t i; int ret; ret = configure_init_status (&init_status, container, err); if (UNLIKELY (ret < 0)) return ret; get_private_data (container)->unshare_flags = init_status.all_namespaces; #if CLONE_NEWCGROUP /* cgroup will be unshared later. Once the process is in the correct cgroup. */ init_status.all_namespaces &= ~CLONE_NEWCGROUP; get_private_data (container)->unshare_cgroupns = init_status.namespaces_to_unshare & CLONE_NEWCGROUP; #endif ret = socketpair (AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sync_socket); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "socketpair"); sync_socket_host = sync_socket[0]; sync_socket_container = sync_socket[1]; #ifdef HAVE_SYSTEMD if (def->root) { ret = do_notify_socket (container, def->root->path, err); if (UNLIKELY (ret < 0)) return ret; } #endif get_uid_gid_from_def (container->container_def, &container->container_uid, &container->container_gid); /* This must be done before we enter a user namespace. */ if (def->process) { ret = libcrun_set_rlimits (def->process->rlimits, def->process->rlimits_len, err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_set_oom (container, err); if (UNLIKELY (ret < 0)) return ret; /* If a new user namespace must be created, but there are other namespaces to join, then delay the userns creation after the namespaces are joined. */ init_status.delayed_userns_create = (init_status.all_namespaces & CLONE_NEWUSER) && init_status.userns_index < 0 && init_status.fd_len > 0; /* Check if special handling is required to join the namespaces. */ for (i = 0; i < init_status.fd_len; i++) { switch (init_status.value[i]) { case CLONE_NEWIPC: if (init_status.all_namespaces & CLONE_NEWUSER) init_status.join_ipcns = true; break; case CLONE_NEWPID: if ((init_status.all_namespaces & CLONE_NEWUSER) == 0) init_status.must_fork = true; else { init_status.join_pidns = true; init_status.idx_pidns_to_join_immediately = i; init_status.namespaces_to_unshare &= ~CLONE_NEWPID; } break; case CLONE_NEWTIME: if ((init_status.all_namespaces & CLONE_NEWUSER) == 0) init_status.must_fork = true; else { init_status.idx_timens_to_join_immediately = i; init_status.namespaces_to_unshare &= ~CLONE_NEWTIME; } break; } } /* Before attempting any setns() or unshare(), a clone() is required to not touch the caller context that can be used later on for running hooks. */ if ((init_status.namespaces_to_unshare & CLONE_NEWUSER) && init_status.fd_len == 0) { /* If a user namespace must be created and there are no other namespaces to join, create the userns alone. */ first_clone_args = CLONE_NEWUSER; } else if ((init_status.all_namespaces & CLONE_NEWUSER) == 0) { /* If it doesn't create a user namespace or need to join one, create the new requested namespaces now. */ first_clone_args = init_status.namespaces_to_unshare & ~(CLONE_NEWTIME | CLONE_NEWCGROUP); } init_status.namespaces_to_unshare &= ~first_clone_args; /* Check if there are still namespaces that require a fork(). */ if (init_status.namespaces_to_unshare & (CLONE_NEWPID | CLONE_NEWTIME)) { /* If we need to make another fork(), make sure the NEWPID is always created as part of that. */ first_clone_args &= ~CLONE_NEWPID; init_status.namespaces_to_unshare |= CLONE_NEWPID; init_status.must_fork = true; } pid = -1; if (cgroup_dirfd && *cgroup_dirfd->dirfd >= 0) { struct _clone3_args clone3_args; memset (&clone3_args, 0, sizeof (clone3_args)); clone3_args.exit_signal = SIGCHLD; clone3_args.flags = first_clone_args; clone3_args.flags |= CLONE_INTO_CGROUP; clone3_args.cgroup = *cgroup_dirfd->dirfd; pid = syscall_clone3 (&clone3_args); if (pid >= 0) cgroup_dirfd->joined = true; close_and_reset (cgroup_dirfd->dirfd); } /* fallback to clone() for any error. */ if (pid < 0) { pid = syscall_clone (first_clone_args | SIGCHLD, NULL); if (UNLIKELY (pid < 0)) return crun_make_error (err, errno, "clone"); } if (pid) { __attribute__ ((unused)) cleanup_pid pid_t pid_to_clean = pid; /* this is safe to do because the std stream files were not changed since the clone(). */ ret = libcrun_save_external_descriptors (container, 0, err); if (UNLIKELY (ret < 0)) return ret; ret = close_and_reset (&sync_socket_container); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "close"); /* any systemd notify socket open_tree FD is pointless to keep around in the parent */ close_and_reset (&(get_private_data (container)->notify_socket_tree_fd)); if (init_status.idx_pidns_to_join_immediately >= 0 || init_status.idx_timens_to_join_immediately >= 0) { pid_t new_pid = 0; ret = expect_success_from_sync_socket (sync_socket_host, err); if (UNLIKELY (ret < 0)) return ret; ret = TEMP_FAILURE_RETRY (read (sync_socket_host, &new_pid, sizeof (new_pid))); if (UNLIKELY (ret != sizeof (new_pid))) return crun_make_error (err, errno, "read pid from sync socket"); /* Cleanup the first process. */ ret = waitpid_ignore_stopped (pid, NULL, 0); pid_to_clean = pid = new_pid; ret = send_success_to_sync_socket (sync_socket_host, err); if (UNLIKELY (ret < 0)) return ret; } if (init_status.delayed_userns_create) { ret = expect_success_from_sync_socket (sync_socket_host, err); if (UNLIKELY (ret < 0)) return ret; } if ((init_status.all_namespaces & CLONE_NEWUSER) && init_status.userns_index < 0) { ret = libcrun_set_usernamespace (container, pid, err); if (UNLIKELY (ret < 0)) return ret; ret = send_success_to_sync_socket (sync_socket_host, err); if (UNLIKELY (ret < 0)) return ret; } if (init_status.must_fork) { pid_t grandchild = 0; ret = expect_success_from_sync_socket (sync_socket_host, err); if (UNLIKELY (ret < 0)) return ret; ret = TEMP_FAILURE_RETRY (read (sync_socket_host, &grandchild, sizeof (grandchild))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "read pid from sync socket"); ret = send_success_to_sync_socket (sync_socket_host, err); if (UNLIKELY (ret < 0)) return ret; /* Cleanup the first process. */ waitpid_ignore_stopped (pid, NULL, 0); pid_to_clean = pid = grandchild; } /* They are received by `receive_mounts`. */ ret = prepare_and_send_mounts (container, pid, sync_socket_host, err); if (UNLIKELY (ret < 0)) return ret; ret = expect_success_from_sync_socket (sync_socket_host, err); if (UNLIKELY (ret < 0)) return ret; *sync_socket_out = get_and_reset (&sync_socket_host); ret = handle_pidfd_receiver (pid, container, err); if (UNLIKELY (ret < 0)) return ret; pid_to_clean = 0; return pid; } /* Inside the container process. */ ret = close_and_reset (&sync_socket_host); if (UNLIKELY (ret < 0)) libcrun_fail_with_error (errno, "%s", "close sync socket"); /* Initialize the new process and make sure to join/create all the required namespaces. */ ret = init_container (container, sync_socket_container, &init_status, err); if (UNLIKELY (ret < 0)) send_error_to_sync_socket_and_die (sync_socket_container, false, err); else { ret = send_success_to_sync_socket (sync_socket_container, err); if (UNLIKELY (ret < 0)) libcrun_fail_with_error (crun_error_get_errno (err), "%s", (*err)->msg); } /* Jump into the specified entrypoint. */ if (container->context->notify_socket) xasprintf (¬ify_socket_env, "NOTIFY_SOCKET=%s/notify", container->context->notify_socket); ret = entrypoint (args, notify_socket_env, sync_socket_container, err); /* For most of the cases ENTRYPOINT returns only on an error, fallback here */ /* Except for custom handlers which could perform a task and return with success */ /* since custom handlers could or could not be {long-running, blocking} */ if (*err) libcrun_fail_with_error ((*err)->status, "%s", (*err)->msg); /* If cursor is here most likely we returned from a custom handler eg. wasm, libkrun */ /* Allow cleanup attributes to perform cleanup and exit with success if return code was 0 */ if (ret == 0) _exit (EXIT_SUCCESS); _exit (EXIT_FAILURE); } static int join_process_parent_helper (libcrun_context_t *context, libcrun_container_t *container, runtime_spec_schema_config_schema_process *process, pid_t child_pid, int sync_socket_fd, libcrun_container_status_t *status, bool need_move_to_cgroup, const char *sub_cgroup, int *terminal_fd, libcrun_error_t *err) { int ret, pid_status; char res; pid_t pid; cleanup_close int sync_fd = sync_socket_fd; if (terminal_fd) *terminal_fd = -1; /* Read the status and the PID from the child process. */ ret = TEMP_FAILURE_RETRY (read (sync_fd, &res, 1)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "read from sync socket"); if (res != '0') return crun_make_error (err, 0, "fail startup"); ret = TEMP_FAILURE_RETRY (read (sync_fd, &pid, sizeof (pid))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "read from sync socket"); /* Wait for the child pid so we ensure the grandchild gets properly reparented. */ ret = waitpid_ignore_stopped (child_pid, &pid_status, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "waitpid for exec child pid"); if (need_move_to_cgroup) { if (sub_cgroup) { cleanup_free char *final_cgroup = NULL; ret = append_paths (&final_cgroup, err, status->cgroup_path, sub_cgroup, NULL); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_move_process_to_cgroup (pid, status->pid, final_cgroup, err); if (UNLIKELY (ret < 0)) return ret; } else { ret = libcrun_move_process_to_cgroup (pid, status->pid, status->cgroup_path, err); if (UNLIKELY (ret < 0)) return ret; } /* Join the scheduler immediately after joining the cgroup. */ ret = libcrun_set_scheduler (pid, process, err); if (UNLIKELY (ret < 0)) return ret; } ret = libcrun_apply_intelrdt (context->id, container, pid, LIBCRUN_INTELRDT_MOVE, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_set_io_priority (pid, process, err); if (UNLIKELY (ret < 0)) return ret; /* The write unblocks the grandchild process so it can run once we setup the cgroups. */ ret = TEMP_FAILURE_RETRY (write (sync_fd, &ret, sizeof (ret))); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write to sync socket"); if (terminal_fd) { ret = receive_fd_from_socket (sync_fd, err); if (UNLIKELY (ret < 0)) { int err_code = 0; cleanup_free char *err_str = NULL; if (read_error_from_sync_socket (sync_fd, &err_code, &err_str)) return crun_make_error (err, err_code, "%s", err_str); return crun_error_wrap (err, "receive fd"); } *terminal_fd = ret; } return pid; } /* try to join all the namespaces with a single call to setns using the target process pidfd. return codes: < 0 - on errors 0 - the namespaces were not joined. > 0 - the namespaces were joined. */ static int try_setns_with_pidfd (pid_t pid_to_join, libcrun_container_t *container, libcrun_container_status_t *status, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; cleanup_close int pidfd_pid_to_join = -1; int all_flags = 0; size_t i; int ret; /* If there is any explicit namespace path to join, skip the setns_with_pidfd shortcut and join each namespace individually. */ if (def->linux && def->linux->namespaces) { for (i = 0; i < def->linux->namespaces_len; i++) if (! is_empty_string (def->linux->namespaces[i]->path)) return 0; } pidfd_pid_to_join = syscall_pidfd_open (pid_to_join, 0); if (UNLIKELY (pidfd_pid_to_join < 0)) return 0; /* Validate that the pidfd really refers to the original container process. */ ret = libcrun_check_pid_valid (status, err); if (UNLIKELY (ret < 0)) return ret; if (ret == 0) return crun_make_error (err, ESRCH, "container process not found, the pid was reused"); for (i = 0; namespaces[i].ns_file; i++) all_flags |= namespaces[i].value; ret = setns (pidfd_pid_to_join, all_flags); if (UNLIKELY (ret < 0)) return 0; return 1; } static int join_process_namespaces (libcrun_container_t *container, pid_t pid_to_join, libcrun_container_status_t *status, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = container->container_def; int fds_joined[MAX_NAMESPACES] = { 0, }; int fds[MAX_NAMESPACES] = { -1, }; size_t i; int ret; /* Try to join all namespaces in one shot with setns and pidfd. */ ret = try_setns_with_pidfd (pid_to_join, container, status, err); if (UNLIKELY (ret < 0)) return ret; /* Nothing left to do if the namespaces were joined. */ if (LIKELY (ret > 0)) return 0; /* If setns fails with the target pidfd, fall-back to join each namespace individually. */ if (def->linux->namespaces_len >= MAX_NAMESPACES) return crun_make_error (err, 0, "invalid configuration"); for (i = 0; namespaces[i].ns_file; i++) { cleanup_free char *ns_join = NULL; xasprintf (&ns_join, "/proc/%d/ns/%s", pid_to_join, namespaces[i].ns_file); fds[i] = open (ns_join, O_RDONLY | O_CLOEXEC); if (UNLIKELY (fds[i] < 0)) { /* If the namespace doesn't exist, just ignore it. */ if (errno == ENOENT) continue; ret = crun_make_error (err, errno, "open `%s`", ns_join); goto exit; } } for (i = 0; namespaces[i].ns_file; i++) { if (namespaces[i].value == CLONE_NEWUSER) continue; ret = setns (fds[i], 0); if (ret == 0) fds_joined[i] = 1; } for (i = 0; namespaces[i].ns_file; i++) { if (fds_joined[i]) continue; ret = setns (fds[i], 0); if (ret == 0) fds_joined[i] = 1; } for (i = 0; namespaces[i].ns_file; i++) { if (fds_joined[i]) continue; ret = setns (fds[i], 0); if (UNLIKELY (ret < 0 && errno != EINVAL)) { size_t j; bool found = false; for (j = 0; j < def->linux->namespaces_len; j++) { if (strcmp (namespaces[i].name, def->linux->namespaces[j]->type) == 0) { found = true; break; } } if (! found) { /* It was not requested to create this ns, so just ignore it. */ fds_joined[i] = 1; continue; } ret = crun_make_error (err, errno, "setns `%s`", namespaces[i].ns_file); goto exit; } fds_joined[i] = 1; } ret = 0; exit: for (i = 0; namespaces[i].ns_file; i++) close_and_reset (&fds[i]); return ret; } int libcrun_join_process (libcrun_context_t *context, libcrun_container_t *container, pid_t pid_to_join, libcrun_container_status_t *status, const char *sub_cgroup, int detach, runtime_spec_schema_config_schema_process *process, int *terminal_fd, libcrun_error_t *err) { pid_t pid; int ret; int sync_socket_fd[2]; cleanup_close int cgroup_dirfd = -1; cleanup_close int sync_fd = -1; struct _clone3_args clone3_args; bool need_move_to_cgroup; if (! detach) { ret = prctl (PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "set child subreaper"); } ret = socketpair (AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sync_socket_fd); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "error creating socketpair"); { cleanup_cgroup_status struct libcrun_cgroup_status *cgroup_status = NULL; cgroup_status = libcrun_cgroup_make_status (status); /* The cgroup can be joined directly only when there are no additional controllers not handled by cgroup v2. */ if (get_force_cgroup_v1_annotation (container) == NULL) { cgroup_dirfd = libcrun_get_cgroup_dirfd (cgroup_status, sub_cgroup, err); if (UNLIKELY (cgroup_dirfd < 0)) crun_error_release (err); } } memset (&clone3_args, 0, sizeof (clone3_args)); clone3_args.exit_signal = SIGCHLD; if (cgroup_dirfd < 0) need_move_to_cgroup = true; else { need_move_to_cgroup = false; clone3_args.flags |= CLONE_INTO_CGROUP; clone3_args.cgroup = cgroup_dirfd; } pid = syscall_clone3 (&clone3_args); if (pid > 0) { /* We need to set the scheduler as soon as possible after joining the cgroup, because if it is a RT scheduler, other processes in the container could already take the entire cpu time and stall the new process. */ ret = libcrun_set_scheduler (pid, process, err); if (UNLIKELY (ret < 0)) return ret; } /* On errors, fall back to fork(). */ if (pid < 0) { need_move_to_cgroup = true; pid = fork (); if (UNLIKELY (pid < 0)) { ret = crun_make_error (err, errno, "fork"); goto exit; } } if (pid) { close_and_reset (&sync_socket_fd[1]); sync_fd = sync_socket_fd[0]; return join_process_parent_helper (context, container, process, pid, sync_fd, status, need_move_to_cgroup, sub_cgroup, terminal_fd, err); } close_and_reset (&sync_socket_fd[0]); sync_fd = sync_socket_fd[1]; ret = join_process_namespaces (container, pid_to_join, status, err); if (UNLIKELY (ret < 0)) { TEMP_FAILURE_RETRY (write (sync_fd, "1", 1)); libcrun_fail_with_error ((*err)->status, "%s", (*err)->msg); } if (setsid () < 0) { int saved_errno = errno; TEMP_FAILURE_RETRY (write (sync_fd, "1", 1)); libcrun_fail_with_error (saved_errno, "setsid"); } /* We need to fork once again to join the PID namespace. */ pid = fork (); if (UNLIKELY (pid < 0)) { int saved_errno = errno; TEMP_FAILURE_RETRY (write (sync_fd, "1", 1)); libcrun_fail_with_error (saved_errno, "fork"); } if (pid) { /* Just return the PID to the parent helper and exit. */ ret = TEMP_FAILURE_RETRY (write (sync_fd, "0", 1)); if (UNLIKELY (ret < 0)) { kill (pid, SIGKILL); _exit (EXIT_FAILURE); } ret = TEMP_FAILURE_RETRY (write (sync_fd, &pid, sizeof (pid))); if (UNLIKELY (ret < 0)) { kill (pid, SIGKILL); _exit (EXIT_FAILURE); } _exit (EXIT_SUCCESS); } else { /* Inside the grandchild process. The real process used for the container. */ cleanup_free char *pty = NULL; int r = -1; ret = TEMP_FAILURE_RETRY (read (sync_fd, &r, sizeof (r))); if (UNLIKELY (ret < 0)) _exit (EXIT_FAILURE); if (terminal_fd) { cleanup_close int ptmx_fd = -1; ret = setsid (); if (ret < 0) { crun_make_error (err, errno, "setsid"); send_error_to_sync_socket_and_die (sync_fd, true, err); } ret = set_id_init (container, err); if (UNLIKELY (ret < 0)) send_error_to_sync_socket_and_die (sync_fd, true, err); ptmx_fd = open_terminal (&pty, process, err); if (UNLIKELY (ptmx_fd < 0)) send_error_to_sync_socket_and_die (sync_fd, true, err); ret = send_fd_to_socket (sync_fd, ptmx_fd, err); if (UNLIKELY (ret < 0)) send_error_to_sync_socket_and_die (sync_fd, true, err); } if (r < 0) _exit (EXIT_FAILURE); } return 0; exit: if (sync_socket_fd[0] >= 0) TEMP_FAILURE_RETRY (close (sync_socket_fd[0])); if (sync_socket_fd[1] >= 0) TEMP_FAILURE_RETRY (close (sync_socket_fd[1])); return ret; } int libcrun_linux_container_update (libcrun_container_status_t *status, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err) { cleanup_cgroup_status struct libcrun_cgroup_status *cgroup_status = NULL; cgroup_status = libcrun_cgroup_make_status (status); return libcrun_update_cgroup_resources (cgroup_status, resources, err); } static int libcrun_container_pause_unpause_linux (libcrun_container_status_t *status, const bool pause, libcrun_error_t *err) { cleanup_cgroup_status struct libcrun_cgroup_status *cgroup_status = NULL; cgroup_status = libcrun_cgroup_make_status (status); return libcrun_cgroup_pause_unpause (cgroup_status, pause, err); } int libcrun_container_pause_linux (libcrun_container_status_t *status, libcrun_error_t *err) { return libcrun_container_pause_unpause_linux (status, true, err); } int libcrun_container_unpause_linux (libcrun_container_status_t *status, libcrun_error_t *err) { return libcrun_container_pause_unpause_linux (status, false, err); } int libcrun_set_personality (runtime_spec_schema_defs_linux_personality *p, libcrun_error_t *err) { unsigned long persona = 0; int ret; if (strcmp (p->domain, "LINUX") == 0) persona = PER_LINUX; else if (strcmp (p->domain, "LINUX32") == 0) persona = PER_LINUX32; else return crun_make_error (err, 0, "unknown persona specified `%s`", p->domain); ret = personality (persona); if (UNLIKELY (ret < 0)) return crun_make_error (err, 0, "set personality to `%s`", p->domain); return 0; } int libcrun_configure_network (libcrun_container_t *container, libcrun_error_t *err) { int ret; size_t i; bool configure_network = false; runtime_spec_schema_config_schema *def = container->container_def; cleanup_close int sockfd = -1; for (i = 0; i < def->linux->namespaces_len; i++) { int value = libcrun_find_namespace (def->linux->namespaces[i]->type); if (UNLIKELY (value < 0)) return crun_make_error (err, 0, "invalid namespace type: `%s`", def->linux->namespaces[i]->type); if (value == CLONE_NEWNET && def->linux->namespaces[i]->path == NULL) { configure_network = true; break; } } if (! configure_network) return 0; sockfd = socket (AF_INET, SOCK_DGRAM, 0); if (LIKELY (sockfd >= 0)) { struct ifreq ifr_lo = { .ifr_name = "lo", .ifr_flags = IFF_UP | IFF_RUNNING }; ret = ioctl (sockfd, SIOCSIFFLAGS, &ifr_lo); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "ioctl(SIOCSIFFLAGS)"); } else { struct nlmsghdr *hdr_recv; char buf[sizeof (struct nlmsghdr) + sizeof (struct ifinfomsg)]; struct sockaddr_nl addr = { .nl_family = AF_NETLINK, .nl_pid = getpid (), }; struct sockaddr_nl addr_to = { .nl_family = AF_NETLINK, .nl_pid = 0, }; struct nlmsghdr hdr = { .nlmsg_len = sizeof (struct nlmsghdr) + sizeof (struct ifinfomsg), .nlmsg_type = RTM_NEWLINK, .nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK, .nlmsg_seq = 1, .nlmsg_pid = 0, }; struct ifinfomsg msg = { .ifi_family = AF_UNSPEC, .ifi_type = 0, .ifi_index = 1, .ifi_flags = IFF_UP, .ifi_change = IFF_UP, }; *((struct nlmsghdr *) buf) = hdr; *((struct ifinfomsg *) (buf + sizeof (struct nlmsghdr))) = msg; sockfd = socket (PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE); if (UNLIKELY (sockfd < 0)) return crun_make_error (err, errno, "socket(PF_NETLINK)"); ret = bind (sockfd, (struct sockaddr *) &addr, sizeof (addr)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "bind(PF_NETLINK)"); ret = sendto (sockfd, buf, sizeof (buf), 0, (struct sockaddr *) &addr_to, sizeof (addr_to)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "sendto(PF_NETLINK)"); ret = recvfrom (sockfd, buf, sizeof (buf), 0, NULL, NULL); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "recvfrom(PF_NETLINK)"); hdr_recv = (struct nlmsghdr *) buf; if (hdr_recv->nlmsg_type == NLMSG_ERROR) { /* The first 4 bytes in the data are the negative error code in native endianness. */ errno = -(*(int32_t *) (buf + sizeof (struct nlmsghdr))); if (UNLIKELY (errno < 0)) return crun_make_error (err, errno, "recvfrom(PF_NETLINK)"); } } return 0; } /* Protection for attacks like CVE-2019-5736. */ int ensure_cloned_binary (); __attribute__ ((constructor)) static void libcrun_rexec (void) { if (ensure_cloned_binary () < 0) { fprintf (stderr, "Failed to re-execute libcrun via memory file descriptor\n"); _exit (EXIT_FAILURE); } } int libcrun_container_checkpoint_linux (libcrun_container_status_t *status, libcrun_container_t *container, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err) { return libcrun_container_checkpoint_linux_criu (status, container, cr_options, err); } int libcrun_container_restore_linux (libcrun_container_status_t *status, libcrun_container_t *container, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err) { int ret; ret = libcrun_container_restore_linux_criu (status, container, cr_options, err); if (UNLIKELY (ret < 0)) return ret; return 0; } /* Fallback to use kill(2) on systems where pidfd is not available. */ static int libcrun_kill_linux_no_pidfd (libcrun_container_status_t *status, bool check_pid, int signal, libcrun_error_t *err) { int ret; /* There is still a possibility that the pid is killed between the check and the time we send the signal, but attempt to reduce the window of time when it is possible. */ if (check_pid) { ret = libcrun_check_pid_valid (status, err); if (UNLIKELY (ret < 0)) return ret; /* The pid is not valid anymore, return an error. */ if (ret == 0) { errno = ESRCH; return crun_make_error (err, errno, "kill container"); } } ret = kill (status->pid, signal); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "kill container"); return 0; } int libcrun_kill_linux (libcrun_container_status_t *status, int signal, libcrun_error_t *err) { int ret; cleanup_close int pidfd = -1; pidfd = syscall_pidfd_open (status->pid, 0); if (UNLIKELY (pidfd < 0)) { /* If pidfd_open is not supported, fallback to kill. */ if (errno == ENOSYS) return libcrun_kill_linux_no_pidfd (status, true, signal, err); return crun_make_error (err, errno, "open pidfd"); } ret = libcrun_check_pid_valid (status, err); if (UNLIKELY (ret < 0)) return ret; /* The pid is not valid anymore, return an error. */ if (ret == 0) { errno = ESRCH; return crun_make_error (err, errno, "kill container"); } ret = syscall_pidfd_send_signal (pidfd, signal, NULL, 0); if (UNLIKELY (ret < 0)) { /* If pidfd_send_signal is not supported, fallback to kill. */ if (errno == ENOSYS) return libcrun_kill_linux_no_pidfd (status, false, signal, err); return crun_make_error (err, errno, "send signal to pidfd"); } return 0; } const char * libcrun_get_intelrdt_name (const char *ctr_name, libcrun_container_t *container, bool *explicit) { runtime_spec_schema_config_schema *def = NULL; def = container->container_def; if (def == NULL || def->linux == NULL || def->linux->intel_rdt == NULL || def->linux->intel_rdt->clos_id == NULL) { if (explicit) *explicit = false; return ctr_name; } if (explicit) *explicit = true; return def->linux->intel_rdt->clos_id; } int libcrun_apply_intelrdt (const char *ctr_name, libcrun_container_t *container, pid_t pid, int actions, libcrun_error_t *err) { runtime_spec_schema_config_schema *def = NULL; bool explicit = false; bool created = false; const char *name; int ret; if (container) def = container->container_def; if (def == NULL || def->linux == NULL || def->linux->intel_rdt == NULL) return 0; name = libcrun_get_intelrdt_name (ctr_name, container, &explicit); if (actions & LIBCRUN_INTELRDT_CREATE) { ret = resctl_create (name, explicit, &created, def->linux->intel_rdt->l3cache_schema, def->linux->intel_rdt->mem_bw_schema, err); if (UNLIKELY (ret < 0)) return ret; } if (actions & LIBCRUN_INTELRDT_UPDATE) { ret = resctl_update (name, def->linux->intel_rdt->l3cache_schema, def->linux->intel_rdt->mem_bw_schema, err); if (UNLIKELY (ret < 0)) goto fail; } if (actions & LIBCRUN_INTELRDT_MOVE) { ret = resctl_move_task_to (name, pid, err); if (UNLIKELY (ret < 0)) goto fail; } return 0; fail: /* Cleanup only if the resctl was created as part of this call. */ if (created) { libcrun_error_t tmp_err = NULL; int tmp_ret; tmp_ret = resctl_destroy (name, &tmp_err); if (tmp_ret < 0) crun_error_release (&tmp_err); } return ret; } int libcrun_destroy_intelrdt (const char *name, libcrun_error_t *err) { return resctl_destroy (name, err); } int libcrun_update_intel_rdt (const char *ctr_name, libcrun_container_t *container, const char *l3_cache_schema, const char *mem_bw_schema, libcrun_error_t *err) { const char *name; name = libcrun_get_intelrdt_name (ctr_name, container, NULL); return resctl_update (name, l3_cache_schema, mem_bw_schema, err); } /* Change the current directory and make sure the current working directory, once set, is accessible from the current mount namespace. This check prevents container-escape issues like CVE-2024-21626. The current working directory cannot be longer than PATH_MAX. */ int libcrun_safe_chdir (const char *path, libcrun_error_t *err) { cleanup_free char *buffer = NULL; int ret; ret = chdir (path); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chdir to `%s`", path); buffer = xmalloc (PATH_MAX); ret = syscall_getcwd (buffer, PATH_MAX); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "getcwd"); /* Enforce that the returned path is an absolute path. */ if (ret == 0 || buffer[0] != '/') { (void) chdir ("/"); errno = ENOENT; /* The kernel prepends the string "(unreachable)" to the path when it is not reachable from the current mount namespace. Use it to give a better error message. */ #define UNREACHABLE "(unreachable)" #define UNREACHABLE_LEN ((int) sizeof (UNREACHABLE) - 1) if ((ret >= UNREACHABLE_LEN) && (memcmp (buffer, UNREACHABLE, UNREACHABLE_LEN) == 0)) return crun_make_error (err, errno, "the working directory is not accessible from the current namespace"); return crun_make_error (err, errno, "the current working directory is not an absolute path"); } return 0; } crun-1.16.1/src/libcrun/mount_flags.c0000644000000000000000000003627214514171717015666 0ustar0000000000000000/* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf --lookup-function-name libcrun_mount_flag_in_word_set -m 100 -tCEG -S1 src/libcrun/mount_flags.perf */ /* Computed positions: -k'1-4' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 19 "src/libcrun/mount_flags.perf" #define _GNU_SOURCE #include #include #include #include #include #include #include "utils.h" #include "mount_flags.h" #line 34 "src/libcrun/mount_flags.perf" struct propagation_flags_s; enum { TOTAL_KEYWORDS = 57, MIN_WORD_LENGTH = 2, MAX_WORD_LENGTH = 14, MIN_HASH_VALUE = 2, MAX_HASH_VALUE = 74 }; /* maximum key range = 73, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int hash (register const char *str, register size_t len) { static const unsigned char asso_values[] = { 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 8, 29, 12, 3, 21, 0, 75, 31, 0, 75, 75, 15, 10, 0, 4, 16, 75, 0, 19, 8, 17, 26, 0, 16, 26, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75 }; register unsigned int hval = len; switch (hval) { default: hval += asso_values[(unsigned char)str[3]]; /*FALLTHROUGH*/ case 3: hval += asso_values[(unsigned char)str[2]]; /*FALLTHROUGH*/ case 2: hval += asso_values[(unsigned char)str[1]]; /*FALLTHROUGH*/ case 1: hval += asso_values[(unsigned char)str[0]]; break; } return hval; } static const struct propagation_flags_s wordlist[] = { #line 40 "src/libcrun/mount_flags.perf" {"rw", 1, MS_RDONLY, 0}, #line 70 "src/libcrun/mount_flags.perf" {"rrw", 1, MS_RDONLY, OPTION_RECURSIVE}, #line 39 "src/libcrun/mount_flags.perf" {"ro", 0, MS_RDONLY, 0}, #line 69 "src/libcrun/mount_flags.perf" {"rro", 0, MS_RDONLY, OPTION_RECURSIVE}, #line 79 "src/libcrun/mount_flags.perf" {"rdirsync", 0, MS_DIRSYNC, OPTION_RECURSIVE}, #line 84 "src/libcrun/mount_flags.perf" {"rdiratime", 1, MS_NODIRATIME, OPTION_RECURSIVE}, #line 74 "src/libcrun/mount_flags.perf" {"rnodev", 0, MS_NODEV, OPTION_RECURSIVE}, #line 87 "src/libcrun/mount_flags.perf" {"rnorelatime", 1, MS_RELATIME, OPTION_RECURSIVE}, #line 56 "src/libcrun/mount_flags.perf" {"nodiratime", 0, MS_NODIRATIME, 0}, #line 85 "src/libcrun/mount_flags.perf" {"rnodiratime", 0, MS_NODIRATIME, OPTION_RECURSIVE}, #line 55 "src/libcrun/mount_flags.perf" {"diratime", 1, MS_NODIRATIME, 0}, #line 83 "src/libcrun/mount_flags.perf" {"rnoatime", 0, MS_NOATIME, OPTION_RECURSIVE}, #line 81 "src/libcrun/mount_flags.perf" {"rnomand", 1, MS_MANDLOCK, OPTION_RECURSIVE}, #line 82 "src/libcrun/mount_flags.perf" {"ratime", 1, MS_NOATIME, OPTION_RECURSIVE}, #line 80 "src/libcrun/mount_flags.perf" {"rmand", 0, MS_MANDLOCK, OPTION_RECURSIVE}, #line 66 "src/libcrun/mount_flags.perf" {"rprivate", 0, MS_REC|MS_PRIVATE, 0}, #line 51 "src/libcrun/mount_flags.perf" {"mand", 0, MS_MANDLOCK, 0}, #line 91 "src/libcrun/mount_flags.perf" {"idmap", 0, 0, OPTION_IDMAP}, #line 54 "src/libcrun/mount_flags.perf" {"noatime", 0, MS_NOATIME, 0}, #line 52 "src/libcrun/mount_flags.perf" {"nomand", 1, MS_MANDLOCK, 0}, #line 49 "src/libcrun/mount_flags.perf" {"dirsync", 0, MS_DIRSYNC, 0}, #line 72 "src/libcrun/mount_flags.perf" {"rnosuid", 0, MS_NOSUID, OPTION_RECURSIVE}, #line 53 "src/libcrun/mount_flags.perf" {"atime", 1, MS_NOATIME, 0}, #line 76 "src/libcrun/mount_flags.perf" {"rnoexec", 0, MS_NOEXEC, OPTION_RECURSIVE}, #line 44 "src/libcrun/mount_flags.perf" {"nodev", 0, MS_NODEV, 0}, #line 38 "src/libcrun/mount_flags.perf" {"rbind", 0, MS_REC|MS_BIND, 0}, #line 58 "src/libcrun/mount_flags.perf" {"norelatime", 1, MS_RELATIME, 0}, #line 37 "src/libcrun/mount_flags.perf" {"bind", 0, MS_BIND, 0}, #line 89 "src/libcrun/mount_flags.perf" {"rnostrictatime", 1, MS_STRICTATIME, OPTION_RECURSIVE}, #line 59 "src/libcrun/mount_flags.perf" {"strictatime", 0, MS_STRICTATIME, 0}, #line 88 "src/libcrun/mount_flags.perf" {"rstrictatime", 0, MS_STRICTATIME, OPTION_RECURSIVE}, #line 36 "src/libcrun/mount_flags.perf" {"defaults", 0, 0, 0}, #line 71 "src/libcrun/mount_flags.perf" {"rsuid", 1, MS_NOSUID, OPTION_RECURSIVE}, #line 50 "src/libcrun/mount_flags.perf" {"remount", 0, MS_REMOUNT, 0}, #line 41 "src/libcrun/mount_flags.perf" {"suid", 1, MS_NOSUID, 0}, #line 60 "src/libcrun/mount_flags.perf" {"nostrictatime", 1, MS_STRICTATIME, 0}, #line 86 "src/libcrun/mount_flags.perf" {"rrelatime", 0, MS_RELATIME, OPTION_RECURSIVE}, #line 42 "src/libcrun/mount_flags.perf" {"nosuid", 0, MS_NOSUID, 0}, #line 46 "src/libcrun/mount_flags.perf" {"noexec", 0, MS_NOEXEC, 0}, #line 64 "src/libcrun/mount_flags.perf" {"rslave", 0, MS_REC|MS_SLAVE, 0}, #line 65 "src/libcrun/mount_flags.perf" {"private", 0, MS_PRIVATE, 0}, #line 77 "src/libcrun/mount_flags.perf" {"rsync", 0, MS_SYNCHRONOUS, OPTION_RECURSIVE}, #line 57 "src/libcrun/mount_flags.perf" {"relatime", 0, MS_RELATIME, 0}, #line 43 "src/libcrun/mount_flags.perf" {"dev", 1, MS_NODEV, 0}, #line 73 "src/libcrun/mount_flags.perf" {"rdev", 1, MS_NODEV, OPTION_RECURSIVE}, #line 90 "src/libcrun/mount_flags.perf" {"tmpcopyup", 0, 0, OPTION_TMPCOPYUP}, #line 67 "src/libcrun/mount_flags.perf" {"unbindable", 0, MS_UNBINDABLE, 0}, #line 68 "src/libcrun/mount_flags.perf" {"runbindable", 0, MS_REC|MS_UNBINDABLE, 0}, #line 48 "src/libcrun/mount_flags.perf" {"async", 1, MS_SYNCHRONOUS, 0}, #line 78 "src/libcrun/mount_flags.perf" {"rasync", 1, MS_SYNCHRONOUS, OPTION_RECURSIVE}, #line 47 "src/libcrun/mount_flags.perf" {"sync", 0, MS_SYNCHRONOUS, 0}, #line 75 "src/libcrun/mount_flags.perf" {"rexec", 1, MS_NOEXEC, OPTION_RECURSIVE}, #line 61 "src/libcrun/mount_flags.perf" {"shared", 0, MS_SHARED, 0}, #line 62 "src/libcrun/mount_flags.perf" {"rshared", 0, MS_REC|MS_SHARED, 0}, #line 92 "src/libcrun/mount_flags.perf" {"copy-symlink", 0, 0, OPTION_COPY_SYMLINK}, #line 63 "src/libcrun/mount_flags.perf" {"slave", 0, MS_SLAVE, 0}, #line 45 "src/libcrun/mount_flags.perf" {"exec", 1, MS_NOEXEC, 0} }; const struct propagation_flags_s * libcrun_mount_flag_in_word_set (register const char *str, register size_t len) { if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = hash (str, len); if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) { register const struct propagation_flags_s *resword; switch (key - 2) { case 0: resword = &wordlist[0]; goto compare; case 1: resword = &wordlist[1]; goto compare; case 4: resword = &wordlist[2]; goto compare; case 5: resword = &wordlist[3]; goto compare; case 9: resword = &wordlist[4]; goto compare; case 10: resword = &wordlist[5]; goto compare; case 11: resword = &wordlist[6]; goto compare; case 13: resword = &wordlist[7]; goto compare; case 15: resword = &wordlist[8]; goto compare; case 16: resword = &wordlist[9]; goto compare; case 17: resword = &wordlist[10]; goto compare; case 18: resword = &wordlist[11]; goto compare; case 19: resword = &wordlist[12]; goto compare; case 20: resword = &wordlist[13]; goto compare; case 21: resword = &wordlist[14]; goto compare; case 22: resword = &wordlist[15]; goto compare; case 23: resword = &wordlist[16]; goto compare; case 24: resword = &wordlist[17]; goto compare; case 25: resword = &wordlist[18]; goto compare; case 26: resword = &wordlist[19]; goto compare; case 27: resword = &wordlist[20]; goto compare; case 28: resword = &wordlist[21]; goto compare; case 29: resword = &wordlist[22]; goto compare; case 30: resword = &wordlist[23]; goto compare; case 31: resword = &wordlist[24]; goto compare; case 32: resword = &wordlist[25]; goto compare; case 33: resword = &wordlist[26]; goto compare; case 34: resword = &wordlist[27]; goto compare; case 35: resword = &wordlist[28]; goto compare; case 36: resword = &wordlist[29]; goto compare; case 37: resword = &wordlist[30]; goto compare; case 38: resword = &wordlist[31]; goto compare; case 39: resword = &wordlist[32]; goto compare; case 40: resword = &wordlist[33]; goto compare; case 41: resword = &wordlist[34]; goto compare; case 42: resword = &wordlist[35]; goto compare; case 43: resword = &wordlist[36]; goto compare; case 44: resword = &wordlist[37]; goto compare; case 45: resword = &wordlist[38]; goto compare; case 46: resword = &wordlist[39]; goto compare; case 47: resword = &wordlist[40]; goto compare; case 48: resword = &wordlist[41]; goto compare; case 50: resword = &wordlist[42]; goto compare; case 51: resword = &wordlist[43]; goto compare; case 52: resword = &wordlist[44]; goto compare; case 53: resword = &wordlist[45]; goto compare; case 54: resword = &wordlist[46]; goto compare; case 55: resword = &wordlist[47]; goto compare; case 56: resword = &wordlist[48]; goto compare; case 57: resword = &wordlist[49]; goto compare; case 59: resword = &wordlist[50]; goto compare; case 61: resword = &wordlist[51]; goto compare; case 62: resword = &wordlist[52]; goto compare; case 63: resword = &wordlist[53]; goto compare; case 68: resword = &wordlist[54]; goto compare; case 71: resword = &wordlist[55]; goto compare; case 72: resword = &wordlist[56]; goto compare; } return 0; compare: { register const char *s = resword->name; if (*str == *s && !strcmp (str + 1, s + 1)) return resword; } } } return 0; } #line 93 "src/libcrun/mount_flags.perf" const struct propagation_flags_s * libcrun_str2mount_flags (const char *name) { return libcrun_mount_flag_in_word_set (name, strlen (name)); } const struct propagation_flags_s * get_mount_flags_from_wordlist (void) { struct propagation_flags_s *flags; size_t i; size_t num_wordlist_flags = sizeof (wordlist) / sizeof (wordlist[0]); flags = xmalloc0 ((sizeof (struct propagation_flags_s) + 1) * num_wordlist_flags); for (i = 0; i < num_wordlist_flags; i++) flags[i].name = wordlist[i].name; return flags; } crun-1.16.1/src/libcrun/scheduler.c0000644000000000000000000001120414504567214015312 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "linux.h" #include "utils.h" #include #include #include #include #include #include #ifndef SCHED_FLAG_RESET_ON_FORK # define SCHED_FLAG_RESET_ON_FORK 0x01 #endif #ifndef SCHED_FLAG_RECLAIM # define SCHED_FLAG_RECLAIM 0x02 #endif #ifndef SCHED_FLAG_DL_OVERRUN # define SCHED_FLAG_DL_OVERRUN 0x04 #endif #ifndef SCHED_FLAG_KEEP_POLICY # define SCHED_FLAG_KEEP_POLICY 0x08 #endif #ifndef SCHED_FLAG_KEEP_PARAMS # define SCHED_FLAG_KEEP_PARAMS 0x10 #endif #ifndef SCHED_FLAG_UTIL_CLAMP_MIN # define SCHED_FLAG_UTIL_CLAMP_MIN 0x20 #endif #ifndef SCHED_FLAG_UTIL_CLAMP_MAX # define SCHED_FLAG_UTIL_CLAMP_MAX 0x40 #endif struct sched_attr_s { uint32_t size; uint32_t sched_policy; uint64_t sched_flags; int32_t sched_nice; uint32_t sched_priority; uint64_t sched_runtime; uint64_t sched_deadline; uint64_t sched_period; }; static int syscall_sched_setattr (pid_t pid, struct sched_attr_s *attr, unsigned int flags) { #ifdef __NR_sched_setattr return syscall (__NR_sched_setattr, pid, attr, flags); #else (void) pid; (void) attr; (void) flags; errno = ENOSYS; return -1; #endif } int libcrun_set_scheduler (pid_t pid, runtime_spec_schema_config_schema_process *process, libcrun_error_t *err) { struct sched_attr_s attr; int i, ret, policy; size_t s; struct { const char *name; int value; } policies[] = { { "SCHED_OTHER", SCHED_OTHER }, { "SCHED_BATCH", SCHED_BATCH }, { "SCHED_IDLE", SCHED_IDLE }, { "SCHED_FIFO", SCHED_FIFO }, { "SCHED_RR", SCHED_RR }, { "SCHED_DEADLINE", SCHED_DEADLINE }, { NULL, 0 }, }; if (process == NULL || process->scheduler == NULL) return 0; memset (&attr, 0, sizeof (attr)); attr.size = sizeof (attr); if (is_empty_string (process->scheduler->policy)) return crun_make_error (err, 0, "scheduler policy not defined"); policy = -1; for (i = 0; policies[i].name; i++) if (strcmp (process->scheduler->policy, policies[i].name) == 0) { policy = i; break; } if (UNLIKELY (policy < 0)) return crun_make_error (err, 0, "invalid scheduler `%s`", process->scheduler->policy); attr.sched_policy = policies[policy].value; if (process->scheduler->nice_present) attr.sched_nice = process->scheduler->nice; if (process->scheduler->priority_present) attr.sched_priority = process->scheduler->priority; if (process->scheduler->runtime_present) attr.sched_runtime = process->scheduler->runtime; if (process->scheduler->deadline_present) attr.sched_deadline = process->scheduler->deadline; if (process->scheduler->period_present) attr.sched_period = process->scheduler->period; for (s = 0; s < process->scheduler->flags_len; s++) { char *key = process->scheduler->flags[s]; if (strcmp (key, "SCHED_FLAG_RESET_ON_FORK") == 0) attr.sched_flags |= SCHED_FLAG_RESET_ON_FORK; else if (strcmp (key, "SCHED_FLAG_RECLAIM") == 0) attr.sched_flags |= SCHED_FLAG_RECLAIM; else if (strcmp (key, "SCHED_FLAG_DL_OVERRUN") == 0) attr.sched_flags |= SCHED_FLAG_DL_OVERRUN; else if (strcmp (key, "SCHED_FLAG_KEEP_POLICY") == 0) attr.sched_flags |= SCHED_FLAG_KEEP_POLICY; else if (strcmp (key, "SCHED_FLAG_KEEP_PARAMS") == 0) attr.sched_flags |= SCHED_FLAG_KEEP_PARAMS; else if (strcmp (key, "SCHED_FLAG_UTIL_CLAMP_MIN") == 0) attr.sched_flags |= SCHED_FLAG_UTIL_CLAMP_MIN; else if (strcmp (key, "SCHED_FLAG_UTIL_CLAMP_MAX") == 0) attr.sched_flags |= SCHED_FLAG_UTIL_CLAMP_MAX; else return crun_make_error (err, 0, "invalid scheduler option `%s`", key); } ret = syscall_sched_setattr (pid, &attr, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "sched_setattr"); return 0; } crun-1.16.1/src/libcrun/seccomp.c0000644000000000000000000006574414554235516015011 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "blake3/blake3.h" #include "seccomp.h" #include "linux.h" #include "utils.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if HAVE_STDATOMIC_H # include # ifndef HAVE_ATOMIC_INT # define atomic_int volatile int # endif #endif #ifdef HAVE_SECCOMP # include #endif #include #include #include #include #ifndef __NR_seccomp # define __NR_seccomp 0xffff // seccomp syscall number unknown for this architecture #endif #ifndef SECCOMP_SET_MODE_STRICT # define SECCOMP_SET_MODE_STRICT 0 #endif #ifndef SECCOMP_SET_MODE_FILTER # define SECCOMP_SET_MODE_FILTER 1 #endif #ifndef SECCOMP_FILTER_FLAG_TSYNC # define SECCOMP_FILTER_FLAG_TSYNC (1UL << 0) #endif #ifndef SECCOMP_FILTER_FLAG_LOG # define SECCOMP_FILTER_FLAG_LOG (1UL << 1) #endif #ifndef SECCOMP_FILTER_FLAG_SPEC_ALLOW # define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2) #endif #ifndef SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV # define SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV (1UL << 5) #endif #define SECCOMP_CACHE_DIR ".cache/seccomp" /* On Linux 5.19.15 x86_64, tmpfs reports 20 bytes + 20 bytes for each entry, so allow at least 32 entries. */ #define MIN_CACHE_DIR_INODE_SIZE (20 + 32 * 20) /* Heuristic to avoid the cache directory grows indefinitely. The inode size for the directory is proportional to the number of entries it contains and it is cheaper to compute than iterating the cache directory. */ static inline off_t get_cache_dir_inode_max_size (off_t size_rundir) { return size_rundir * 3 + MIN_CACHE_DIR_INODE_SIZE; } static int syscall_seccomp (unsigned int operation, unsigned int flags, void *args) { return (int) syscall (__NR_seccomp, operation, flags, args); } static unsigned long get_seccomp_operator (const char *name, libcrun_error_t *err) { #ifdef HAVE_SECCOMP if (strcmp (name, "SCMP_CMP_NE") == 0) return SCMP_CMP_NE; if (strcmp (name, "SCMP_CMP_LT") == 0) return SCMP_CMP_LT; if (strcmp (name, "SCMP_CMP_LE") == 0) return SCMP_CMP_LE; if (strcmp (name, "SCMP_CMP_EQ") == 0) return SCMP_CMP_EQ; if (strcmp (name, "SCMP_CMP_GE") == 0) return SCMP_CMP_GE; if (strcmp (name, "SCMP_CMP_GT") == 0) return SCMP_CMP_GT; if (strcmp (name, "SCMP_CMP_MASKED_EQ") == 0) return SCMP_CMP_MASKED_EQ; crun_make_error (err, 0, "seccomp get operator `%s`", name); return 0; #else return 0; #endif } static unsigned long long get_seccomp_action (const char *name, int errno_ret, libcrun_error_t *err) { #ifdef HAVE_SECCOMP const char *p; p = name; if (strncmp (p, "SCMP_ACT_", 9)) goto fail; p += 9; if (strcmp (p, "ALLOW") == 0) return SCMP_ACT_ALLOW; else if (strcmp (p, "ERRNO") == 0) return SCMP_ACT_ERRNO (errno_ret); else if (strcmp (p, "KILL") == 0) return SCMP_ACT_KILL; # ifdef SCMP_ACT_LOG else if (strcmp (p, "LOG") == 0) return SCMP_ACT_LOG; # endif else if (strcmp (p, "TRAP") == 0) return SCMP_ACT_TRAP; else if (strcmp (p, "TRACE") == 0) return SCMP_ACT_TRACE (errno_ret); # ifdef SCMP_ACT_KILL_PROCESS else if (strcmp (p, "KILL_PROCESS") == 0) return SCMP_ACT_KILL_PROCESS; # endif # ifdef SCMP_ACT_KILL_THREAD else if (strcmp (p, "KILL_THREAD") == 0) return SCMP_ACT_KILL_THREAD; # endif # ifdef SCMP_ACT_NOTIFY else if (strcmp (p, "NOTIFY") == 0) return SCMP_ACT_NOTIFY; # endif fail: crun_make_error (err, 0, "seccomp get action `%s`", name); return 0; #else return 0; #endif } static void make_lowercase (char *str) { while (*str) { *str = tolower (*str); str++; } } static void cleanup_seccompp (void *p) { #ifdef HAVE_SECCOMP scmp_filter_ctx *ctx = (void **) p; if (*ctx) seccomp_release (*ctx); #endif } #define cleanup_seccomp __attribute__ ((cleanup (cleanup_seccompp))) int libcrun_apply_seccomp (int infd, int listener_receiver_fd, const char *receiver_fd_payload, size_t receiver_fd_payload_len, char **seccomp_flags, size_t seccomp_flags_len, libcrun_error_t *err) { #ifdef HAVE_SECCOMP cleanup_mmap struct libcrun_mmap_s *mmap_region = NULL; cleanup_close int listener_fd = -1; cleanup_pid int helper_proc = -1; struct sock_fprog seccomp_filter; cleanup_free char *bpf = NULL; unsigned int flags = 0; size_t len; int ret; if (infd < 0) return 0; if (UNLIKELY (lseek (infd, 0, SEEK_SET) == (off_t) -1)) return crun_make_error (err, errno, "lseek"); /* if no seccomp flag was specified use a sane default. */ if (seccomp_flags == NULL) flags = SECCOMP_FILTER_FLAG_SPEC_ALLOW; else { size_t i = 0; for (i = 0; i < seccomp_flags_len; i++) { if (strcmp (seccomp_flags[i], "SECCOMP_FILTER_FLAG_TSYNC") == 0) flags |= SECCOMP_FILTER_FLAG_TSYNC; else if (strcmp (seccomp_flags[i], "SECCOMP_FILTER_FLAG_SPEC_ALLOW") == 0) flags |= SECCOMP_FILTER_FLAG_SPEC_ALLOW; else if (strcmp (seccomp_flags[i], "SECCOMP_FILTER_FLAG_LOG") == 0) flags |= SECCOMP_FILTER_FLAG_LOG; else if (strcmp (seccomp_flags[i], "SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV") == 0) flags |= SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV; else return crun_make_error (err, 0, "unknown seccomp option `%s`", seccomp_flags[i]); } } ret = read_all_fd (infd, "seccomp.bpf", &bpf, &len, err); if (UNLIKELY (ret < 0)) return ret; seccomp_filter.len = len / 8; seccomp_filter.filter = (struct sock_filter *) bpf; if (listener_receiver_fd >= 0) { cleanup_close int memfd = -1; atomic_int *fd_received; # ifdef SECCOMP_FILTER_FLAG_NEW_LISTENER flags |= SECCOMP_FILTER_FLAG_NEW_LISTENER; # else return crun_make_error (err, 0, "the `SECCOMP_FILTER_FLAG_NEW_LISTENER` flag is not supported"); # endif # ifdef HAVE_MEMFD_CREATE memfd = memfd_create ("seccomp-helper-memfd", O_RDWR | MFD_CLOEXEC); if (UNLIKELY (memfd < 0)) return crun_make_error (err, errno, "memfd_create"); # else return crun_make_error (err, ENOSYS, "memfd_create non supported"); # endif ret = ftruncate (memfd, sizeof (atomic_int)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "ftruncate seccomp memfd"); ret = libcrun_mmap (&mmap_region, NULL, sizeof (atomic_int), PROT_WRITE | PROT_READ, MAP_SHARED, memfd, 0, err); if (UNLIKELY (ret < 0)) return ret; /* memfd is not needed anymore. */ close_and_reset (&memfd); fd_received = mmap_region->addr; *fd_received = -1; /* The helper process shares the fd table with the current process. */ helper_proc = syscall_clone (CLONE_FILES | SIGCHLD, NULL); if (UNLIKELY (helper_proc < 0)) return crun_make_error (err, errno, "clone seccomp listener helper process"); /* helper process. Wait that the seccomp listener fd is created then send it to the receiver fd. We use the helper process since the seccomp profile could block the sendmsg syscall. Its exit status is an errno value. */ if (helper_proc == 0) { int fd, timeout = 0; prctl (PR_SET_PDEATHSIG, SIGKILL); for (;;) { fd = *fd_received; if (fd == -1) { usleep (1000); /* Do not wait longer than 5 seconds. */ if (timeout++ > 5000) _exit (EINVAL); continue; } # if ! HAVE_STDATOMIC_H /* If stdatomic is not available, force a membarrier and read again. */ __sync_synchronize (); fd = *fd_received; # endif break; } ret = send_fd_to_socket_with_payload (listener_receiver_fd, fd, receiver_fd_payload, receiver_fd_payload_len, err); if (UNLIKELY (ret < 0)) _exit (crun_error_get_errno (err)); _exit (0); } } ret = syscall_seccomp (SECCOMP_SET_MODE_FILTER, flags, &seccomp_filter); if (UNLIKELY (ret < 0)) { /* If any of the flags is not supported, try again without specifying them: */ if (errno == EINVAL && listener_receiver_fd < 0) ret = syscall_seccomp (SECCOMP_SET_MODE_FILTER, 0, &seccomp_filter); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "seccomp (SECCOMP_SET_MODE_FILTER)"); } if (listener_receiver_fd >= 0) { atomic_int *fd_to_send = mmap_region->addr; int status = 0; /* Write atomically the listener fd to the shared memory. No syscalls are used between the seccomp listener creation and the write. */ *fd_to_send = listener_fd = ret; ret = waitpid_ignore_stopped (helper_proc, &status, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "waitpid seccomp listener helper process"); ret = get_process_exit_status (status); if (ret != 0) return crun_make_error (err, ret, "send listener fd `%d` to receiver", listener_fd); } return 0; #else return 0; #endif } static bool seccomp_action_supports_errno (const char *action) { return strcmp (action, "SCMP_ACT_ERRNO") == 0 || strcmp (action, "SCMP_ACT_TRACE") == 0; } /* Calculate a checksum for the specified seccomp configuration. Returns: < 0 in case of errors == 0 the checksum is supported and the value is in OUT. */ static int calculate_seccomp_checksum (runtime_spec_schema_config_linux_seccomp *seccomp, unsigned int seccomp_gen_options, seccomp_checksum_t out, libcrun_error_t *err) { blake3_hasher hasher; unsigned char hash[32]; struct utsname utsbuf; size_t i; int ret; blake3_hasher_init (&hasher); #define PROCESS_STRING(X) \ do \ { \ if (X) \ blake3_hasher_update (&hasher, (X), strlen ((X))); \ } while (0) #define PROCESS_DATA(X) \ do \ { \ blake3_hasher_update (&hasher, &(X), sizeof ((X))); \ } while (0) PROCESS_STRING (PACKAGE_VERSION); #ifdef HAVE_SECCOMP { const struct scmp_version *version = seccomp_version (); PROCESS_DATA (version->major); PROCESS_DATA (version->minor); PROCESS_DATA (version->micro); } #endif memset (&utsbuf, 0, sizeof (utsbuf)); ret = uname (&utsbuf); if (UNLIKELY (ret != 0)) return crun_make_error (err, errno, "uname"); PROCESS_STRING (utsbuf.release); PROCESS_STRING (utsbuf.version); PROCESS_STRING (utsbuf.machine); PROCESS_DATA (seccomp_gen_options); PROCESS_DATA (seccomp->default_errno_ret); PROCESS_STRING (seccomp->default_action); for (i = 0; i < seccomp->flags_len; i++) PROCESS_STRING (seccomp->flags[i]); for (i = 0; i < seccomp->architectures_len; i++) PROCESS_STRING (seccomp->architectures[i]); for (i = 0; i < seccomp->syscalls_len; i++) { size_t j; if (seccomp->syscalls[i]->action) PROCESS_STRING (seccomp->syscalls[i]->action); for (j = 0; j < seccomp->syscalls[i]->names_len; j++) PROCESS_STRING (seccomp->syscalls[i]->names[j]); for (j = 0; j < seccomp->syscalls[i]->args_len; j++) { if (seccomp->syscalls[i]->args[j]->index_present) PROCESS_DATA (seccomp->syscalls[i]->args[j]->index); if (seccomp->syscalls[i]->args[j]->value_present) PROCESS_DATA (seccomp->syscalls[i]->args[j]->value); if (seccomp->syscalls[i]->args[j]->value_two_present) PROCESS_DATA (seccomp->syscalls[i]->args[j]->value_two); PROCESS_STRING (seccomp->syscalls[i]->args[j]->op); } } blake3_hasher_finalize (&hasher, hash, sizeof (hash)); for (i = 0; i < 32; i++) sprintf (&out[i * 2], "%02x", hash[i]); out[64] = 0; #undef PROCESS_STRING #undef PROCESS_DATA return 1; } static int open_rundir_dirfd (const char *state_root, libcrun_error_t *err) { cleanup_free char *dir = NULL; int dirfd; dir = libcrun_get_state_directory (state_root, NULL); if (UNLIKELY (dir == NULL)) return crun_make_error (err, 0, "cannot get state directory"); dirfd = TEMP_FAILURE_RETRY (open (dir, O_PATH | O_DIRECTORY | O_CLOEXEC)); if (UNLIKELY (dirfd < 0)) return crun_make_error (err, errno, "open `%s`", dir); return dirfd; } struct cache_entry { seccomp_checksum_t checksum; struct timespec atime; }; static int compare_entries_by_atime (const void *a, const void *b) { const struct cache_entry *entry_a = a; const struct cache_entry *entry_b = b; int ret; ret = entry_a->atime.tv_sec - entry_b->atime.tv_sec; if (ret) return ret; return entry_a->atime.tv_nsec - entry_b->atime.tv_nsec; } static int evict_cache (int root_dfd, libcrun_error_t *err) { cleanup_close int cache_dir_fd = -1; off_t cache_dir_inode_max_size; struct stat st; int ret; ret = TEMP_FAILURE_RETRY (fstat (root_dfd, &st)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "fstat rundir"); cache_dir_inode_max_size = get_cache_dir_inode_max_size (st.st_size); cache_dir_fd = TEMP_FAILURE_RETRY (openat (root_dfd, SECCOMP_CACHE_DIR, O_DIRECTORY | O_CLOEXEC)); if (UNLIKELY (cache_dir_fd < 0)) { if (errno == ENOENT) return 0; return crun_make_error (err, errno, "open `%s`", SECCOMP_CACHE_DIR); } ret = TEMP_FAILURE_RETRY (fstat (cache_dir_fd, &st)); if (ret == 0 && st.st_size > cache_dir_inode_max_size) { cleanup_free struct cache_entry *entries = NULL; cleanup_dir DIR *d = NULL; size_t i, n_entries = 0; struct dirent *de; int dfd; d = fdopendir (cache_dir_fd); if (d == NULL) return crun_make_error (err, errno, "cannot open seccomp cache directory"); /* fdopendir owns the fd now. */ cache_dir_fd = -1; dfd = dirfd (d); while ((de = readdir (d))) { if (de->d_name[0] == '.') continue; ret = TEMP_FAILURE_RETRY (fstatat (dfd, de->d_name, &st, AT_SYMLINK_NOFOLLOW)); if (UNLIKELY (ret < 0)) continue; /* The cache file is already used, it is pointless to free it. */ if (st.st_nlink > 1) continue; /* If the sticky bit is set, then ignore it. */ if (st.st_mode & S_ISVTX) continue; if (strlen (de->d_name) != sizeof (seccomp_checksum_t) - 1) { /* No mercy for unknown files. */ unlinkat (dfd, de->d_name, 0); continue; } else { entries = xrealloc (entries, sizeof (struct cache_entry) * (n_entries + 1)); memcpy (entries[n_entries].checksum, de->d_name, sizeof (seccomp_checksum_t)); entries[n_entries].atime = st.st_atim; n_entries++; } } qsort (entries, n_entries, sizeof (struct cache_entry), compare_entries_by_atime); /* Attempt to delete half of them. */ for (i = 0; i < (n_entries == 1 ? 1 : n_entries / 2); i++) unlinkat (dfd, entries[i].checksum, 0); } return 0; } static int store_seccomp_cache (struct libcrun_seccomp_gen_ctx_s *ctx, libcrun_error_t *err) { libcrun_container_t *container = ctx->container; cleanup_free char *src_path = NULL; cleanup_free char *dest_path = NULL; cleanup_close int dirfd = -1; int ret; if (ctx->options & LIBCRUN_SECCOMP_SKIP_CACHE) return 0; if (is_empty_string (ctx->checksum)) return 0; dirfd = open_rundir_dirfd (container->context->state_root, err); if (UNLIKELY (dirfd < 0)) return dirfd; /* relative path to dirfd. */ ret = append_paths (&src_path, err, container->context->id, "seccomp.bpf", NULL); if (UNLIKELY (ret < 0)) return ret; ret = append_paths (&dest_path, err, SECCOMP_CACHE_DIR, ctx->checksum, NULL); if (UNLIKELY (ret < 0)) return ret; ret = crun_ensure_directory_at (dirfd, SECCOMP_CACHE_DIR, 0700, true, err); if (UNLIKELY (ret < 0)) return ret; ret = evict_cache (dirfd, err); if (UNLIKELY (ret < 0)) return ret; ret = linkat (dirfd, src_path, dirfd, dest_path, 0); if (UNLIKELY (ret < 0 && errno != EEXIST)) return crun_make_error (err, errno, "link `%s` to `%s`", src_path, dest_path); return 0; } static inline runtime_spec_schema_config_linux_seccomp * get_seccomp_configuration (struct libcrun_seccomp_gen_ctx_s *ctx) { if (ctx->container == NULL || ctx->container->container_def == NULL || ctx->container->container_def->linux == NULL) return 0; return ctx->container->container_def->linux->seccomp; } static int find_in_cache (struct libcrun_seccomp_gen_ctx_s *ctx, int dirfd, const char *dest_path, bool *created, libcrun_error_t *err) { runtime_spec_schema_config_linux_seccomp *seccomp; cleanup_free char *cache_file_path = NULL; int ret; if (ctx->options & LIBCRUN_SECCOMP_SKIP_CACHE) return 0; seccomp = get_seccomp_configuration (ctx); if (seccomp == NULL) return 0; /* if the checksum could not be computed, returns early. */ ret = calculate_seccomp_checksum (seccomp, ctx->options, ctx->checksum, err); if (UNLIKELY (ret < 0)) return ret; ret = append_paths (&cache_file_path, err, SECCOMP_CACHE_DIR, ctx->checksum, NULL); if (UNLIKELY (ret < 0)) return ret; ret = TEMP_FAILURE_RETRY (linkat (dirfd, cache_file_path, dirfd, dest_path, 0)); if (UNLIKELY (ret < 0 && errno != ENOENT)) return crun_make_error (err, errno, "linkat `%s` to `%s`", cache_file_path, dest_path); *created = ret == 0; return 0; } int libcrun_generate_seccomp (struct libcrun_seccomp_gen_ctx_s *gen_ctx, libcrun_error_t *err) { #ifdef HAVE_SECCOMP runtime_spec_schema_config_linux_seccomp *seccomp; int ret; size_t i; cleanup_seccomp scmp_filter_ctx ctx = NULL; int action, default_action, default_errno_value = EPERM; const char *def_action = NULL; /* The bpf filter was loaded from the cache, nothing to do here. */ if (gen_ctx->from_cache) return 0; if (gen_ctx->container == NULL || gen_ctx->container->container_def == NULL || gen_ctx->container->container_def->linux == NULL) return 0; seccomp = gen_ctx->container->container_def->linux->seccomp; if (seccomp == NULL) return 0; /* seccomp not available. */ if (prctl (PR_GET_SECCOMP, 0, 0, 0, 0) < 0) return crun_make_error (err, errno, "prctl"); def_action = seccomp->default_action; if (def_action == NULL) return crun_make_error (err, 0, "seccomp misses the default action"); if (seccomp->default_errno_ret_present) { if (! seccomp_action_supports_errno (def_action)) return crun_make_error (err, 0, "errno value specified for action `%s`", def_action); default_errno_value = seccomp->default_errno_ret; } default_action = get_seccomp_action (def_action, default_errno_value, err); if (UNLIKELY (err && *err != NULL)) return crun_make_error (err, 0, "invalid seccomp action `%s`", seccomp->default_action); ctx = seccomp_init (default_action); if (ctx == NULL) return crun_make_error (err, 0, "error seccomp_init"); for (i = 0; i < seccomp->architectures_len; i++) { uint32_t arch_token; const char *arch = seccomp->architectures[i]; char *end, lowercase_arch[32] = { 0, }; if (has_prefix (arch, "SCMP_ARCH_")) arch += 10; end = stpncpy (lowercase_arch, arch, sizeof (lowercase_arch) - 1); *end = '\0'; make_lowercase (lowercase_arch); # ifdef SECCOMP_ARCH_RESOLVE_NAME arch_token = seccomp_arch_resolve_name (lowercase_arch); if (arch_token == 0) return crun_make_error (err, 0, "seccomp unknown architecture `%s`", arch); # else arch_token = SCMP_ARCH_NATIVE; # endif ret = seccomp_arch_add (ctx, arch_token); if (ret < 0 && ret != -EEXIST) return crun_make_error (err, -ret, "seccomp adding architecture"); } for (i = 0; i < seccomp->syscalls_len; i++) { size_t j; int errno_ret = EPERM; if (seccomp->syscalls[i]->errno_ret_present) { if (! seccomp_action_supports_errno (seccomp->syscalls[i]->action)) return crun_make_error (err, 0, "errno value specified for action `%s`", seccomp->syscalls[i]->action); errno_ret = seccomp->syscalls[i]->errno_ret; } action = get_seccomp_action (seccomp->syscalls[i]->action, errno_ret, err); if (UNLIKELY (err && *err != NULL)) return crun_make_error (err, 0, "invalid seccomp action `%s`", seccomp->syscalls[i]->action); if (action == default_action) continue; for (j = 0; j < seccomp->syscalls[i]->names_len; j++) { int syscall = seccomp_syscall_resolve_name (seccomp->syscalls[i]->names[j]); if (UNLIKELY (syscall == __NR_SCMP_ERROR)) { if (gen_ctx->options & LIBCRUN_SECCOMP_FAIL_UNKNOWN_SYSCALL) return crun_make_error (err, 0, "invalid seccomp syscall `%s`", seccomp->syscalls[i]->names[j]); libcrun_warning ("unknown seccomp syscall `%s` ignored", seccomp->syscalls[i]->names[j]); continue; } if (seccomp->syscalls[i]->args == NULL) { ret = seccomp_rule_add (ctx, action, syscall, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, -ret, "seccomp_rule_add `%s`", seccomp->syscalls[i]->names[j]); } else { size_t k; struct scmp_arg_cmp arg_cmp[6]; bool multiple_args = false; uint32_t count[6] = {}; for (k = 0; k < seccomp->syscalls[i]->args_len && k < 6; k++) { uint32_t index; index = seccomp->syscalls[i]->args[k]->index; if (index >= 6) return crun_make_error (err, 0, "invalid seccomp index `%zu`", i); count[index]++; if (count[index] > 1) { multiple_args = true; break; } } for (k = 0; k < seccomp->syscalls[i]->args_len && k < 6; k++) { char *op = seccomp->syscalls[i]->args[k]->op; arg_cmp[k].arg = seccomp->syscalls[i]->args[k]->index; arg_cmp[k].op = get_seccomp_operator (op, err); if (arg_cmp[k].op == 0) return crun_make_error (err, 0, "get_seccomp_operator"); arg_cmp[k].datum_a = seccomp->syscalls[i]->args[k]->value; arg_cmp[k].datum_b = seccomp->syscalls[i]->args[k]->value_two; } if (! multiple_args) { ret = seccomp_rule_add_array (ctx, action, syscall, k, arg_cmp); if (UNLIKELY (ret < 0)) return crun_make_error (err, -ret, "seccomp_rule_add_array"); } else { size_t r; for (r = 0; r < k; r++) { ret = seccomp_rule_add_array (ctx, action, syscall, 1, &arg_cmp[r]); if (UNLIKELY (ret < 0)) return crun_make_error (err, -ret, "seccomp_rule_add_array"); } } } } } if (gen_ctx->fd >= 0) { ret = seccomp_export_bpf (ctx, gen_ctx->fd); if (UNLIKELY (ret < 0)) return crun_make_error (err, -ret, "seccomp_export_bpf"); return store_seccomp_cache (gen_ctx, err); } return 0; #else return 0; #endif } int libcrun_copy_seccomp (struct libcrun_seccomp_gen_ctx_s *gen_ctx, const char *b64_bpf, libcrun_error_t *err) { cleanup_free char *bpf_data = NULL; size_t size = 0; size_t in_size; int consumed; int ret; in_size = strlen (b64_bpf); bpf_data = xmalloc (in_size + 1); consumed = base64_decode (b64_bpf, in_size, bpf_data, in_size, &size); if (UNLIKELY (consumed != (int) in_size)) return crun_make_error (err, 0, "invalid seccomp BPF data"); ret = safe_write (gen_ctx->fd, bpf_data, (ssize_t) size); if (UNLIKELY (ret < 0)) return crun_make_error (err, 0, "write to seccomp fd"); return 0; } int libcrun_open_seccomp_bpf (struct libcrun_seccomp_gen_ctx_s *ctx, int *fd, libcrun_error_t *err) { cleanup_close int dirfd = -1; cleanup_free char *dest_path = NULL; libcrun_container_t *container = ctx->container; int ret; ctx->fd = *fd = -1; if (container == NULL || container->context == NULL) return crun_make_error (err, EINVAL, "invalid internal state"); dirfd = open_rundir_dirfd (container->context->state_root, err); if (UNLIKELY (dirfd < 0)) return dirfd; /* relative path to dirfd. */ ret = append_paths (&dest_path, err, container->context->id, "seccomp.bpf", NULL); if (UNLIKELY (ret < 0)) return ret; if (ctx->create) { bool created = false; ret = find_in_cache (ctx, dirfd, dest_path, &created, err); if (UNLIKELY (ret < 0)) return ret; if (created) { ctx->from_cache = true; goto open_existing_file; } ret = TEMP_FAILURE_RETRY (openat (dirfd, dest_path, O_CLOEXEC | O_RDWR | O_CREAT, 0700)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "open `seccomp.bpf`"); ctx->fd = *fd = ret; } else { open_existing_file: ret = TEMP_FAILURE_RETRY (openat (dirfd, dest_path, O_CLOEXEC | O_RDONLY)); if (UNLIKELY (ret < 0)) { if (errno == ENOENT) return 0; return crun_make_error (err, errno, "open `seccomp.bpf`"); } ctx->fd = *fd = ret; } return 0; } crun-1.16.1/src/libcrun/seccomp_notify.c0000664000000000000000000001742414021372131016353 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2020 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #include #include #if HAVE_SECCOMP_GET_NOTIF_SIZES && HAVE_SECCOMP # include # include # include # include #endif #ifdef HAVE_DLOPEN # include #endif #include "utils.h" #include "seccomp_notify.h" #ifndef SECCOMP_USER_NOTIF_FLAG_CONTINUE # define SECCOMP_USER_NOTIF_FLAG_CONTINUE (1UL << 0) #endif struct plugin { void *handle; void *opaque; #if HAVE_DLOPEN && HAVE_SECCOMP_GET_NOTIF_SIZES && HAVE_SECCOMP run_oci_seccomp_notify_handle_request_cb handle_request_cb; #endif }; struct seccomp_notify_context_s { struct plugin *plugins; size_t n_plugins; #if HAVE_DLOPEN && HAVE_SECCOMP_GET_NOTIF_SIZES struct seccomp_notif_resp *sresp; struct seccomp_notif *sreq; struct seccomp_notif_sizes sizes; #endif }; void cleanup_seccomp_notify_pluginsp (void *p) { struct seccomp_notify_context_s **pp = p; if (*pp) { libcrun_error_t tmp_err = NULL; libcrun_free_seccomp_notify_plugins (*pp, &tmp_err); crun_error_release (&tmp_err); *pp = NULL; } } #if HAVE_DLOPEN && HAVE_SECCOMP_GET_NOTIF_SIZES && HAVE_SECCOMP static int seccomp_syscall (unsigned int op, unsigned int flags, void *args) { errno = 0; return syscall (__NR_seccomp, op, flags, args); } #endif LIBCRUN_PUBLIC int libcrun_load_seccomp_notify_plugins (struct seccomp_notify_context_s **out, const char *plugins, struct libcrun_load_seccomp_notify_conf_s *conf, libcrun_error_t *err) { #if HAVE_DLOPEN && HAVE_SECCOMP_GET_NOTIF_SIZES && HAVE_SECCOMP cleanup_seccomp_notify_context struct seccomp_notify_context_s *ctx = xmalloc0 (sizeof *ctx); cleanup_free char *b = NULL; char *it, *saveptr; size_t s; if (seccomp_syscall (SECCOMP_GET_NOTIF_SIZES, 0, &ctx->sizes) < 0) return crun_make_error (err, errno, "seccomp GET_NOTIF_SIZES"); ctx->sreq = xmalloc (ctx->sizes.seccomp_notif); ctx->sresp = xmalloc (ctx->sizes.seccomp_notif_resp); ctx->n_plugins = 1; for (it = b; it; it = strchr (it, ':')) ctx->n_plugins++; ctx->plugins = xmalloc0 (sizeof (struct plugin) * (ctx->n_plugins + 1)); b = xstrdup (plugins); for (s = 0, it = strtok_r (b, ":", &saveptr); it; s++, it = strtok_r (NULL, ":", &saveptr)) { run_oci_seccomp_notify_plugin_version_cb version_cb; run_oci_seccomp_notify_start_cb start_cb; void *opq = NULL; /* do not accept relative paths. It is fine to accept only filenames as dlopen() semantics apply. */ if (strchr (it, '/') && it[0] != '/') return crun_make_error (err, 0, "invalid relative plugin path: `%s`", it); ctx->plugins[s].handle = dlopen (it, RTLD_NOW); if (ctx->plugins[s].handle == NULL) return crun_make_error (err, 0, "cannot load `%s`: %s", it, dlerror ()); version_cb = (run_oci_seccomp_notify_plugin_version_cb) dlsym (ctx->plugins[s].handle, "run_oci_seccomp_notify_version"); if (version_cb != NULL) { int version; version = version_cb (); if (version != 1) return crun_make_error (err, ENOTSUP, "invalid version supported by the plugin `%s`", it); } ctx->plugins[s].handle_request_cb = (run_oci_seccomp_notify_handle_request_cb) dlsym ( ctx->plugins[s].handle, "run_oci_seccomp_notify_handle_request"); if (ctx->plugins[s].handle_request_cb == NULL) return crun_make_error (err, ENOTSUP, "plugin `%s` doesn't export `run_oci_seccomp_notify_handle_request`", it); start_cb = (run_oci_seccomp_notify_start_cb) dlsym (ctx->plugins[s].handle, "run_oci_seccomp_notify_start"); if (start_cb) { int ret; ret = start_cb (&opq, conf, sizeof (*conf)); if (UNLIKELY (ret != 0)) return crun_make_error (err, -ret, "error loading `%s`", it); } ctx->plugins[s].opaque = opq; } /* Change ownership. */ *out = ctx; ctx = NULL; return 0; #else (void) out; (void) plugins; (void) conf; (void) err; return crun_make_error (err, ENOTSUP, "seccomp notify support not available"); #endif } LIBCRUN_PUBLIC int libcrun_seccomp_notify_plugins (struct seccomp_notify_context_s *ctx, int seccomp_fd, libcrun_error_t *err) { #if HAVE_DLOPEN && HAVE_SECCOMP_GET_NOTIF_SIZES && HAVE_SECCOMP size_t i; int ret; memset (ctx->sreq, 0, ctx->sizes.seccomp_notif); memset (ctx->sresp, 0, ctx->sizes.seccomp_notif_resp); ret = ioctl (seccomp_fd, SECCOMP_IOCTL_NOTIF_RECV, ctx->sreq); if (UNLIKELY (ret < 0)) { if (errno == ENOENT) return 0; return crun_make_error (err, errno, "ioctl"); } for (i = 0; i < ctx->n_plugins; i++) { if (ctx->plugins[i].handle_request_cb) { int handled = 0; int ret; ret = ctx->plugins[i].handle_request_cb (ctx->plugins[i].opaque, &ctx->sizes, ctx->sreq, ctx->sresp, seccomp_fd, &handled); if (UNLIKELY (ret != 0)) return crun_make_error (err, -ret, "error handling seccomp notify request"); switch (handled) { case RUN_OCI_SECCOMP_NOTIFY_HANDLE_NOT_HANDLED: break; case RUN_OCI_SECCOMP_NOTIFY_HANDLE_SEND_RESPONSE: goto send_resp; /* The plugin will take care of it. */ case RUN_OCI_SECCOMP_NOTIFY_HANDLE_DELAYED_RESPONSE: return 0; case RUN_OCI_SECCOMP_NOTIFY_HANDLE_SEND_RESPONSE_AND_CONTINUE: ctx->sresp->flags |= SECCOMP_USER_NOTIF_FLAG_CONTINUE; goto send_resp; default: return crun_make_error (err, EINVAL, "unknown action specified by the plugin `%d`", handled); } } } /* No plugin could handle the request. */ ctx->sresp->error = -ENOTSUP; ctx->sresp->flags = 0; send_resp: ctx->sresp->id = ctx->sreq->id; ret = ioctl (seccomp_fd, SECCOMP_IOCTL_NOTIF_SEND, ctx->sresp); if (UNLIKELY (ret < 0)) { if (errno == ENOENT) return 0; return crun_make_error (err, errno, "ioctl"); } return 0; #else (void) ctx; (void) seccomp_fd; (void) err; return crun_make_error (err, ENOTSUP, "seccomp notify support not available"); #endif } LIBCRUN_PUBLIC int libcrun_free_seccomp_notify_plugins (struct seccomp_notify_context_s *ctx, libcrun_error_t *err) { #if HAVE_DLOPEN && HAVE_SECCOMP_GET_NOTIF_SIZES && HAVE_SECCOMP size_t i; if (ctx == NULL) return crun_make_error (err, EINVAL, "invalid seccomp notify context"); free (ctx->sreq); free (ctx->sresp); for (i = 0; i < ctx->n_plugins; i++) if (ctx->plugins && ctx->plugins[i].handle) { run_oci_seccomp_notify_stop_cb cb; cb = (run_oci_seccomp_notify_stop_cb) dlsym (ctx->plugins[i].handle, "run_oci_seccomp_notify_stop"); if (cb) cb (ctx->plugins[i].opaque); dlclose (ctx->plugins[i].handle); } free (ctx); return 0; #else (void) ctx; (void) err; return crun_make_error (err, ENOTSUP, "seccomp notify support not available"); #endif } crun-1.16.1/src/libcrun/signals.c0000644000000000000000000005157514504567214015013 0ustar0000000000000000/* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf --lookup-function-name libcrun_signal_in_word_set -m 100 --null-strings --pic -tCEG -S1 src/libcrun/signals.perf */ /* Computed positions: -k'2,4,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 19 "src/libcrun/signals.perf" #define _GNU_SOURCE #include #include #include #include "utils.h" #line 27 "src/libcrun/signals.perf" struct signal_s { int name; int value; }; enum { TOTAL_KEYWORDS = 62, MIN_WORD_LENGTH = 2, MAX_WORD_LENGTH = 8, MIN_HASH_VALUE = 13, MAX_HASH_VALUE = 86 }; /* maximum key range = 74, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int hash (register const char *str, register size_t len) { static const unsigned char asso_values[] = { 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 43, 9, 5, 17, 13, 31, 43, 40, 39, 34, 87, 87, 87, 87, 87, 87, 87, 7, 60, 56, 32, 33, 26, 39, 5, 5, 87, 87, 5, 23, 32, 27, 6, 87, 30, 31, 6, 5, 16, 35, 49, 31, 18, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87 }; register unsigned int hval = len; switch (hval) { default: hval += asso_values[(unsigned char)str[3]]; /*FALLTHROUGH*/ case 3: case 2: hval += asso_values[(unsigned char)str[1]]; break; } return hval + asso_values[(unsigned char)str[len - 1]]; } struct stringpool_t { char stringpool_str0[sizeof("ILL")]; char stringpool_str1[sizeof("HUP")]; char stringpool_str2[sizeof("KILL")]; char stringpool_str3[sizeof("TTOU")]; char stringpool_str4[sizeof("QUIT")]; char stringpool_str5[sizeof("STOP")]; char stringpool_str6[sizeof("RTMIN+2")]; char stringpool_str7[sizeof("RTMIN+12")]; char stringpool_str8[sizeof("RTMAX-2")]; char stringpool_str9[sizeof("RTMAX-12")]; char stringpool_str10[sizeof("RTMIN+1")]; char stringpool_str11[sizeof("RTMIN+11")]; char stringpool_str12[sizeof("RTMAX-1")]; char stringpool_str13[sizeof("RTMAX-11")]; char stringpool_str14[sizeof("RTMIN+4")]; char stringpool_str15[sizeof("RTMIN+14")]; char stringpool_str16[sizeof("RTMAX-4")]; char stringpool_str17[sizeof("RTMAX-14")]; char stringpool_str18[sizeof("RTMIN+3")]; char stringpool_str19[sizeof("RTMIN+13")]; char stringpool_str20[sizeof("RTMAX-3")]; char stringpool_str21[sizeof("RTMAX-13")]; char stringpool_str22[sizeof("BUS")]; char stringpool_str23[sizeof("VTALRM")]; char stringpool_str24[sizeof("INT")]; char stringpool_str25[sizeof("FPE")]; char stringpool_str26[sizeof("CONT")]; char stringpool_str27[sizeof("STKFLT")]; char stringpool_str28[sizeof("USR2")]; char stringpool_str29[sizeof("TRAP")]; char stringpool_str30[sizeof("TSTP")]; char stringpool_str31[sizeof("RTMIN")]; char stringpool_str32[sizeof("RTMIN+5")]; char stringpool_str33[sizeof("RTMIN+15")]; char stringpool_str34[sizeof("RTMAX-5")]; char stringpool_str35[sizeof("RTMIN+9")]; char stringpool_str36[sizeof("USR1")]; char stringpool_str37[sizeof("RTMAX-9")]; char stringpool_str38[sizeof("ALRM")]; char stringpool_str39[sizeof("IO")]; char stringpool_str40[sizeof("RTMIN+8")]; char stringpool_str41[sizeof("RTMIN+7")]; char stringpool_str42[sizeof("RTMAX-8")]; char stringpool_str43[sizeof("RTMAX-7")]; char stringpool_str44[sizeof("RTMIN+6")]; char stringpool_str45[sizeof("RTMIN+10")]; char stringpool_str46[sizeof("RTMAX-6")]; char stringpool_str47[sizeof("RTMAX-10")]; char stringpool_str48[sizeof("SYS")]; char stringpool_str49[sizeof("XFSZ")]; char stringpool_str50[sizeof("RTMAX")]; char stringpool_str51[sizeof("PWR")]; char stringpool_str52[sizeof("SEGV")]; char stringpool_str53[sizeof("XCPU")]; char stringpool_str54[sizeof("WINCH")]; char stringpool_str55[sizeof("URG")]; char stringpool_str56[sizeof("CHLD")]; char stringpool_str57[sizeof("TTIN")]; char stringpool_str58[sizeof("PIPE")]; char stringpool_str59[sizeof("ABRT")]; char stringpool_str60[sizeof("TERM")]; char stringpool_str61[sizeof("PROF")]; }; static const struct stringpool_t stringpool_contents = { "ILL", "HUP", "KILL", "TTOU", "QUIT", "STOP", "RTMIN+2", "RTMIN+12", "RTMAX-2", "RTMAX-12", "RTMIN+1", "RTMIN+11", "RTMAX-1", "RTMAX-11", "RTMIN+4", "RTMIN+14", "RTMAX-4", "RTMAX-14", "RTMIN+3", "RTMIN+13", "RTMAX-3", "RTMAX-13", "BUS", "VTALRM", "INT", "FPE", "CONT", "STKFLT", "USR2", "TRAP", "TSTP", "RTMIN", "RTMIN+5", "RTMIN+15", "RTMAX-5", "RTMIN+9", "USR1", "RTMAX-9", "ALRM", "IO", "RTMIN+8", "RTMIN+7", "RTMAX-8", "RTMAX-7", "RTMIN+6", "RTMIN+10", "RTMAX-6", "RTMAX-10", "SYS", "XFSZ", "RTMAX", "PWR", "SEGV", "XCPU", "WINCH", "URG", "CHLD", "TTIN", "PIPE", "ABRT", "TERM", "PROF" }; #define stringpool ((const char *) &stringpool_contents) static const struct signal_s wordlist[] = { #line 36 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str0, 4}, #line 33 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str1, 1}, #line 41 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str2, 9}, #line 54 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str3, 22}, #line 35 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str4, 3}, #line 51 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str5, 19}, #line 66 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, 36}, #line 76 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7, 46}, #line 92 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, 62}, #line 82 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, 52}, #line 65 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, 35}, #line 75 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, 45}, #line 93 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, 63}, #line 83 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, 53}, #line 68 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, 38}, #line 78 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, 48}, #line 90 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, 60}, #line 80 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, 50}, #line 67 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, 37}, #line 77 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, 47}, #line 91 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, 61}, #line 81 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, 51}, #line 39 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, 7}, #line 58 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, 26}, #line 34 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str24, 2}, #line 40 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25, 8}, #line 50 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26, 18}, #line 48 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27, 16}, #line 44 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str28, 12}, #line 37 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29, 5}, #line 52 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str30, 20}, #line 64 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str31, 34}, #line 69 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str32, 39}, #line 79 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str33, 49}, #line 89 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str34, 59}, #line 73 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str35, 43}, #line 42 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str36, 10}, #line 85 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str37, 55}, #line 46 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str38, 14}, #line 61 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str39, 29}, #line 72 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str40, 42}, #line 71 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str41, 41}, #line 86 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str42, 56}, #line 87 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str43, 57}, #line 70 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str44, 40}, #line 74 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str45, 44}, #line 88 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str46, 58}, #line 84 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str47, 54}, #line 63 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str48, 31}, #line 57 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str49, 25}, #line 94 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str50, 64}, #line 62 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str51, 30}, #line 43 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str52, 11}, #line 56 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str53, 24}, #line 60 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str54, 28}, #line 55 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str55, 23}, #line 49 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str56, 17}, #line 53 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str57, 21}, #line 45 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str58, 13}, #line 38 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str59, 6}, #line 47 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str60, 15}, #line 59 "src/libcrun/signals.perf" {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str61, 27} }; const struct signal_s * libcrun_signal_in_word_set (register const char *str, register size_t len) { if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = hash (str, len); if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) { register const struct signal_s *resword; switch (key - 13) { case 0: resword = &wordlist[0]; goto compare; case 1: resword = &wordlist[1]; goto compare; case 6: resword = &wordlist[2]; goto compare; case 7: resword = &wordlist[3]; goto compare; case 8: resword = &wordlist[4]; goto compare; case 9: resword = &wordlist[5]; goto compare; case 10: resword = &wordlist[6]; goto compare; case 11: resword = &wordlist[7]; goto compare; case 12: resword = &wordlist[8]; goto compare; case 13: resword = &wordlist[9]; goto compare; case 14: resword = &wordlist[10]; goto compare; case 15: resword = &wordlist[11]; goto compare; case 16: resword = &wordlist[12]; goto compare; case 17: resword = &wordlist[13]; goto compare; case 18: resword = &wordlist[14]; goto compare; case 19: resword = &wordlist[15]; goto compare; case 20: resword = &wordlist[16]; goto compare; case 21: resword = &wordlist[17]; goto compare; case 22: resword = &wordlist[18]; goto compare; case 23: resword = &wordlist[19]; goto compare; case 24: resword = &wordlist[20]; goto compare; case 25: resword = &wordlist[21]; goto compare; case 26: resword = &wordlist[22]; goto compare; case 27: resword = &wordlist[23]; goto compare; case 28: resword = &wordlist[24]; goto compare; case 29: resword = &wordlist[25]; goto compare; case 30: resword = &wordlist[26]; goto compare; case 31: resword = &wordlist[27]; goto compare; case 32: resword = &wordlist[28]; goto compare; case 33: resword = &wordlist[29]; goto compare; case 34: resword = &wordlist[30]; goto compare; case 35: resword = &wordlist[31]; goto compare; case 36: resword = &wordlist[32]; goto compare; case 37: resword = &wordlist[33]; goto compare; case 38: resword = &wordlist[34]; goto compare; case 39: resword = &wordlist[35]; goto compare; case 40: resword = &wordlist[36]; goto compare; case 41: resword = &wordlist[37]; goto compare; case 42: resword = &wordlist[38]; goto compare; case 43: resword = &wordlist[39]; goto compare; case 44: resword = &wordlist[40]; goto compare; case 45: resword = &wordlist[41]; goto compare; case 46: resword = &wordlist[42]; goto compare; case 47: resword = &wordlist[43]; goto compare; case 48: resword = &wordlist[44]; goto compare; case 49: resword = &wordlist[45]; goto compare; case 50: resword = &wordlist[46]; goto compare; case 51: resword = &wordlist[47]; goto compare; case 52: resword = &wordlist[48]; goto compare; case 53: resword = &wordlist[49]; goto compare; case 54: resword = &wordlist[50]; goto compare; case 55: resword = &wordlist[51]; goto compare; case 56: resword = &wordlist[52]; goto compare; case 57: resword = &wordlist[53]; goto compare; case 58: resword = &wordlist[54]; goto compare; case 59: resword = &wordlist[55]; goto compare; case 60: resword = &wordlist[56]; goto compare; case 61: resword = &wordlist[57]; goto compare; case 62: resword = &wordlist[58]; goto compare; case 63: resword = &wordlist[59]; goto compare; case 70: resword = &wordlist[60]; goto compare; case 73: resword = &wordlist[61]; goto compare; } return 0; compare: { register const char *s = resword->name + stringpool; if (*str == *s && !strcmp (str + 1, s + 1)) return resword; } } } return 0; } #line 95 "src/libcrun/signals.perf" int str2sig (const char *name) { const struct signal_s *s; if (has_prefix (name, "SIG")) name += 3; s = libcrun_signal_in_word_set (name, strlen (name)); if (s == NULL) { long int value; if (!isdigit(name[0])) { errno = EINVAL; return -1; } errno = 0; value = strtol (name, NULL, 10); if (errno != 0) return -1; return value; } return s->value; } crun-1.16.1/src/libcrun/status.c0000644000000000000000000005113514614667631014674 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include "status.h" #include "utils.h" #include #include #include #include #include #include #include #include #include #define YAJL_STR(x) ((const unsigned char *) (x)) struct pid_stat { char state; unsigned long long starttime; }; static char * get_run_directory (const char *state_root) { int ret; char *root = NULL; libcrun_error_t err = NULL; if (state_root) root = xstrdup (state_root); if (root == NULL) { const char *runtime_dir = getenv ("XDG_RUNTIME_DIR"); if (runtime_dir && runtime_dir[0] != '\0') { ret = append_paths (&root, &err, runtime_dir, "crun", NULL); if (UNLIKELY (ret < 0)) { crun_error_release (&err); return NULL; } } } if (root == NULL) root = xstrdup ("/run/crun"); ret = crun_ensure_directory (root, 0700, false, &err); if (UNLIKELY (ret < 0)) crun_error_release (&err); return root; } char * libcrun_get_state_directory (const char *state_root, const char *id) { int ret; char *path; libcrun_error_t *err = NULL; cleanup_free char *root = get_run_directory (state_root); ret = append_paths (&path, err, root, id, NULL); if (UNLIKELY (ret < 0)) { crun_error_release (err); return NULL; } return path; } static char * get_state_directory_status_file (const char *state_root, const char *id) { cleanup_free char *root = get_run_directory (state_root); libcrun_error_t *err = NULL; char *path = NULL; int ret; ret = append_paths (&path, err, root, id, "status", NULL); if (UNLIKELY (ret < 0)) { crun_error_release (err); return NULL; } return path; } static int read_pid_stat (pid_t pid, struct pid_stat *st, libcrun_error_t *err) { cleanup_free char *buffer = NULL; cleanup_close int fd = -1; char pid_stat_file[64]; char *it, *s; int i, ret; sprintf (pid_stat_file, "/proc/%d/stat", pid); fd = open (pid_stat_file, O_RDONLY | O_CLOEXEC); if (fd < 0) { /* The process already exited. */ if (errno == ENOENT || errno == ESRCH) { memset (st, 0, sizeof (*st)); return 0; } return crun_make_error (err, errno, "open state file `%s`", pid_stat_file); } ret = read_all_fd (fd, pid_stat_file, &buffer, NULL, err); if (ret < 0) { st->starttime = 0; st->state = 'X'; /* The process already exited. */ libcrun_error_release (err); return 0; } s = NULL; /* Skip the first two arguments. */ for (it = buffer; it; it = strchr (it + 1, ')')) s = it + 1; if (s) while (*s == ' ') s++; if (s == NULL || *s == '\0') return crun_make_error (err, 0, "could not read process state"); st->state = *s; /* Seek to the starttime argument. */ for (it = s + 1, i = 0; i < 19 && it != NULL; i++, it = strchr (it, ' ') + 1) ; if (it == NULL || i != 19) return crun_make_error (err, 0, "could not read process start time"); errno = 0; st->starttime = strtoull (it, NULL, 10); if (errno != 0) return crun_make_error (err, errno, "parse process start time"); return 0; } int libcrun_write_container_status (const char *state_root, const char *id, libcrun_container_status_t *status, libcrun_error_t *err) { int r, ret; cleanup_free char *file = get_state_directory_status_file (state_root, id); cleanup_free char *file_tmp = NULL; size_t len; cleanup_close int fd_write = -1; const unsigned char *buf = NULL; struct pid_stat st; const char *tmp; yajl_gen gen = NULL; ret = read_pid_stat (status->pid, &st, err); if (UNLIKELY (ret < 0)) return ret; status->process_start_time = st.starttime; xasprintf (&file_tmp, "%s.tmp", file); fd_write = open (file_tmp, O_CREAT | O_WRONLY | O_CLOEXEC, 0700); if (UNLIKELY (fd_write < 0)) return crun_make_error (err, errno, "cannot open status file"); gen = yajl_gen_alloc (NULL); if (gen == NULL) return crun_make_error (err, 0, "yajl_gen_alloc failed"); yajl_gen_config (gen, yajl_gen_beautify, 1); yajl_gen_config (gen, yajl_gen_validate_utf8, 1); r = yajl_gen_map_open (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("pid"), strlen ("pid")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_integer (gen, status->pid); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("process-start-time"), strlen ("process-start-time")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_integer (gen, status->process_start_time); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("cgroup-path"), strlen ("cgroup-path")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; tmp = status->cgroup_path ? status->cgroup_path : ""; r = yajl_gen_string (gen, YAJL_STR (tmp), strlen (tmp)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("scope"), strlen ("scope")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; tmp = status->scope ? status->scope : ""; r = yajl_gen_string (gen, YAJL_STR (tmp), strlen (tmp)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("intelrdt"), strlen ("intelrdt")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; tmp = status->intelrdt ? status->intelrdt : ""; r = yajl_gen_string (gen, YAJL_STR (tmp), strlen (tmp)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("rootfs"), strlen ("rootfs")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR (status->rootfs), strlen (status->rootfs)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("systemd-cgroup"), strlen ("systemd-cgroup")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_bool (gen, status->systemd_cgroup); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("bundle"), strlen ("bundle")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR (status->bundle), strlen (status->bundle)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("created"), strlen ("created")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR (status->created), strlen (status->created)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; if (status->owner) { r = yajl_gen_string (gen, YAJL_STR ("owner"), strlen ("owner")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR (status->owner), strlen (status->owner)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; } r = yajl_gen_string (gen, YAJL_STR ("detached"), strlen ("detached")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_bool (gen, status->detached); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR ("external_descriptors"), strlen ("external_descriptors")); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_string (gen, YAJL_STR (status->external_descriptors), strlen (status->external_descriptors)); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_map_close (gen); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; r = yajl_gen_get_buf (gen, &buf, &len); if (UNLIKELY (r != yajl_gen_status_ok)) goto yajl_error; if (UNLIKELY (safe_write (fd_write, buf, (ssize_t) len) < 0)) { ret = crun_make_error (err, errno, "cannot write status file"); goto exit; } close_and_reset (&fd_write); if (UNLIKELY (rename (file_tmp, file) < 0)) { ret = crun_make_error (err, errno, "cannot rename status file"); goto exit; } exit: if (gen) yajl_gen_free (gen); return ret; yajl_error: if (gen) yajl_gen_free (gen); return yajl_error_to_crun_error (r, err); } int libcrun_read_container_status (libcrun_container_status_t *status, const char *state_root, const char *id, libcrun_error_t *err) { cleanup_free char *buffer = NULL; char err_buffer[256]; int ret; cleanup_free char *file = get_state_directory_status_file (state_root, id); yajl_val tree, tmp; ret = read_all_file (file, &buffer, NULL, err); if (UNLIKELY (ret < 0)) return ret; tree = yajl_tree_parse (buffer, err_buffer, sizeof (err_buffer)); if (UNLIKELY (tree == NULL)) return crun_make_error (err, 0, "cannot parse status file: `%s`", err_buffer); { const char *pid_path[] = { "pid", NULL }; tmp = yajl_tree_get (tree, pid_path, yajl_t_number); if (UNLIKELY (tmp == NULL)) return crun_make_error (err, 0, "`pid` missing in `%s`", file); status->pid = strtoull (YAJL_GET_NUMBER (tmp), NULL, 10); } { const char *process_start_time_path[] = { "process-start-time", NULL }; tmp = yajl_tree_get (tree, process_start_time_path, yajl_t_number); if (UNLIKELY (tmp == NULL)) status->process_start_time = 0; /* backwards compatibility */ else status->process_start_time = strtoull (YAJL_GET_NUMBER (tmp), NULL, 10); } { const char *cgroup_path[] = { "cgroup-path", NULL }; tmp = yajl_tree_get (tree, cgroup_path, yajl_t_string); if (UNLIKELY (tmp == NULL)) return crun_make_error (err, 0, "`cgroup-path` missing in `%s`", file); status->cgroup_path = xstrdup (YAJL_GET_STRING (tmp)); } { const char *scope[] = { "scope", NULL }; tmp = yajl_tree_get (tree, scope, yajl_t_string); status->scope = tmp ? xstrdup (YAJL_GET_STRING (tmp)) : NULL; } { const char *intelrdt[] = { "intelrdt", NULL }; tmp = yajl_tree_get (tree, intelrdt, yajl_t_string); status->intelrdt = tmp ? xstrdup (YAJL_GET_STRING (tmp)) : NULL; } { const char *rootfs[] = { "rootfs", NULL }; tmp = yajl_tree_get (tree, rootfs, yajl_t_string); if (UNLIKELY (tmp == NULL)) return crun_make_error (err, 0, "`rootfs` missing in `%s`", file); status->rootfs = xstrdup (YAJL_GET_STRING (tmp)); } { const char *systemd_cgroup[] = { "systemd-cgroup", NULL }; status->systemd_cgroup = YAJL_IS_TRUE (yajl_tree_get (tree, systemd_cgroup, yajl_t_true)); } { const char *bundle[] = { "bundle", NULL }; tmp = yajl_tree_get (tree, bundle, yajl_t_string); if (UNLIKELY (tmp == NULL)) return crun_make_error (err, 0, "`bundle` missing in `%s`", file); status->bundle = xstrdup (YAJL_GET_STRING (tmp)); } { const char *created[] = { "created", NULL }; tmp = yajl_tree_get (tree, created, yajl_t_string); if (UNLIKELY (tmp == NULL)) return crun_make_error (err, 0, "`created` missing in `%s`", file); status->created = xstrdup (YAJL_GET_STRING (tmp)); } { const char *owner[] = { "owner", NULL }; tmp = yajl_tree_get (tree, owner, yajl_t_string); status->owner = tmp ? xstrdup (YAJL_GET_STRING (tmp)) : NULL; } { const char *detached[] = { "detached", NULL }; status->detached = YAJL_IS_TRUE (yajl_tree_get (tree, detached, yajl_t_true)); } { const char *external_descriptors[] = { "external_descriptors", NULL }; tmp = yajl_tree_get (tree, external_descriptors, yajl_t_string); status->external_descriptors = tmp ? xstrdup (YAJL_GET_STRING (tmp)) : NULL; } yajl_tree_free (tree); return 0; } int libcrun_status_check_directories (const char *state_root, const char *id, libcrun_error_t *err) { cleanup_free char *dir = NULL; cleanup_free char *run_directory = get_run_directory (state_root); int ret; ret = crun_ensure_directory (run_directory, 0700, false, err); if (UNLIKELY (ret < 0)) return ret; dir = libcrun_get_state_directory (state_root, id); if (UNLIKELY (dir == NULL)) return crun_make_error (err, 0, "cannot get state directory"); ret = crun_path_exists (dir, err); if (UNLIKELY (ret < 0)) return ret; if (ret) return crun_make_error (err, 0, "container `%s` already exists", id); if (UNLIKELY (mkdir (dir, 0700) < 0)) return crun_make_error (err, 0, "cannot create state directory for `%s`", id); return 0; } static int rmdirfd (const char *namedir, int fd, libcrun_error_t *err) { int ret; cleanup_dir DIR *d = NULL; struct dirent *de; __attribute__ ((unused)) cleanup_close int fd_cleanup = fd; d = fdopendir (fd); if (d == NULL) return crun_make_error (err, errno, "cannot open directory `%s`", namedir); /* Now D owns FD. */ fd_cleanup = -1; for (de = readdir (d); de; de = readdir (d)) { if ((strcmp (de->d_name, ".") == 0) || (strcmp (de->d_name, "..") == 0)) continue; /* Ignore errors here and keep deleting, the final unlinkat (AT_REMOVEDIR) will fail anyway. */ ret = unlinkat (dirfd (d), de->d_name, 0); if (ret < 0) { retry_unlink: ret = unlinkat (dirfd (d), de->d_name, AT_REMOVEDIR); if (ret < 0 && errno == EBUSY) { cleanup_close int tfd = openat (dirfd (d), de->d_name, O_CLOEXEC | O_PATH | O_NOFOLLOW); if (tfd >= 0) { proc_fd_path_t procpath; get_proc_self_fd_path (procpath, tfd); if (umount2 (procpath, MNT_DETACH) == 0) goto retry_unlink; } } if (ret < 0 && errno == ENOTEMPTY) { cleanup_close int cfd = -1; cfd = openat (dirfd (d), de->d_name, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (cfd < 0)) return crun_make_error (err, errno, "cannot open directory `%s`", de->d_name); ret = rmdirfd (de->d_name, cfd, err); if (UNLIKELY (ret < 0)) return ret; ret = unlinkat (dirfd (d), de->d_name, AT_REMOVEDIR); } } } return 0; } int libcrun_container_delete_status (const char *state_root, const char *id, libcrun_error_t *err) { int ret; cleanup_close int rundir_dfd = -1; cleanup_close int dfd = -1; cleanup_free char *dir = NULL; dir = get_run_directory (state_root); if (UNLIKELY (dir == NULL)) return crun_make_error (err, 0, "cannot get state directory"); rundir_dfd = TEMP_FAILURE_RETRY (open (dir, O_DIRECTORY | O_RDONLY | O_CLOEXEC)); if (UNLIKELY (rundir_dfd < 0)) return crun_make_error (err, errno, "cannot open run directory `%s`", dir); dfd = openat (rundir_dfd, id, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (UNLIKELY (dfd < 0)) return crun_make_error (err, errno, "cannot open directory `%s/%s`", dir, id); ret = rmdirfd (dir, dfd, err); /* rmdirfd owns DFD. */ dfd = -1; if (UNLIKELY (ret < 0)) return ret; ret = unlinkat (rundir_dfd, id, AT_REMOVEDIR); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "cannot rm state directory `%s/%s`", dir, id); return 0; } void libcrun_free_container_status (libcrun_container_status_t *status) { if (status == NULL) return; free (status->cgroup_path); free (status->bundle); free (status->rootfs); free (status->external_descriptors); free (status->created); free (status->scope); free (status->intelrdt); free (status->owner); } int libcrun_get_containers_list (libcrun_container_list_t **ret, const char *state_root, libcrun_error_t *err) { struct dirent *next; cleanup_container_list libcrun_container_list_t *tmp = NULL; cleanup_free char *path = get_run_directory (state_root); cleanup_dir DIR *dir = NULL; *ret = NULL; dir = opendir (path); if (UNLIKELY (dir == NULL)) return crun_make_error (err, errno, "cannot opendir `%s`", path); for (next = readdir (dir); next; next = readdir (dir)) { int r, exists; cleanup_free char *status_file = NULL; libcrun_container_list_t *next_container; if (next->d_name[0] == '.') continue; r = append_paths (&status_file, err, path, next->d_name, "status", NULL); if (UNLIKELY (r < 0)) return r; exists = crun_path_exists (status_file, err); if (exists < 0) { return exists; } if (! exists) { libcrun_error (errno, "error opening file `%s`", status_file); continue; } next_container = xmalloc (sizeof (libcrun_container_list_t)); next_container->name = xstrdup (next->d_name); next_container->next = tmp; tmp = next_container; } *ret = tmp; tmp = NULL; return 0; } void libcrun_free_containers_list (libcrun_container_list_t *list) { libcrun_container_list_t *next; while (list) { next = list->next; free (list->name); free (list); list = next; } } /* check if the container pid is still valid. Returns: -1: on errors 0: pid not valid 1: pid valid and container in the running/created/paused state */ int libcrun_check_pid_valid (libcrun_container_status_t *status, libcrun_error_t *err) { struct pid_stat st; int ret; /* For backwards compatibility, check start time only if available. */ if (! status->process_start_time) return 1; ret = read_pid_stat (status->pid, &st, err); if (UNLIKELY (ret < 0)) return ret; if (status->process_start_time != st.starttime || st.state == 'Z' || st.state == 'X') return 0; /* stopped */ return 1; /* running, created, or paused */ } int libcrun_is_container_running (libcrun_container_status_t *status, libcrun_error_t *err) { int ret; ret = kill (status->pid, 0); if (UNLIKELY (ret < 0) && errno != ESRCH) return crun_make_error (err, errno, "kill"); if (ret == 0) return libcrun_check_pid_valid (status, err); return 0; /* stopped */ } int libcrun_status_create_exec_fifo (const char *state_root, const char *id, libcrun_error_t *err) { cleanup_free char *state_dir = libcrun_get_state_directory (state_root, id); cleanup_free char *fifo_path = NULL; int ret, fd = -1; ret = append_paths (&fifo_path, err, state_dir, "exec.fifo", NULL); if (UNLIKELY (ret < 0)) return ret; ret = mkfifo (fifo_path, 0600); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "mkfifo"); fd = open (fifo_path, O_NONBLOCK | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "cannot open pipe `%s`", fifo_path); return fd; } int libcrun_status_write_exec_fifo (const char *state_root, const char *id, libcrun_error_t *err) { cleanup_free char *state_dir = libcrun_get_state_directory (state_root, id); cleanup_free char *fifo_path = NULL; char buffer[1] = { 0, }; cleanup_close int fd = -1; int ret; ret = append_paths (&fifo_path, err, state_dir, "exec.fifo", NULL); if (UNLIKELY (ret < 0)) return ret; fd = open (fifo_path, O_WRONLY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "cannot open `%s`", fifo_path); ret = unlink (fifo_path); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "unlink `%s`", fifo_path); ret = TEMP_FAILURE_RETRY (write (fd, buffer, 1)); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "write to exec.fifo"); return strtoll (buffer, NULL, 10); } int libcrun_status_has_read_exec_fifo (const char *state_root, const char *id, libcrun_error_t *err) { cleanup_free char *state_dir = libcrun_get_state_directory (state_root, id); cleanup_free char *fifo_path = NULL; int ret; ret = append_paths (&fifo_path, err, state_dir, "exec.fifo", NULL); if (UNLIKELY (ret < 0)) return ret; return crun_path_exists (fifo_path, err); } crun-1.16.1/src/libcrun/terminal.c0000644000000000000000000000752514551252466015164 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #define _XOPEN_SOURCE #define _GNU_SOURCE #include #include "linux.h" #include "utils.h" #include #include #include #include #include struct terminal_status_s { int fd; struct termios termios; }; int libcrun_new_terminal (char **pty, libcrun_error_t *err) { char buf[64]; int ret; cleanup_close int fd = open ("/dev/ptmx", O_RDWR | O_NOCTTY | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `/dev/ptmx`"); ret = ptsname_r (fd, buf, sizeof (buf)); if (UNLIKELY (ret != 0)) return crun_make_error (err, errno, "ptsname"); ret = unlockpt (fd); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "unlockpt"); *pty = xstrdup (buf); ret = fd; fd = -1; return ret; } static int set_raw (int fd, void **current_status, libcrun_error_t *err) { int ret; struct termios termios; ret = tcgetattr (fd, &termios); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "tcgetattr"); if (current_status) { struct terminal_status_s *s = xmalloc (sizeof (*s)); s->fd = fd; memcpy (&(s->termios), &termios, sizeof (termios)); *current_status = s; } cfmakeraw (&termios); termios.c_iflag &= OPOST; termios.c_oflag &= OPOST; ret = tcsetattr (fd, TCSANOW, &termios); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "tcsetattr"); return 0; } int libcrun_set_stdio (char *pty, libcrun_error_t *err) { int ret, i; cleanup_close int fd = open (pty, O_RDWR | O_CLOEXEC); if (UNLIKELY (fd < 0)) return crun_make_error (err, errno, "open `%s`", pty); for (i = 0; i < 3; i++) { ret = dup3 (fd, i, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "dup terminal"); } ret = ioctl (0, TIOCSCTTY, 0); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "ioctl TIOCSCTTY"); return 0; } int libcrun_setup_terminal_ptmx (int fd, void **current_status, libcrun_error_t *err) { int ret; struct termios termios; ret = tcgetattr (fd, &termios); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "tcgetattr"); ret = tcsetattr (fd, TCSANOW, &termios); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "tcsetattr"); return set_raw (0, current_status, err); } void cleanup_terminalp (void *p) { struct terminal_status_s **s = (struct terminal_status_s **) p; if (*s) { tcsetattr ((*s)->fd, TCSANOW, &(*s)->termios); free (*s); } } int libcrun_terminal_setup_size (int fd, unsigned short rows, unsigned short cols, libcrun_error_t *err) { struct winsize ws = { .ws_row = rows, .ws_col = cols }; int ret; if (ws.ws_row == 0 || ws.ws_col == 0) { ret = ioctl (0, TIOCGWINSZ, &ws); if (UNLIKELY (ret < 0)) { if (errno == ENOTTY) return 0; return crun_make_error (err, errno, "ioctl TIOCGWINSZ"); } } ret = ioctl (fd, TIOCSWINSZ, &ws); if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "ioctl TIOCSWINSZ"); return 0; } crun-1.16.1/src/libcrun/seccomp_notify.h0000664000000000000000000000334414011447015016357 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2020 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef SECCOMP_NOTIFY_H #define SECCOMP_NOTIFY_H #include #include "error.h" #if ! (HAVE_DLOPEN && HAVE_SECCOMP_GET_NOTIF_SIZES) # define SECCOMP_NOTIFY_SKIP_TYPEDEF #endif #include "seccomp_notify_plugin.h" struct seccomp_notify_context_s; LIBCRUN_PUBLIC int libcrun_load_seccomp_notify_plugins (struct seccomp_notify_context_s **out, const char *plugins, struct libcrun_load_seccomp_notify_conf_s *conf, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_seccomp_notify_plugins (struct seccomp_notify_context_s *ctx, int seccomp_fd, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_free_seccomp_notify_plugins (struct seccomp_notify_context_s *ctx, libcrun_error_t *err); #define cleanup_seccomp_notify_context __attribute__ ((cleanup (cleanup_seccomp_notify_pluginsp))) void cleanup_seccomp_notify_pluginsp (void *p); #endif crun-1.16.1/src/libcrun/seccomp_notify_plugin.h0000664000000000000000000000552714011447015017742 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2020 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef SECCOMP_NOTIFY_PLUGINPLUGIN_H # include struct libcrun_load_seccomp_notify_conf_s { const char *runtime_root_path; const char *name; const char *bundle_path; const char *oci_config_path; }; /* The plugin doesn't know how to handle the request. */ # define RUN_OCI_SECCOMP_NOTIFY_HANDLE_NOT_HANDLED 0 /* The plugin filled the response and it is ready to write. */ # define RUN_OCI_SECCOMP_NOTIFY_HANDLE_SEND_RESPONSE 1 /* The plugin will handle the request and write directly to the fd. */ # define RUN_OCI_SECCOMP_NOTIFY_HANDLE_DELAYED_RESPONSE 2 /* Specify SECCOMP_USER_NOTIF_FLAG_CONTINUE in the flags. */ # define RUN_OCI_SECCOMP_NOTIFY_HANDLE_SEND_RESPONSE_AND_CONTINUE 3 # ifndef SECCOMP_NOTIFY_SKIP_TYPEDEF /* Configure the plugin. Return an opaque pointer that will be used for successive calls. */ typedef int (*run_oci_seccomp_notify_start_cb) (void **opaque, struct libcrun_load_seccomp_notify_conf_s *conf, size_t size_configuration); /* Try to handle a single request. It MUST be defined. HANDLED specifies how the request was handled by the plugin: 0: not handled, try next plugin or return ENOTSUP if it is the last plugin. RUN_OCI_SECCOMP_NOTIFY_HANDLE_SEND_RESPONSE: sresp filled and ready to be notified to seccomp. RUN_OCI_SECCOMP_NOTIFY_HANDLE_DELAYED_RESPONSE: the notification will be handled internally by the plugin and forwarded to seccomp_fd. It is useful for asynchronous handling. */ typedef int (*run_oci_seccomp_notify_handle_request_cb) (void *opaque, struct seccomp_notif_sizes *sizes, struct seccomp_notif *sreq, struct seccomp_notif_resp *sresp, int seccomp_fd, int *handled); /* Stop the plugin. The opaque value is the return value from run_oci_seccomp_notify_start. */ typedef int (*run_oci_seccomp_notify_stop_cb) (void *opaque); /* Retrieve the API version used by the plugin. It MUST return 1. */ typedef int (*run_oci_seccomp_notify_plugin_version_cb) (); # endif #endif crun-1.16.1/src/libcrun/container.h0000644000000000000000000002651014614667631015337 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef CONTAINER_H #define CONTAINER_H #include #include #include "error.h" enum handler_configure_phase { HANDLER_CONFIGURE_BEFORE_MOUNTS = 1, HANDLER_CONFIGURE_AFTER_MOUNTS, HANDLER_CONFIGURE_MOUNTS, }; struct custom_handler_manager_s; struct libcrun_context_s { const char *state_root; const char *id; const char *bundle; const char *console_socket; const char *pid_file; const char *notify_socket; const char *handler; int preserve_fds; // For some use-cases we need differentiation between preserve_fds and listen_fds. // Following context variable makes sure we get exact value of listen_fds irrespective of preserve_fds. int listen_fds; crun_output_handler output_handler; void *output_handler_arg; int fifo_exec_wait_fd; bool systemd_cgroup; bool detach; bool no_new_keyring; bool force_no_cgroup; bool no_pivot; char **argv; int argc; struct custom_handler_manager_s *handler_manager; }; enum { LIBCRUN_RUN_OPTIONS_PREFORK = 1 << 0, LIBCRUN_RUN_OPTIONS_KEEP = 1 << 1, }; enum { LIBCRUN_CREATE_OPTIONS_PREFORK = 1 << 0, }; struct libcrun_container_s { /* Container parsed from the runtime json file. */ runtime_spec_schema_config_schema *container_def; uid_t host_uid; gid_t host_gid; uid_t container_uid; gid_t container_gid; char *config_file; char *config_file_content; void *private_data; void (*cleanup_private_data) (void *private_data); struct libcrun_context_s *context; }; struct libcrun_container_status_s; typedef struct libcrun_container_status_s libcrun_container_status_t; typedef struct libcrun_container_s libcrun_container_t; typedef struct libcrun_context_s libcrun_context_t; struct container_entrypoint_s; struct cgroup_info_s { bool v1; bool v2; bool systemd; bool systemd_user; }; struct seccomp_info_s { bool enabled; char **actions; char **operators; char **archs; }; struct apparmor_info_s { bool enabled; }; struct selinux_info_s { bool enabled; }; struct idmap_info_s { bool enabled; }; struct intel_rdt_s { bool enabled; }; struct mount_ext_info_s { struct idmap_info_s idmap; }; struct linux_info_s { char **namespaces; char **capabilities; struct cgroup_info_s cgroup; struct seccomp_info_s seccomp; struct apparmor_info_s apparmor; struct selinux_info_s selinux; struct mount_ext_info_s mount_ext; struct intel_rdt_s intel_rdt; }; struct annotations_info_s { char *io_github_seccomp_libseccomp_version; bool run_oci_crun_checkpoint_enabled; char *run_oci_crun_commit; char *run_oci_crun_version; bool run_oci_crun_wasm; }; struct features_info_s { char *oci_version_min; char *oci_version_max; char **hooks; char **mount_options; struct linux_info_s linux; struct annotations_info_s annotations; char **potentially_unsafe_annotations; }; struct libcrun_checkpoint_restore_s { char *image_path; char *work_path; bool leave_running; bool tcp_established; bool shell_job; bool ext_unix_sk; bool detach; bool file_locks; const char *console_socket; char *parent_path; bool pre_dump; int manage_cgroups_mode; }; typedef struct libcrun_checkpoint_restore_s libcrun_checkpoint_restore_t; LIBCRUN_PUBLIC libcrun_container_t *libcrun_container_load_from_file (const char *path, libcrun_error_t *err); LIBCRUN_PUBLIC libcrun_container_t *libcrun_container_load_from_memory (const char *json, libcrun_error_t *err); LIBCRUN_PUBLIC void libcrun_container_free (libcrun_container_t *); LIBCRUN_PUBLIC int libcrun_container_run (libcrun_context_t *context, libcrun_container_t *container, unsigned int options, libcrun_error_t *error); LIBCRUN_PUBLIC int libcrun_container_delete (libcrun_context_t *context, runtime_spec_schema_config_schema *def, const char *id, bool force, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_kill (libcrun_context_t *context, const char *id, const char *signal, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_killall (libcrun_context_t *context, const char *id, const char *signal, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_create (libcrun_context_t *context, libcrun_container_t *container, unsigned int options, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_start (libcrun_context_t *context, const char *id, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_state (libcrun_context_t *context, const char *id, FILE *out, libcrun_error_t *err); int libcrun_container_notify_handler (struct container_entrypoint_s *args, enum handler_configure_phase phase, libcrun_container_t *container, const char *rootfs, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_get_container_state_string (const char *id, libcrun_container_status_t *status, const char *state_root, const char **container_status, int *running, libcrun_error_t *err); struct libcrun_container_exec_options_s { size_t struct_size; runtime_spec_schema_config_schema_process *process; const char *path; const char *cgroup; }; LIBCRUN_PUBLIC int libcrun_container_exec_with_options (libcrun_context_t *context, const char *id, struct libcrun_container_exec_options_s *opts, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_exec (libcrun_context_t *context, const char *id, runtime_spec_schema_config_schema_process *process, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_exec_process_file (libcrun_context_t *context, const char *id, const char *path, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_update (libcrun_context_t *context, const char *id, const char *content, size_t len, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_update_from_file (libcrun_context_t *context, const char *id, const char *file, libcrun_error_t *err); struct libcrun_update_value_s { const char *section; const char *name; bool numeric; const char *value; }; LIBCRUN_PUBLIC int libcrun_container_update_from_values (libcrun_context_t *context, const char *id, struct libcrun_update_value_s *values, size_t len, libcrun_error_t *err); struct libcrun_intel_rdt_update { const char *l3_cache_schema; const char *mem_bw_schema; }; LIBCRUN_PUBLIC int libcrun_container_update_intel_rdt (libcrun_context_t *context, const char *id, struct libcrun_intel_rdt_update *update, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_get_features (libcrun_context_t *context, struct features_info_s **info, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_spec (bool root, FILE *out, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_pause (libcrun_context_t *context, const char *id, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_unpause (libcrun_context_t *context, const char *id, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_checkpoint (libcrun_context_t *context, const char *id, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_restore (libcrun_context_t *context, const char *id, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_container_read_pids (libcrun_context_t *context, const char *id, bool recurse, pid_t **pids, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_write_json_containers_list (libcrun_context_t *context, FILE *out, libcrun_error_t *err); // Not part of the public API, just a method in container.c we need to access from linux.c void get_root_in_the_userns (runtime_spec_schema_config_schema *def, uid_t host_uid, gid_t host_gid, uid_t *uid, gid_t *gid); static inline void cleanup_containerp (libcrun_container_t **c) { libcrun_container_t *container = *c; libcrun_container_free (container); } #define cleanup_container __attribute__ ((cleanup (cleanup_containerp))) static inline void cleanup_struct_features_free (struct features_info_s **info) { size_t i; struct features_info_s *ptr; if (info == NULL || *info == NULL) return; ptr = *info; // Free oci_version_min if it is not NULL if (ptr->oci_version_min != NULL) { free (ptr->oci_version_min); ptr->oci_version_min = NULL; // Set to NULL after freeing } // Free oci_version_max if it is not NULL if (ptr->oci_version_max != NULL) { free (ptr->oci_version_max); ptr->oci_version_max = NULL; // Set to NULL after freeing } if (ptr->hooks != NULL) { for (i = 0; ptr->hooks[i] != NULL; i++) free (ptr->hooks[i]); free (ptr->hooks); } if (ptr->mount_options != NULL) { for (i = 0; ptr->mount_options[i] != NULL; i++) free (ptr->mount_options[i]); free (ptr->mount_options); } if (ptr->linux.namespaces != NULL) { for (i = 0; ptr->linux.namespaces[i] != NULL; i++) free (ptr->linux.namespaces[i]); free (ptr->linux.namespaces); } if (ptr->linux.capabilities != NULL) { for (size_t i = 0; ptr->linux.capabilities[i] != NULL; i++) free (ptr->linux.capabilities[i]); free (ptr->linux.capabilities); } if (ptr->linux.seccomp.actions != NULL) { for (i = 0; ptr->linux.seccomp.actions[i] != NULL; i++) free (ptr->linux.seccomp.actions[i]); free (ptr->linux.seccomp.actions); } if (ptr->linux.seccomp.operators != NULL) { for (i = 0; ptr->linux.seccomp.operators[i] != NULL; i++) free (ptr->linux.seccomp.operators[i]); free (ptr->linux.seccomp.operators); } free (ptr); *info = NULL; } #define cleanup_struct_features __attribute__ ((cleanup (cleanup_struct_features_free))) #endif crun-1.16.1/src/libcrun/seccomp.h0000644000000000000000000000423214406334420014765 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef SECCOMP_H #define SECCOMP_H #include #include #include #include "error.h" #include #include #include #include "container.h" enum { LIBCRUN_SECCOMP_FAIL_UNKNOWN_SYSCALL = 1 << 0, LIBCRUN_SECCOMP_SKIP_CACHE = 1 << 1, }; typedef char seccomp_checksum_t[65]; struct libcrun_seccomp_gen_ctx_s { libcrun_container_t *container; seccomp_checksum_t checksum; unsigned int options; bool create; bool from_cache; /* Not owned here, it is the caller responsibility to close it. */ int fd; }; static inline void libcrun_seccomp_gen_ctx_init (struct libcrun_seccomp_gen_ctx_s *ctx, libcrun_container_t *container, bool create, unsigned int seccomp_gen_options) { memset (ctx, 0, sizeof (*ctx)); ctx->create = create; ctx->container = container; ctx->options = seccomp_gen_options; } int libcrun_generate_seccomp (struct libcrun_seccomp_gen_ctx_s *gen_ctx, libcrun_error_t *err); int libcrun_copy_seccomp (struct libcrun_seccomp_gen_ctx_s *gen_ctx, const char *b64_bpf, libcrun_error_t *err); int libcrun_apply_seccomp (int infd, int listener_receiver_fd, const char *receiver_fd_payload, size_t receiver_fd_payload_len, char **flags, size_t flags_len, libcrun_error_t *err); int libcrun_open_seccomp_bpf (struct libcrun_seccomp_gen_ctx_s *ctx, int *fd, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/ebpf.h0000644000000000000000000000316314406334420014252 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef EBPF_H #define EBPF_H #include #include #include #include "error.h" #include #include #include #include "container.h" struct bpf_program; struct bpf_program *bpf_program_new (size_t size); struct bpf_program *bpf_program_append (struct bpf_program *p, void *data, size_t size); struct bpf_program *bpf_program_init_dev (struct bpf_program *program, libcrun_error_t *err); struct bpf_program *bpf_program_append_dev (struct bpf_program *program, const char *access, char type, int major, int minor, bool accept, libcrun_error_t *err); struct bpf_program *bpf_program_complete_dev (struct bpf_program *program, libcrun_error_t *err); int libcrun_ebpf_load (struct bpf_program *program, int dirfd, const char *pin, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/cgroup.h0000644000000000000000000000645614504567214014655 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef CGROUP_H #define CGROUP_H #include "container.h" #include #ifndef CGROUP_ROOT # define CGROUP_ROOT "/sys/fs/cgroup" #endif #ifndef PROC_SELF_CGROUP # define PROC_SELF_CGROUP "/proc/self/cgroup" #endif enum { CGROUP_MODE_UNIFIED = 1, CGROUP_MODE_LEGACY, CGROUP_MODE_HYBRID }; enum { CGROUP_MANAGER_CGROUPFS = 1, CGROUP_MANAGER_SYSTEMD, CGROUP_MANAGER_DISABLED }; struct libcrun_cgroup_status; struct libcrun_cgroup_args { runtime_spec_schema_config_linux_resources *resources; json_map_string_string *annotations; const char *cgroup_path; int manager; pid_t pid; uid_t root_uid; gid_t root_gid; const char *id; bool joined; }; /* cgroup life-cycle management. */ int libcrun_cgroup_preenter (struct libcrun_cgroup_args *args, int *dirfd, libcrun_error_t *err); int libcrun_cgroup_enter (struct libcrun_cgroup_args *args, struct libcrun_cgroup_status **out, libcrun_error_t *err); int libcrun_cgroup_enter_finalize (struct libcrun_cgroup_args *args, struct libcrun_cgroup_status *cgroup_status, libcrun_error_t *err); int libcrun_cgroup_destroy (struct libcrun_cgroup_status *cgroup_status, libcrun_error_t *err); /* Handle the cgroup status. */ int libcrun_cgroup_get_status (struct libcrun_cgroup_status *cgroup_status, libcrun_container_status_t *status, libcrun_error_t *err); void libcrun_cgroup_status_free (struct libcrun_cgroup_status *cgroup_status); struct libcrun_cgroup_status *libcrun_cgroup_make_status (libcrun_container_status_t *status); static inline void cgroup_status_freep (struct libcrun_cgroup_status **p) { struct libcrun_cgroup_status *s = *p; if (s) libcrun_cgroup_status_free (s); } #define cleanup_cgroup_status __attribute__ ((cleanup (cgroup_status_freep))) /* Operations on the cgroup. */ int libcrun_cgroup_killall (struct libcrun_cgroup_status *cgroup_status, int signal, libcrun_error_t *err); int libcrun_cgroup_has_oom (struct libcrun_cgroup_status *status, libcrun_error_t *err); int libcrun_cgroup_read_pids (struct libcrun_cgroup_status *status, bool recurse, pid_t **pids, libcrun_error_t *err); int libcrun_update_cgroup_resources (struct libcrun_cgroup_status *status, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err); int libcrun_cgroup_is_container_paused (struct libcrun_cgroup_status *status, bool *paused, libcrun_error_t *err); int libcrun_cgroup_pause_unpause (struct libcrun_cgroup_status *status, const bool pause, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/cgroup-cgroupfs.h0000644000000000000000000000167114406334420016465 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef CGROUP_CGROUPFS_H #define CGROUP_CGROUPFS_H #include "container.h" #include "cgroup.h" #include extern struct libcrun_cgroup_manager cgroup_manager_cgroupfs; #endif crun-1.16.1/src/libcrun/cgroup-internal.h0000644000000000000000000000656614527677674016512 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef CGROUP_INTERNAL_H #define CGROUP_INTERNAL_H #include "container.h" #include "utils.h" enum { CGROUP_MEMORY = 1 << 0, CGROUP_CPU = 1 << 1, CGROUP_HUGETLB = 1 << 2, CGROUP_CPUSET = 1 << 3, CGROUP_PIDS = 1 << 4, CGROUP_IO = 1 << 5, }; struct libcrun_cgroup_status { char *path; char *scope; int manager; }; struct libcrun_cgroup_manager { /* Create a new cgroup and fill PATH in OUT. */ int (*create_cgroup) (struct libcrun_cgroup_args *args, struct libcrun_cgroup_status *out, libcrun_error_t *err); int (*precreate_cgroup) (struct libcrun_cgroup_args *args, int *dirfd, libcrun_error_t *err); /* Destroy the cgroup and kill any process if needed. */ int (*destroy_cgroup) (struct libcrun_cgroup_status *cgroup_status, libcrun_error_t *err); /* Additional resources configuration specific to this manager. */ int (*update_resources) (struct libcrun_cgroup_status *cgroup_status, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err); }; int move_process_to_cgroup (pid_t pid, const char *subsystem, const char *path, libcrun_error_t *err); int enter_cgroup_subsystem (pid_t pid, const char *subsystem, const char *path, bool create_if_missing, libcrun_error_t *err); int enable_controllers (const char *path, libcrun_error_t *err); int chown_cgroups (const char *path, uid_t uid, gid_t gid, libcrun_error_t *err); int destroy_cgroup_path (const char *path, int mode, libcrun_error_t *err); int cgroup_killall_path (const char *path, int signal, libcrun_error_t *err); int libcrun_cgroup_read_pids_from_path (const char *path, bool recurse, pid_t **pids, libcrun_error_t *err); bool read_proc_cgroup (char *content, char **saveptr, char **id, char **controller_list, char **path); static inline int is_rootless (libcrun_error_t *err) { if (geteuid ()) return 1; return check_running_in_user_namespace (err); } int libcrun_cgroup_pause_unpause_path (const char *cgroup_path, const bool pause, libcrun_error_t *err); static inline uint64_t convert_shares_to_weight (uint64_t shares) { /* convert linearly from 2-262144 to 1-10000. */ return (1 + ((shares - 2) * 9999) / 262142); } int initialize_cpuset_subsystem (const char *path, libcrun_error_t *err); int initialize_cpuset_subsystem_resources (const char *path, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err); int write_cpuset_resources (int dirfd_cpuset, int cgroup2, runtime_spec_schema_config_linux_resources_cpu *cpu, libcrun_error_t *err); int write_cpu_burst (int cpu_dirfd, bool cgroup2, runtime_spec_schema_config_linux_resources_cpu *cpu, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/cgroup-resources.h0000644000000000000000000000206414406334420016644 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef CGROUP_RESOURCES_H #define CGROUP_RESOURCES_H #include "container.h" #include "cgroup.h" #include int update_cgroup_resources (const char *path, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/cgroup-setup.h0000644000000000000000000000176114406334420015775 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef CGROUP_SETUP_H #define CGROUP_SETUP_H #include "container.h" #include "utils.h" int enter_cgroup (int cgroup_mode, pid_t pid, pid_t init_pid, const char *path, bool create_if_missing, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/cgroup-systemd.h0000644000000000000000000000232014516475732016333 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef CGROUP_SYSTEMD_H #define CGROUP_SYSTEMD_H #include "container.h" #include #ifdef HAVE_SYSTEMD extern int parse_sd_array (char *s, char **out, char **next, libcrun_error_t *err); extern int cpuset_string_to_bitmask (const char *str, char **out, size_t *out_size, libcrun_error_t *err); extern char *get_cgroup_scope_path (const char *cgroup_path, const char *scope); #endif extern struct libcrun_cgroup_manager cgroup_manager_systemd; #endif crun-1.16.1/src/libcrun/cgroup-utils.h0000644000000000000000000000255614504567214016010 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef CGROUP_UTILS_H #define CGROUP_UTILS_H #include "container.h" #include "cgroup.h" #include int libcrun_move_process_to_cgroup (pid_t pid, pid_t init_pid, char *path, libcrun_error_t *err); int libcrun_cgroups_create_symlinks (int dirfd, libcrun_error_t *err); int libcrun_get_current_unified_cgroup (char **path, bool absolute, libcrun_error_t *err); int libcrun_get_cgroup_mode (libcrun_error_t *err); int libcrun_get_cgroup_dirfd (struct libcrun_cgroup_status *status, const char *sub_cgroup, libcrun_error_t *err); int maybe_make_cgroup_threaded (const char *path, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/custom-handler.h0000644000000000000000000000710214406334420016260 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef CUSTOM_HANDLER_H #define CUSTOM_HANDLER_H #include "container.h" #include "utils.h" #include struct custom_handler_s { const char *name; const char *feature_string; const char *alias; int (*load) (void **cookie, libcrun_error_t *err); int (*unload) (void *cookie, libcrun_error_t *err); int (*run_func) (void *cookie, libcrun_container_t *container, const char *pathname, char *const argv[]); int (*exec_func) (void *cookie, libcrun_container_t *container, const char *pathname, char *const argv[]); int (*configure_container) (void *cookie, enum handler_configure_phase phase, libcrun_context_t *context, libcrun_container_t *container, const char *rootfs, libcrun_error_t *err); int (*can_handle_container) (libcrun_container_t *container, libcrun_error_t *err); int (*modify_oci_configuration) (void *cookie, libcrun_context_t *context, runtime_spec_schema_config_schema *def, libcrun_error_t *err); }; struct custom_handler_manager_s; LIBCRUN_PUBLIC struct custom_handler_manager_s *libcrun_handler_manager_create (libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_handler_manager_load_directory (struct custom_handler_manager_s *manager, const char *path, libcrun_error_t *err); LIBCRUN_PUBLIC void handler_manager_free (struct custom_handler_manager_s *manager); LIBCRUN_PUBLIC struct custom_handler_s *handler_by_name (struct custom_handler_manager_s *manager, const char *name); LIBCRUN_PUBLIC void libcrun_handler_manager_print_feature_tags (struct custom_handler_manager_s *manager, FILE *out); struct custom_handler_instance_s { struct custom_handler_s *vtable; void *cookie; }; LIBCRUN_PUBLIC int libcrun_configure_handler (struct custom_handler_manager_s *manager, libcrun_context_t *context, libcrun_container_t *container, struct custom_handler_instance_s **out, libcrun_error_t *err); typedef struct custom_handler_s *(*run_oci_get_handler_cb) (); #define cleanup_custom_handler_instance __attribute__ ((cleanup (cleanup_custom_handler_instancep))) static inline void cleanup_custom_handler_instancep (struct custom_handler_instance_s **p) { struct custom_handler_instance_s *handler = (struct custom_handler_instance_s *) *p; if (handler) { if (handler->vtable) { libcrun_error_t tmp_err = NULL; int tmp_ret; tmp_ret = handler->vtable->unload (handler->cookie, &tmp_err); if (UNLIKELY (tmp_ret < 0)) crun_error_release (&tmp_err); } free (handler); } } #endif crun-1.16.1/src/libcrun/io_priority.h0000644000000000000000000000175514504567214015723 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2023 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef IO_PRIORITY_H #define IO_PRIORITY_H #include #include "error.h" #include "container.h" #include "status.h" int libcrun_set_io_priority (pid_t pid, runtime_spec_schema_config_schema_process *process, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/linux.h0000644000000000000000000001611114561214571014500 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2021 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef LINUX_H #define LINUX_H #include #include #include #include "error.h" #include #include #include #include #include "container.h" #include "status.h" struct device_s { const char *path; char *type; int major; int minor; int mode; uid_t uid; gid_t gid; }; static inline int syscall_clone (unsigned long flags, void *child_stack) { #if defined __s390__ || defined __CRIS__ return (int) syscall (__NR_clone, child_stack, flags); #else return (int) syscall (__NR_clone, flags, child_stack); #endif } typedef int (*container_entrypoint_t) (void *args, char *notify_socket, int sync_socket, libcrun_error_t *err); typedef int (*set_mounts_cb_t) (void *args, libcrun_error_t *err); struct libcrun_dirfd_s { int *dirfd; bool joined; }; pid_t libcrun_run_linux_container (libcrun_container_t *container, container_entrypoint_t entrypoint, void *args, int *sync_socket_out, struct libcrun_dirfd_s *dirfd, libcrun_error_t *err); int get_notify_fd (libcrun_context_t *context, libcrun_container_t *container, int *notify_socket_out, libcrun_error_t *err); int libcrun_set_mounts (struct container_entrypoint_s *args, libcrun_container_t *container, const char *rootfs, set_mounts_cb_t cb, void *cb_data, libcrun_error_t *err); int libcrun_init_caps (libcrun_error_t *err); int libcrun_do_pivot_root (libcrun_container_t *container, bool no_pivot, const char *rootfs, libcrun_error_t *err); int libcrun_reopen_dev_null (libcrun_error_t *err); int libcrun_set_usernamespace (libcrun_container_t *container, pid_t pid, libcrun_error_t *err); int libcrun_set_caps (runtime_spec_schema_config_schema_process_capabilities *capabilities, uid_t uid, gid_t gid, int no_new_privileges, libcrun_error_t *err); int libcrun_set_rlimits (runtime_spec_schema_config_schema_process_rlimits_element **rlimits, size_t len, libcrun_error_t *err); int libcrun_set_selinux_label (runtime_spec_schema_config_schema_process *proc, bool now, libcrun_error_t *err); int libcrun_set_apparmor_profile (runtime_spec_schema_config_schema_process *proc, bool now, libcrun_error_t *err); int libcrun_set_hostname (libcrun_container_t *container, libcrun_error_t *err); int libcrun_set_domainname (libcrun_container_t *container, libcrun_error_t *err); int libcrun_set_oom (libcrun_container_t *container, libcrun_error_t *err); int libcrun_set_sysctl (libcrun_container_t *container, libcrun_error_t *err); int libcrun_set_terminal (libcrun_container_t *container, libcrun_error_t *err); int libcrun_join_process (libcrun_context_t *context, libcrun_container_t *container, pid_t pid_to_join, libcrun_container_status_t *status, const char *cgroup, int detach, runtime_spec_schema_config_schema_process *process, int *terminal_fd, libcrun_error_t *err); int libcrun_linux_container_update (libcrun_container_status_t *status, runtime_spec_schema_config_linux_resources *resources, libcrun_error_t *err); int libcrun_create_keyring (const char *name, const char *label, libcrun_error_t *err); int libcrun_container_pause_linux (libcrun_container_status_t *status, libcrun_error_t *err); int libcrun_container_unpause_linux (libcrun_container_status_t *status, libcrun_error_t *err); int libcrun_container_do_bind_mount (libcrun_container_t *container, char *mount_source, char *mount_destination, char **mount_options, size_t mount_options_len, libcrun_error_t *err); int libcrun_container_enter_cgroup_ns (libcrun_container_t *container, libcrun_error_t *err); int libcrun_set_personality (runtime_spec_schema_defs_linux_personality *p, libcrun_error_t *err); int libcrun_configure_network (libcrun_container_t *container, libcrun_error_t *err); int libcrun_container_checkpoint_linux (libcrun_container_status_t *status, libcrun_container_t *container, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err); int libcrun_container_restore_linux (libcrun_container_status_t *status, libcrun_container_t *container, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err); int libcrun_find_namespace (const char *name); char *libcrun_get_external_descriptors (libcrun_container_t *container); int libcrun_container_setgroups (libcrun_container_t *container, runtime_spec_schema_config_schema_process *process, libcrun_error_t *err); int libcrun_kill_linux (libcrun_container_status_t *status, int signal, libcrun_error_t *err); int libcrun_create_final_userns (libcrun_container_t *container, libcrun_error_t *err); int libcrun_save_external_descriptors (libcrun_container_t *container, pid_t pid, libcrun_error_t *err); int libcrun_create_dev (libcrun_container_t *container, int devfd, int srcfd, struct device_s *device, bool binds, bool ensure_parent_dir, libcrun_error_t *err); int parse_idmapped_mount_option (runtime_spec_schema_config_schema *def, bool is_uids, char *option, char **out, size_t *len, libcrun_error_t *err); enum { LIBCRUN_INTELRDT_CREATE = (1 << 0), LIBCRUN_INTELRDT_UPDATE = (1 << 1), LIBCRUN_INTELRDT_MOVE = (1 << 2), }; #define LIBCRUN_INTELRDT_CREATE_UPDATE_MOVE (LIBCRUN_INTELRDT_CREATE | LIBCRUN_INTELRDT_UPDATE | LIBCRUN_INTELRDT_MOVE) static inline bool container_has_intelrdt (libcrun_container_t *container) { runtime_spec_schema_config_schema *def = NULL; def = container->container_def; return def != NULL && def->linux != NULL && def->linux->intel_rdt != NULL; } const char *libcrun_get_intelrdt_name (const char *ctr_name, libcrun_container_t *container, bool *explicit); int libcrun_apply_intelrdt (const char *ctr_name, libcrun_container_t *container, pid_t pid, int actions, libcrun_error_t *err); int libcrun_destroy_intelrdt (const char *name, libcrun_error_t *err); int libcrun_update_intel_rdt (const char *ctr_name, libcrun_container_t *container, const char *l3_cache_schema, const char *mem_bw_schema, libcrun_error_t *err); int libcrun_safe_chdir (const char *path, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/utils.h0000644000000000000000000003202014614667631014506 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef UTILS_H #define UTILS_H #include #include #include #include #include #include "error.h" #include #include #include #include #include #include "container.h" #ifndef TEMP_FAILURE_RETRY # define TEMP_FAILURE_RETRY(expression) \ (__extension__ ({ \ long int __result; \ do \ __result = (long int) (expression); \ while (__result < 0 && errno == EINTR); \ __result; \ })) #endif #define cleanup_file __attribute__ ((cleanup (cleanup_filep))) #define cleanup_free __attribute__ ((cleanup (cleanup_freep))) #define cleanup_close __attribute__ ((cleanup (cleanup_closep))) #define cleanup_close_vec __attribute__ ((cleanup (cleanup_close_vecp))) #define cleanup_close_map __attribute__ ((cleanup (cleanup_close_mapp))) #define cleanup_dir __attribute__ ((cleanup (cleanup_dirp))) #define arg_unused __attribute__ ((unused)) #define cleanup_pid __attribute__ ((cleanup (cleanup_pidp))) #define cleanup_mmap __attribute__ ((cleanup (cleanup_mmapp))) #define LIKELY(x) __builtin_expect ((x), 1) #define UNLIKELY(x) __builtin_expect ((x), 0) __attribute__ ((malloc)) static inline void * xmalloc (size_t size) { void *res = malloc (size); if (UNLIKELY (res == NULL)) OOM (); return res; } __attribute__ ((malloc)) static inline void * xmalloc0 (size_t size) { void *res = calloc (1, size); if (UNLIKELY (res == NULL)) OOM (); return res; } __attribute__ ((malloc)) static inline void * xrealloc (void *ptr, size_t size) { void *res = realloc (ptr, size); if (UNLIKELY (res == NULL)) OOM (); return res; } static inline void cleanup_freep (void *p) { void **pp = (void **) p; free (*pp); } static inline void cleanup_filep (FILE **f) { FILE *file = *f; if (file) (void) fclose (file); } static inline void cleanup_closep (void *p) { int *pp = (int *) p; if (*pp >= 0) TEMP_FAILURE_RETRY (close (*pp)); } static inline void cleanup_pidp (void *p) { pid_t *pp = (pid_t *) p; if (*pp > 0) { TEMP_FAILURE_RETRY (kill (*pp, SIGKILL)); TEMP_FAILURE_RETRY (waitpid (*pp, NULL, 0)); } } struct libcrun_mmap_s { void *addr; size_t length; }; int libcrun_mmap (struct libcrun_mmap_s **ret, void *addr, size_t length, int prot, int flags, int fd, off_t offset, libcrun_error_t *err); int libcrun_munmap (struct libcrun_mmap_s *mmap, libcrun_error_t *err); static inline void cleanup_mmapp (void *p) { int ret; libcrun_error_t tmp_err = NULL; struct libcrun_mmap_s **mm; mm = (struct libcrun_mmap_s **) p; if (*mm == NULL) return; ret = libcrun_munmap (*mm, &tmp_err); if (UNLIKELY (ret < 0)) crun_error_release (&tmp_err); } struct libcrun_fd_map { size_t nfds; int fds[]; }; static inline struct libcrun_fd_map * make_libcrun_fd_map (size_t len) { struct libcrun_fd_map *ret; size_t i; ret = (struct libcrun_fd_map *) xmalloc (sizeof (*ret) + sizeof (int) * len); ret->nfds = len; for (i = 0; i < len; i++) ret->fds[i] = -1; return ret; } static inline void cleanup_close_mapp (struct libcrun_fd_map **p) { struct libcrun_fd_map *m = *p; size_t i; if (m == NULL) return; for (i = 0; i < m->nfds; i++) if (m->fds[i] >= 0) TEMP_FAILURE_RETRY (close (m->fds[i])); free (m); } static inline void cleanup_close_vecp (int **p) { int *pp = *p; int i; for (i = 0; pp[i] >= 0; i++) TEMP_FAILURE_RETRY (close (pp[i])); } static inline void cleanup_dirp (DIR **p) { DIR *dir = *p; if (dir) closedir (dir); } static inline int close_and_reset (int *fd) { int ret = 0; if (*fd >= 0) { ret = TEMP_FAILURE_RETRY (close (*fd)); if (LIKELY (ret == 0)) *fd = -1; } return ret; } static inline char * xstrdup (const char *str) { char *ret; if (str == NULL) return NULL; ret = strdup (str); if (ret == NULL) OOM (); return ret; } static inline const char * consume_slashes (const char *t) { while (*t == '/') t++; return t; } static inline bool path_is_slash_dev (const char *path) { path = consume_slashes (path); if (strncmp (path, "dev", 3)) return false; path += 3; /* Check there are only '/' left. */ for (; *path; path++) if (*path != '/') return false; return true; } int xasprintf (char **str, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); int crun_path_exists (const char *path, libcrun_error_t *err); int write_file_with_flags (const char *name, int flags, const void *data, size_t len, libcrun_error_t *err); int write_file (const char *name, const void *data, size_t len, libcrun_error_t *err); int write_file_at (int dirfd, const char *name, const void *data, size_t len, libcrun_error_t *err); int write_file_at_with_flags (int dirfd, int flags, mode_t mode, const char *name, const void *data, size_t len, libcrun_error_t *err); int crun_ensure_directory (const char *path, int mode, bool nofollow, libcrun_error_t *err); int crun_ensure_file (const char *path, int mode, bool nofollow, libcrun_error_t *err); int crun_ensure_directory_at (int dirfd, const char *path, int mode, bool nofollow, libcrun_error_t *err); int crun_ensure_file_at (int dirfd, const char *path, int mode, bool nofollow, libcrun_error_t *err); int crun_safe_create_and_open_ref_at (bool dir, int dirfd, const char *dirpath, size_t dirpath_len, const char *path, int mode, libcrun_error_t *err); int crun_safe_ensure_directory_at (int dirfd, const char *dirpath, size_t dirpath_len, const char *path, int mode, libcrun_error_t *err); int crun_safe_ensure_file_at (int dirfd, const char *dirpath, size_t dirpath_len, const char *path, int mode, libcrun_error_t *err); int crun_dir_p (const char *path, bool nofollow, libcrun_error_t *err); int crun_dir_p_at (int dirfd, const char *path, bool nofollow, libcrun_error_t *err); int detach_process (); int create_file_if_missing_at (int dirfd, const char *file, libcrun_error_t *err); int check_running_in_user_namespace (libcrun_error_t *err); int set_selinux_label (const char *label, bool now, libcrun_error_t *err); int add_selinux_mount_label (char **ret, const char *data, const char *label, const char *context_type, libcrun_error_t *err); int set_apparmor_profile (const char *profile, bool no_new_privileges, bool now, libcrun_error_t *err); int read_all_fd_with_size_hint (int fd, const char *description, char **out, size_t *len, size_t hint, libcrun_error_t *err); static inline int read_all_fd (int fd, const char *description, char **out, size_t *len, libcrun_error_t *err) { return read_all_fd_with_size_hint (fd, description, out, len, 0, err); } int read_all_file (const char *path, char **out, size_t *len, libcrun_error_t *err); int read_all_file_at (int dirfd, const char *path, char **out, size_t *len, libcrun_error_t *err); int open_unix_domain_client_socket (const char *path, int dgram, libcrun_error_t *err); int open_unix_domain_socket (const char *path, int dgram, libcrun_error_t *err); int send_fd_to_socket (int server, int fd, libcrun_error_t *err); int send_fd_to_socket_with_payload (int server, int fd, const char *payload, size_t payload_len, libcrun_error_t *err); int create_socket_pair (int *pair, libcrun_error_t *err); int receive_fd_from_socket (int from, libcrun_error_t *err); int receive_fd_from_socket_with_payload (int from, char *payload, size_t payload_len, libcrun_error_t *err); int create_signalfd (sigset_t *mask, libcrun_error_t *err); int epoll_helper (int *fds, int *levelfds, libcrun_error_t *err); int copy_from_fd_to_fd (int src, int dst, int consume, libcrun_error_t *err); int run_process (char **args, libcrun_error_t *err); size_t format_default_id_mapping (char **ret, uid_t container_id, uid_t host_uid, uid_t host_id, int is_uid); int run_process_with_stdin_timeout_envp (char *path, char **args, const char *cwd, int timeout, char **envp, char *stdin, size_t stdin_len, int out_fd, int err_fd, libcrun_error_t *err); int mark_or_close_fds_ge_than (int n, bool close_now, libcrun_error_t *err); void get_current_timestamp (char *out, size_t len); int set_blocking_fd (int fd, int blocking, libcrun_error_t *err); int parse_json_file (yajl_val *out, const char *jsondata, struct parser_context *ctx, libcrun_error_t *err); static inline int has_prefix (const char *str, const char *prefix) { size_t prefix_len = strlen (prefix); return strlen (str) >= prefix_len && memcmp (str, prefix, prefix_len) == 0; } char *find_executable (const char *executable_path, const char *cwd); int copy_recursive_fd_to_fd (int srcfd, int destfd, const char *srcname, const char *destname, libcrun_error_t *err); int set_home_env (uid_t uid); int libcrun_initialize_selinux (libcrun_error_t *err); int libcrun_initialize_apparmor (libcrun_error_t *err); const char *find_annotation_map (json_map_string_string *annotations, const char *name); const char *find_annotation (libcrun_container_t *container, const char *name); int get_file_type_at (int dirfd, mode_t *mode, bool nofollow, const char *path); int get_file_type (mode_t *mode, bool nofollow, const char *path); int get_file_type_fd (int fd, mode_t *mode); char *get_user_name (uid_t uid); int safe_openat (int dirfd, const char *rootfs, size_t rootfs_len, const char *path, int flags, int mode, libcrun_error_t *err); ssize_t safe_write (int fd, const void *buf, ssize_t count); int append_paths (char **out, libcrun_error_t *err, ...) __attribute__ ((sentinel)); int str2sig (const char *name); int base64_decode (const char *iptr, size_t isize, char *optr, size_t osize, size_t *nbytes); int has_suffix (const char *source, const char *suffix); char *str_join_array (int offset, size_t size, char *const array[], const char *joint); ssize_t safe_readlinkat (int dfd, const char *name, char **buffer, ssize_t hint, libcrun_error_t *err); static inline bool is_empty_string (const char *s) { return s == NULL || s[0] == '\0'; } static inline int waitpid_ignore_stopped (pid_t pid, int *status, int options) { int ret, s = 0; do { ret = TEMP_FAILURE_RETRY (waitpid (pid, &s, options)); if (ret < 0) return ret; } while (WIFSTOPPED (s) | WIFCONTINUED (s)); if (status) *status = s; return ret; } static inline int get_process_exit_status (int status) { if (WIFEXITED (status)) return WEXITSTATUS (status); if (WIFSIGNALED (status)) return 128 + WTERMSIG (status); return -1; } uid_t get_overflow_uid (void); gid_t get_overflow_gid (void); /* Adapted from systemd. Include space for the NUL byte. */ #define DECIMAL_STR_MAX(type) \ ((size_t) 2U + (sizeof (type) <= 1 ? 3U : sizeof (type) <= 2 ? 5U \ : sizeof (type) <= 4 ? 10U \ : sizeof (type) <= 8 ? 20U \ : sizeof (int[-2 * (sizeof (type) > 8)]))) #define _STRLEN(s) (sizeof (s) - 1) /* _STRLEN("self") < DECIMAL_STR_MAX (pid_t), so we don't need to calculate the length of both. */ #define PROC_PID_FD_STRLEN (_STRLEN ("/proc/") + DECIMAL_STR_MAX (pid_t) \ + _STRLEN ("/fd/") + DECIMAL_STR_MAX (int)) /* A buffer long enough to hold either /proc/self/fd/$FD or a /proc/$PID/fd/$FD path. */ typedef char proc_fd_path_t[PROC_PID_FD_STRLEN]; #undef _STRLEN static inline void get_proc_fd_path (proc_fd_path_t path, pid_t pid, int fd) { const size_t max_len = sizeof (proc_fd_path_t); size_t n; if (pid) n = snprintf (path, max_len, "/proc/%d/fd/%d", pid, fd); else n = snprintf (path, max_len, "/proc/self/fd/%d", fd); if (UNLIKELY (n >= max_len)) abort (); } static inline void get_proc_self_fd_path (proc_fd_path_t path, int fd) { get_proc_fd_path (path, 0, fd); } static inline int validate_options (unsigned int specified_options, unsigned int supported_options, libcrun_error_t *err) { if (! ! (~supported_options & specified_options)) return crun_make_error (err, 0, "internal error: unknown options %d", specified_options); return 0; } #endif crun-1.16.1/src/libcrun/error.h0000644000000000000000000001004714504567214014476 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef ERROR_H #define ERROR_H #include #ifdef HAVE_ERROR_H # include #else # define error(status, errno, fmt, ...) \ do \ { \ if (errno == 0) \ fprintf (stderr, "crun: " fmt "\n", ##__VA_ARGS__); \ else \ { \ fprintf (stderr, "crun: " fmt, ##__VA_ARGS__); \ fprintf (stderr, ": %s\n", strerror (errno)); \ } \ if (status) \ exit (status); \ } while (0) #endif #include #include #include #include #include struct libcrun_error_s { int status; char *msg; }; typedef struct libcrun_error_s *libcrun_error_t; #define OOM() \ do \ { \ fprintf (stderr, "out of memory"); \ _exit (EXIT_FAILURE); \ } while (0) typedef void (*crun_output_handler) (int errno_, const char *msg, bool warning, void *arg); void crun_set_output_handler (crun_output_handler handler, void *arg, bool log_to_stderr); void log_write_to_journald (int errno_, const char *msg, bool warning, void *arg); void log_write_to_syslog (int errno_, const char *msg, bool warning, void *arg); void log_write_to_stream (int errno_, const char *msg, bool warning, void *arg); void log_write_to_stderr (int errno_, const char *msg, bool warning, void *arg); int crun_error_wrap (libcrun_error_t *err, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); int crun_error_get_errno (libcrun_error_t *err); int crun_error_release (libcrun_error_t *err); void crun_error_write_warning_and_release (FILE *out, libcrun_error_t **err); LIBCRUN_PUBLIC void libcrun_warning (const char *msg, ...) __attribute__ ((format (printf, 1, 2))); LIBCRUN_PUBLIC void libcrun_error (int errno_, const char *msg, ...) __attribute__ ((format (printf, 2, 3))); LIBCRUN_PUBLIC int libcrun_make_error (libcrun_error_t *err, int status, const char *msg, ...) __attribute__ ((format (printf, 3, 4))); #define crun_make_error libcrun_make_error LIBCRUN_PUBLIC void libcrun_error_write_warning_and_release (FILE *out, libcrun_error_t **err); LIBCRUN_PUBLIC void libcrun_fail_with_error (int errno_, const char *msg, ...) __attribute__ ((noreturn)) __attribute__ ((format (printf, 2, 3))); LIBCRUN_PUBLIC int libcrun_set_log_format (const char *format, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_init_logging (crun_output_handler *output_handler, void **output_handler_arg, const char *id, const char *log, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_error_release (libcrun_error_t *err); int yajl_error_to_crun_error (int yajl_status, libcrun_error_t *err); enum { LIBCRUN_VERBOSITY_ERROR, LIBCRUN_VERBOSITY_WARNING, }; LIBCRUN_PUBLIC void libcrun_set_verbosity (int verbosity); LIBCRUN_PUBLIC int libcrun_get_verbosity (); #endif crun-1.16.1/src/libcrun/criu.h0000644000000000000000000000415114406334420014276 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2020 Adrian Reber * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef CRIU_H #define CRIU_H #include #include "container.h" #include "error.h" #include "utils.h" #if HAVE_CRIU && HAVE_DLOPEN int libcrun_container_checkpoint_linux_criu (libcrun_container_status_t *status, libcrun_container_t *container, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err); int libcrun_container_restore_linux_criu (libcrun_container_status_t *status, libcrun_container_t *container, libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err); #else static inline int libcrun_container_checkpoint_linux_criu (arg_unused libcrun_container_status_t *status, arg_unused libcrun_container_t *container, arg_unused libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err) { return crun_make_error (err, 0, "compiled without CRIU support. Checkpointing not available"); } static inline int libcrun_container_restore_linux_criu (arg_unused libcrun_container_status_t *status, arg_unused libcrun_container_t *container, arg_unused libcrun_checkpoint_restore_t *cr_options, libcrun_error_t *err) { return crun_make_error (err, 0, "compiled without CRIU support. Restore not available"); } #endif #endif crun-1.16.1/src/libcrun/scheduler.h0000644000000000000000000000177014504567214015326 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2021 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef SCHEDULER_H #define SCHEDULER_H #include #include "error.h" #include "container.h" #include "status.h" int libcrun_set_scheduler (pid_t pid, runtime_spec_schema_config_schema_process *process, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/status.h0000644000000000000000000000643214514171717014673 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef STATUS_H #define STATUS_H #include #include #include "error.h" #include "container.h" struct libcrun_container_list_s { struct libcrun_container_list_s *next; char *name; }; typedef struct libcrun_container_list_s libcrun_container_list_t; struct libcrun_container_status_s { pid_t pid; unsigned long long process_start_time; char *bundle; char *rootfs; char *cgroup_path; char *scope; char *intelrdt; int systemd_cgroup; char *created; int detached; char *external_descriptors; char *owner; }; typedef struct libcrun_container_status_s libcrun_container_status_t; LIBCRUN_PUBLIC void libcrun_free_container_status (libcrun_container_status_t *status); LIBCRUN_PUBLIC int libcrun_write_container_status (const char *state_root, const char *id, libcrun_container_status_t *status, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_read_container_status (libcrun_container_status_t *status, const char *state_root, const char *id, libcrun_error_t *err); LIBCRUN_PUBLIC void libcrun_free_containers_list (libcrun_container_list_t *list); LIBCRUN_PUBLIC int libcrun_is_container_running (libcrun_container_status_t *status, libcrun_error_t *err); LIBCRUN_PUBLIC char *libcrun_get_state_directory (const char *state_root, const char *id); LIBCRUN_PUBLIC int libcrun_container_delete_status (const char *state_root, const char *id, libcrun_error_t *err); LIBCRUN_PUBLIC int libcrun_get_containers_list (libcrun_container_list_t **ret, const char *state_root, libcrun_error_t *err); int libcrun_status_check_directories (const char *state_root, const char *id, libcrun_error_t *err); int libcrun_status_create_exec_fifo (const char *state_root, const char *id, libcrun_error_t *err); int libcrun_status_write_exec_fifo (const char *state_root, const char *id, libcrun_error_t *err); int libcrun_status_has_read_exec_fifo (const char *state_root, const char *id, libcrun_error_t *err); int libcrun_check_pid_valid (libcrun_container_status_t *status, libcrun_error_t *err); static inline void libcrun_free_container_listp (void *p) { libcrun_container_list_t **l = (libcrun_container_list_t **) p; if (*l != NULL) libcrun_free_containers_list (*l); } #define cleanup_container_status __attribute__ ((cleanup (libcrun_free_container_status))) #define cleanup_container_list __attribute__ ((cleanup (libcrun_free_container_listp))) #endif crun-1.16.1/src/libcrun/terminal.h0000664000000000000000000000242214011447015015145 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef TERMINAL_H #define TERMINAL_H #include #include "container.h" #include void cleanup_terminalp (void *p); #define cleanup_terminal __attribute__ ((cleanup (cleanup_terminalp))) int libcrun_new_terminal (char **pty, libcrun_error_t *err); int libcrun_set_stdio (char *pty, libcrun_error_t *err); int libcrun_setup_terminal_ptmx (int fd, void **current_status, libcrun_error_t *err); int libcrun_terminal_setup_size (int fd, unsigned short rows, unsigned short cols, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/mount_flags.h0000644000000000000000000000225414514171717015664 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2021 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef MOUNT_FLAGS_H #define MOUNT_FLAGS_H enum { OPTION_TMPCOPYUP = (1 << 0), OPTION_RECURSIVE = (1 << 1), OPTION_IDMAP = (1 << 2), OPTION_COPY_SYMLINK = (1 << 3), }; struct propagation_flags_s { char *name; int clear; int flags; int extra_flags; }; const struct propagation_flags_s *libcrun_str2mount_flags (const char *name); const struct propagation_flags_s *get_mount_flags_from_wordlist (); #endif crun-1.16.1/src/libcrun/intelrdt.h0000644000000000000000000000241414514171717015171 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2023 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #ifndef INTEL_RDT_H #define INTEL_RDT_H #include #include #include #include "error.h" int resctl_create (const char *name, bool explicit_clos_id, bool *created, const char *l3_cache_schema, const char *mem_bw_schema, libcrun_error_t *err); int resctl_move_task_to (const char *name, pid_t pid, libcrun_error_t *err); int resctl_update (const char *name, const char *l3_cache_schema, const char *mem_bw_schema, libcrun_error_t *err); int resctl_destroy (const char *name, libcrun_error_t *err); #endif crun-1.16.1/src/libcrun/signals.perf0000644000000000000000000000374614504567214015522 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ %{ #define _GNU_SOURCE #include #include #include #include "utils.h" %} struct signal_s { int name; int value; }; %% HUP, 1 INT, 2 QUIT, 3 ILL, 4 TRAP, 5 ABRT, 6 BUS, 7 FPE, 8 KILL, 9 USR1, 10 SEGV, 11 USR2, 12 PIPE, 13 ALRM, 14 TERM, 15 STKFLT, 16 CHLD, 17 CONT, 18 STOP, 19 TSTP, 20 TTIN, 21 TTOU, 22 URG, 23 XCPU, 24 XFSZ, 25 VTALRM, 26 PROF, 27 WINCH, 28 IO, 29 PWR, 30 SYS, 31 RTMIN, 34 RTMIN+1, 35 RTMIN+2, 36 RTMIN+3, 37 RTMIN+4, 38 RTMIN+5, 39 RTMIN+6, 40 RTMIN+7, 41 RTMIN+8, 42 RTMIN+9, 43 RTMIN+10, 44 RTMIN+11, 45 RTMIN+12, 46 RTMIN+13, 47 RTMIN+14, 48 RTMIN+15, 49 RTMAX-14, 50 RTMAX-13, 51 RTMAX-12, 52 RTMAX-11, 53 RTMAX-10, 54 RTMAX-9, 55 RTMAX-8, 56 RTMAX-7, 57 RTMAX-6, 58 RTMAX-5, 59 RTMAX-4, 60 RTMAX-3, 61 RTMAX-2, 62 RTMAX-1, 63 RTMAX, 64 %% int str2sig (const char *name) { const struct signal_s *s; if (has_prefix (name, "SIG")) name += 3; s = libcrun_signal_in_word_set (name, strlen (name)); if (s == NULL) { long int value; if (!isdigit(name[0])) { errno = EINVAL; return -1; } errno = 0; value = strtol (name, NULL, 10); if (errno != 0) return -1; return value; } return s->value; } crun-1.16.1/src/libcrun/mount_flags.perf0000644000000000000000000000646514514171717016401 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ %{ #define _GNU_SOURCE #include #include #include #include #include #include #include "utils.h" #include "mount_flags.h" %} struct propagation_flags_s; %% defaults, 0, 0, 0 bind, 0, MS_BIND, 0 rbind, 0, MS_REC|MS_BIND, 0 ro, 0, MS_RDONLY, 0 rw, 1, MS_RDONLY, 0 suid, 1, MS_NOSUID, 0 nosuid, 0, MS_NOSUID, 0 dev, 1, MS_NODEV, 0 nodev, 0, MS_NODEV, 0 exec, 1, MS_NOEXEC, 0 noexec, 0, MS_NOEXEC, 0 sync, 0, MS_SYNCHRONOUS, 0 async, 1, MS_SYNCHRONOUS, 0 dirsync, 0, MS_DIRSYNC, 0 remount, 0, MS_REMOUNT, 0 mand, 0, MS_MANDLOCK, 0 nomand, 1, MS_MANDLOCK, 0 atime, 1, MS_NOATIME, 0 noatime, 0, MS_NOATIME, 0 diratime, 1, MS_NODIRATIME, 0 nodiratime, 0, MS_NODIRATIME, 0 relatime, 0, MS_RELATIME, 0 norelatime, 1, MS_RELATIME, 0 strictatime, 0, MS_STRICTATIME, 0 nostrictatime, 1, MS_STRICTATIME, 0 shared, 0, MS_SHARED, 0 rshared, 0, MS_REC|MS_SHARED, 0 slave, 0, MS_SLAVE, 0 rslave, 0, MS_REC|MS_SLAVE, 0 private, 0, MS_PRIVATE, 0 rprivate, 0, MS_REC|MS_PRIVATE, 0 unbindable, 0, MS_UNBINDABLE, 0 runbindable, 0, MS_REC|MS_UNBINDABLE, 0 rro, 0, MS_RDONLY, OPTION_RECURSIVE rrw, 1, MS_RDONLY, OPTION_RECURSIVE rsuid, 1, MS_NOSUID, OPTION_RECURSIVE rnosuid, 0, MS_NOSUID, OPTION_RECURSIVE rdev, 1, MS_NODEV, OPTION_RECURSIVE rnodev, 0, MS_NODEV, OPTION_RECURSIVE rexec, 1, MS_NOEXEC, OPTION_RECURSIVE rnoexec, 0, MS_NOEXEC, OPTION_RECURSIVE rsync, 0, MS_SYNCHRONOUS, OPTION_RECURSIVE rasync, 1, MS_SYNCHRONOUS, OPTION_RECURSIVE rdirsync, 0, MS_DIRSYNC, OPTION_RECURSIVE rmand, 0, MS_MANDLOCK, OPTION_RECURSIVE rnomand, 1, MS_MANDLOCK, OPTION_RECURSIVE ratime, 1, MS_NOATIME, OPTION_RECURSIVE rnoatime, 0, MS_NOATIME, OPTION_RECURSIVE rdiratime, 1, MS_NODIRATIME, OPTION_RECURSIVE rnodiratime, 0, MS_NODIRATIME, OPTION_RECURSIVE rrelatime, 0, MS_RELATIME, OPTION_RECURSIVE rnorelatime, 1, MS_RELATIME, OPTION_RECURSIVE rstrictatime, 0, MS_STRICTATIME, OPTION_RECURSIVE rnostrictatime, 1, MS_STRICTATIME, OPTION_RECURSIVE tmpcopyup, 0, 0, OPTION_TMPCOPYUP idmap, 0, 0, OPTION_IDMAP copy-symlink, 0, 0, OPTION_COPY_SYMLINK %% const struct propagation_flags_s * libcrun_str2mount_flags (const char *name) { return libcrun_mount_flag_in_word_set (name, strlen (name)); } const struct propagation_flags_s * get_mount_flags_from_wordlist (void) { struct propagation_flags_s *flags; size_t i; size_t num_wordlist_flags = sizeof (wordlist) / sizeof (wordlist[0]); flags = xmalloc0 ((sizeof (struct propagation_flags_s) + 1) * num_wordlist_flags); for (i = 0; i < num_wordlist_flags; i++) flags[i].name = wordlist[i].name; return flags; } crun-1.16.1/src/crun.c0000644000000000000000000003025114504567214012650 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #ifdef HAVE_DLOPEN # include #endif #include "crun.h" #include "libcrun/utils.h" #include "libcrun/custom-handler.h" #include "libcrun/status.h" /* Commands. */ #include "run.h" #include "delete.h" #include "kill.h" #include "list.h" #include "start.h" #include "create.h" #include "exec.h" #include "state.h" #include "update.h" #include "spec.h" #include "pause.h" #include "unpause.h" #include "oci_features.h" #include "ps.h" #include "checkpoint.h" #include "restore.h" static struct crun_global_arguments arguments; static struct custom_handler_manager_s *handler_manager; static struct custom_handler_manager_s * libcrun_get_handler_manager () { if (handler_manager == NULL) { cleanup_free char *handlers_path = NULL; libcrun_error_t err; int ret; handler_manager = libcrun_handler_manager_create (&err); if (UNLIKELY (handler_manager == NULL)) libcrun_fail_with_error (err->status, "%s", err->msg); handlers_path = strdup (CRUN_LIBDIR "/handlers"); if (UNLIKELY (handlers_path == NULL)) OOM (); if (access (handlers_path, F_OK) == 0) { ret = libcrun_handler_manager_load_directory (handler_manager, handlers_path, &err); if (UNLIKELY (ret < 0)) libcrun_fail_with_error (err->status, "%s", err->msg); } } return handler_manager; } struct commands_s { int value; const char *name; int (*handler) (struct crun_global_arguments *, int, char **, libcrun_error_t *); }; int init_libcrun_context (libcrun_context_t *con, const char *id, struct crun_global_arguments *glob, libcrun_error_t *err) { int ret; con->id = id; con->state_root = glob->root; con->systemd_cgroup = glob->option_systemd_cgroup; con->force_no_cgroup = glob->option_force_no_cgroup; con->notify_socket = getenv ("NOTIFY_SOCKET"); con->fifo_exec_wait_fd = -1; con->argc = glob->argc; con->argv = glob->argv; /* Check if global handler is configured and pass it down to crun context */ con->handler = glob->handler; ret = libcrun_init_logging (&con->output_handler, &con->output_handler_arg, id, glob->log, err); if (UNLIKELY (ret < 0)) return ret; if (glob->log_format) { ret = libcrun_set_log_format (glob->log_format, err); if (UNLIKELY (ret < 0)) return ret; } if (con->bundle == NULL) con->bundle = "."; con->handler_manager = libcrun_get_handler_manager (); return 0; } enum { COMMAND_CREATE = 1000, COMMAND_DELETE, COMMAND_EXEC, COMMAND_LIST, COMMAND_KILL, COMMAND_RUN, COMMAND_SPEC, COMMAND_START, COMMAND_STATE, COMMAND_UPDATE, COMMAND_PAUSE, COMMAND_UNPAUSE, COMMAND_FEATURES, COMMAND_PS, COMMAND_CHECKPOINT, COMMAND_RESTORE, }; struct commands_s commands[] = { { COMMAND_CREATE, "create", crun_command_create }, { COMMAND_DELETE, "delete", crun_command_delete }, { COMMAND_EXEC, "exec", crun_command_exec }, { COMMAND_LIST, "list", crun_command_list }, { COMMAND_KILL, "kill", crun_command_kill }, { COMMAND_PS, "ps", crun_command_ps }, { COMMAND_RUN, "run", crun_command_run }, { COMMAND_SPEC, "spec", crun_command_spec }, { COMMAND_START, "start", crun_command_start }, { COMMAND_STATE, "state", crun_command_state }, { COMMAND_UPDATE, "update", crun_command_update }, { COMMAND_PAUSE, "pause", crun_command_pause }, { COMMAND_UNPAUSE, "resume", crun_command_unpause }, { COMMAND_FEATURES, "features", crun_command_features }, #if HAVE_CRIU && HAVE_DLOPEN { COMMAND_CHECKPOINT, "checkpoint", crun_command_checkpoint }, { COMMAND_RESTORE, "restore", crun_command_restore }, #endif { 0, } }; static char doc[] = "\nCOMMANDS:\n" #if HAVE_CRIU && HAVE_DLOPEN "\tcheckpoint - checkpoint a container\n" #endif "\tcreate - create a container\n" "\tdelete - remove definition for a container\n" "\texec - exec a command in a running container\n" "\tfeatures - show the enabled features\n" "\tlist - list known containers\n" "\tkill - send a signal to the container init process\n" "\tps - show the processes in the container\n" #if HAVE_CRIU && HAVE_DLOPEN "\trestore - restore a container\n" #endif "\trun - run a container\n" "\tspec - generate a configuration file\n" "\tstart - start a container\n" "\tstate - output the state of a container\n" "\tpause - pause all the processes in the container\n" "\tresume - unpause the processes in the container\n" "\tupdate - update container resource constraints\n"; static char args_doc[] = "COMMAND [OPTION...]"; static struct commands_s * get_command (const char *arg) { struct commands_s *it; for (it = commands; it->value; it++) if (strcmp (it->name, arg) == 0) return it; return NULL; } enum { OPTION_VERSION = 'v', OPTION_VERSION_CAP = 'V', OPTION_DEBUG = 1000, OPTION_SYSTEMD_CGROUP, OPTION_CGROUP_MANAGER, OPTION_LOG, OPTION_LOG_FORMAT, OPTION_ROOT, OPTION_ROOTLESS }; const char *argp_program_bug_address = "https://github.com/containers/crun/issues"; static struct argp_option options[] = { { "debug", OPTION_DEBUG, 0, 0, "produce verbose output", 0 }, { "cgroup-manager", OPTION_CGROUP_MANAGER, "MANAGER", 0, "cgroup manager", 0 }, { "systemd-cgroup", OPTION_SYSTEMD_CGROUP, 0, 0, "use systemd cgroups", 0 }, { "log", OPTION_LOG, "FILE", 0, NULL, 0 }, { "log-format", OPTION_LOG_FORMAT, "FORMAT", 0, NULL, 0 }, { "root", OPTION_ROOT, "DIR", 0, NULL, 0 }, { "rootless", OPTION_ROOT, "VALUE", 0, NULL, 0 }, { "version", OPTION_VERSION, 0, 0, NULL, 0 }, // alias OPTION_VERSION_CAP with OPTION_VERSION { NULL, OPTION_VERSION_CAP, 0, OPTION_ALIAS, NULL, 0 }, { 0, } }; static void print_version (FILE *stream, struct argp_state *state arg_unused) { cleanup_free char *rundir = libcrun_get_state_directory (arguments.root, NULL); fprintf (stream, "%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION); fprintf (stream, "commit: %s\n", GIT_VERSION); fprintf (stream, "rundir: %s\n", rundir); fprintf (stream, "spec: 1.0.0\n"); #ifdef HAVE_SYSTEMD fprintf (stream, "+SYSTEMD "); #endif fprintf (stream, "+SELINUX "); fprintf (stream, "+APPARMOR "); #ifdef HAVE_CAP fprintf (stream, "+CAP "); #endif #ifdef HAVE_SECCOMP fprintf (stream, "+SECCOMP "); #endif #ifdef HAVE_EBPF fprintf (stream, "+EBPF "); #endif #ifdef HAVE_CRIU fprintf (stream, "+CRIU "); #endif libcrun_handler_manager_print_feature_tags (libcrun_get_handler_manager (), stream); fprintf (stream, "+YAJL\n"); } static error_t parse_opt (int key, char *arg, struct argp_state *state) { const char *tmp; switch (key) { case OPTION_DEBUG: arguments.debug = true; break; case OPTION_CGROUP_MANAGER: tmp = argp_mandatory_argument (arg, state); if (strcmp (tmp, "systemd") == 0) { arguments.option_force_no_cgroup = false; arguments.option_systemd_cgroup = true; } else if (strcmp (tmp, "cgroupfs") == 0) { arguments.option_force_no_cgroup = false; arguments.option_systemd_cgroup = false; } else if (strcmp (tmp, "disabled") == 0) { arguments.option_systemd_cgroup = false; arguments.option_force_no_cgroup = true; } else { libcrun_fail_with_error (0, "unknown cgroup manager specified"); } break; case OPTION_SYSTEMD_CGROUP: arguments.option_force_no_cgroup = false; arguments.option_systemd_cgroup = true; break; case OPTION_LOG: arguments.log = argp_mandatory_argument (arg, state); break; case OPTION_LOG_FORMAT: arguments.log_format = argp_mandatory_argument (arg, state); break; case OPTION_ROOT: arguments.root = argp_mandatory_argument (arg, state); break; case OPTION_ROOTLESS: /* Ignored. So that a runc command line won't fail. */ break; case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a command"); case OPTION_VERSION: case OPTION_VERSION_CAP: print_version (stdout, state); exit (EXIT_SUCCESS); default: return ARGP_ERR_UNKNOWN; } return 0; } static struct commands_s *command; void crun_assert_n_args (int n, int min, int max) { if (min >= 0 && n < min) error (EXIT_FAILURE, 0, "`%s` requires a minimum of %d arguments", command->name, min); if (max >= 0 && n > max) error (EXIT_FAILURE, 0, "`%s` requires a maximum of %d arguments", command->name, max); } char * argp_mandatory_argument (char *arg, struct argp_state *state) { if (arg) return arg; return state->argv[state->next++]; } static struct argp argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int ensure_cloned_binary (void); static void fill_handler_from_argv0 (char *argv0, struct crun_global_arguments *args) { const char *b = basename (argv0); #ifdef HAVE_LIBKRUN if (strcmp (b, "krun") == 0) { args->handler = "krun"; return; } #endif if (has_prefix (b, "crun-") && b[5] != '\0') args->handler = b + 5; } int main (int argc, char **argv) { libcrun_error_t err = NULL; int ret, first_argument = 0; arguments.argc = argc; arguments.argv = argv; #ifdef DYNLOAD_LIBCRUN if (ensure_cloned_binary () < 0) { fprintf (stderr, "Failed to re-execute libcrun via memory file descriptor\n"); _exit (EXIT_FAILURE); } /* Resolve all libcrun weak dependencies. */ if (dlopen ("libcrun.so", RTLD_GLOBAL | RTLD_DEEPBIND | RTLD_LAZY) == NULL) error (EXIT_FAILURE, 0, "dlopen: %s", dlerror ()); #endif fill_handler_from_argv0 (argv[0], &arguments); argp_parse (&argp, argc, argv, ARGP_IN_ORDER, &first_argument, &arguments); command = get_command (argv[first_argument]); if (command == NULL) libcrun_fail_with_error (0, "unknown command %s", argv[first_argument]); if (arguments.debug) libcrun_set_verbosity (LIBCRUN_VERBOSITY_WARNING); ret = command->handler (&arguments, argc - first_argument, argv + first_argument, &err); if (ret && err) libcrun_fail_with_error (err->status, "%s", err->msg); return ret; } crun-1.16.1/src/run.c0000644000000000000000000001264214654642544012517 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2020 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/utils.h" static char doc[] = "OCI runtime"; enum { OPTION_CONSOLE_SOCKET = 1000, OPTION_PID_FILE, OPTION_NO_SUBREAPER, OPTION_NO_NEW_KEYRING, OPTION_PRESERVE_FDS, OPTION_NO_PIVOT, OPTION_KEEP, }; static const char *bundle = NULL; static bool keep = false; static libcrun_context_t crun_context; static struct argp_option options[] = { { "bundle", 'b', "DIR", 0, "container bundle (default \".\")", 0 }, { "config", 'f', "FILE", 0, "override the config file name", 0 }, { "detach", 'd', 0, 0, "detach from the parent", 0 }, { "console-socket", OPTION_CONSOLE_SOCKET, "SOCKET", 0, "path to a socket that will receive the ptmx end of the tty", 0 }, { "preserve-fds", OPTION_PRESERVE_FDS, "N", 0, "pass additional FDs to the container", 0 }, { "pid-file", OPTION_PID_FILE, "FILE", 0, "where to write the PID of the container", 0 }, { "keep", OPTION_KEEP, 0, 0, "do not delete the container after it exits", 0 }, { "no-subreaper", OPTION_NO_SUBREAPER, 0, 0, "do not create a subreaper process (ignored)", 0 }, { "no-new-keyring", OPTION_NO_NEW_KEYRING, 0, 0, "keep the same session key", 0 }, { "no-pivot", OPTION_NO_PIVOT, 0, 0, "do not use pivot_root", 0 }, { 0, } }; static char args_doc[] = "run [OPTION]... CONTAINER"; static const char *config_file = "config.json"; static error_t parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { case 'd': crun_context.detach = true; break; case 'f': config_file = argp_mandatory_argument (arg, state); break; case 'b': bundle = crun_context.bundle = argp_mandatory_argument (arg, state); break; case OPTION_KEEP: keep = true; break; case OPTION_CONSOLE_SOCKET: crun_context.console_socket = argp_mandatory_argument (arg, state); break; case OPTION_PRESERVE_FDS: crun_context.preserve_fds = strtoll (argp_mandatory_argument (arg, state), NULL, 10); break; case OPTION_NO_SUBREAPER: break; case OPTION_NO_NEW_KEYRING: crun_context.no_new_keyring = true; break; case OPTION_PID_FILE: crun_context.pid_file = argp_mandatory_argument (arg, state); break; case OPTION_NO_PIVOT: crun_context.no_pivot = true; break; case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_run (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg = 0, ret; cleanup_container libcrun_container_t *container = NULL; cleanup_free char *bundle_cleanup = NULL; cleanup_free char *config_file_cleanup = NULL; crun_context.preserve_fds = 0; crun_context.listen_fds = 0; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &crun_context); crun_assert_n_args (argc - first_arg, 1, 1); /* Make sure the config is an absolute path before changing the directory. */ if ((strcmp ("config.json", config_file) != 0)) { if (config_file[0] != '/') { config_file_cleanup = realpath (config_file, NULL); if (config_file_cleanup == NULL) libcrun_fail_with_error (errno, "realpath `%s` failed", config_file); config_file = config_file_cleanup; } } /* Make sure the bundle is an absolute path. */ if (bundle == NULL) bundle = bundle_cleanup = getcwd (NULL, 0); else { if (bundle[0] != '/') { bundle_cleanup = realpath (bundle, NULL); if (bundle_cleanup == NULL) libcrun_fail_with_error (errno, "realpath `%s` failed", bundle); bundle = bundle_cleanup; } if (chdir (bundle) < 0) libcrun_fail_with_error (errno, "chdir `%s` failed", bundle); } container = libcrun_container_load_from_file (config_file, err); if (container == NULL) return -1; ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; crun_context.bundle = bundle; if (getenv ("LISTEN_FDS")) { crun_context.listen_fds = strtoll (getenv ("LISTEN_FDS"), NULL, 10); crun_context.preserve_fds += crun_context.listen_fds; } return libcrun_container_run (&crun_context, container, keep ? LIBCRUN_RUN_OPTIONS_KEEP : 0, err); } crun-1.16.1/src/delete.c0000664000000000000000000000671114035072211013134 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/utils.h" #include "libcrun/status.h" static char doc[] = "OCI runtime"; enum { OPTION_CONSOLE_SOCKET = 1000, OPTION_PID_FILE, OPTION_NO_SUBREAPER, OPTION_NO_NEW_KEYRING, OPTION_PRESERVE_FDS }; struct delete_options_s { int regex; bool force; }; static struct delete_options_s delete_options; static struct argp_option options[] = { { "force", 'f', 0, 0, "delete the container even if it is still running", 0 }, { "regex", 'r', 0, 0, "the specified CONTAINER is a regular expression (delete multiple containers)", 0 }, { 0, } }; static char args_doc[] = "delete CONTAINER"; static error_t parse_opt (int key, char *arg arg_unused, struct argp_state *state arg_unused) { switch (key) { case 'f': delete_options.force = true; break; case 'r': delete_options.regex = true; break; case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_delete (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg = 0, ret; libcrun_context_t crun_context = { 0, }; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &delete_options); crun_assert_n_args (argc - first_arg, 1, 1); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; if (delete_options.regex) { regex_t re; libcrun_container_list_t *list, *it; ret = regcomp (&re, argv[first_arg], REG_EXTENDED | REG_NOSUB); if (UNLIKELY (ret < 0)) libcrun_fail_with_error (0, "invalid regular expression %s", argv[first_arg]); ret = libcrun_get_containers_list (&list, crun_context.state_root, err); if (UNLIKELY (ret < 0)) libcrun_fail_with_error (0, "cannot read containers list"); for (it = list; it; it = it->next) if (regexec (&re, it->name, 0, NULL, 0) == 0) { ret = libcrun_container_delete (&crun_context, NULL, it->name, delete_options.force, err); if (UNLIKELY (ret < 0)) libcrun_error_write_warning_and_release (stderr, &err); } libcrun_free_containers_list (list); regfree (&re); return 0; } return libcrun_container_delete (&crun_context, NULL, argv[first_arg], delete_options.force, err); } crun-1.16.1/src/kill.c0000644000000000000000000000713714406334420012633 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/status.h" #include "libcrun/utils.h" static char doc[] = "OCI runtime"; enum { OPTION_CONSOLE_SOCKET = 1000, OPTION_PID_FILE, OPTION_NO_SUBREAPER, OPTION_NO_NEW_KEYRING, OPTION_PRESERVE_FDS }; struct kill_options_s { bool all; bool regex; }; static struct kill_options_s kill_options; static struct argp_option options[] = { { "all", 'a', 0, 0, "kill all the processes", 0 }, { "regex", 'r', 0, 0, "the specified CONTAINER is a regular expression (kill multiple containers)", 0 }, { 0, } }; static char args_doc[] = "kill CONTAINER [SIGNAL]"; static error_t parse_opt (int key, char *arg arg_unused, struct argp_state *state arg_unused) { switch (key) { case 'a': kill_options.all = true; break; case 'r': kill_options.regex = true; break; case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_kill (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg = 0, ret; const char *signal; libcrun_context_t crun_context = { 0, }; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &kill_options); crun_assert_n_args (argc - first_arg, 1, 2); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; signal = "SIGTERM"; if (argc - first_arg > 1) signal = argv[first_arg + 1]; if (kill_options.regex) { regex_t re; libcrun_container_list_t *list, *it; ret = regcomp (&re, argv[first_arg], REG_EXTENDED | REG_NOSUB); if (UNLIKELY (ret < 0)) libcrun_fail_with_error (0, "invalid regular expression %s", argv[first_arg]); ret = libcrun_get_containers_list (&list, crun_context.state_root, err); if (UNLIKELY (ret < 0)) libcrun_fail_with_error (0, "cannot read containers list"); for (it = list; it; it = it->next) if (regexec (&re, it->name, 0, NULL, 0) == 0) { ret = libcrun_container_kill (&crun_context, it->name, signal, err); if (UNLIKELY (ret < 0)) libcrun_error_write_warning_and_release (stderr, &err); } libcrun_free_containers_list (list); regfree (&re); return 0; } if (kill_options.all) return libcrun_container_killall (&crun_context, argv[first_arg], signal, err); return libcrun_container_kill (&crun_context, argv[first_arg], signal, err); } crun-1.16.1/src/pause.c0000664000000000000000000000407514035072211013010 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/status.h" #include "libcrun/utils.h" static char doc[] = "OCI runtime"; struct pause_options_s { }; static struct pause_options_s pause_options; static struct argp_option options[] = { { 0, } }; static char args_doc[] = "pause CONTAINER"; static error_t parse_opt (int key, char *arg arg_unused, struct argp_state *state arg_unused) { switch (key) { case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_pause (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg = 0, ret; libcrun_context_t crun_context = { 0, }; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &pause_options); crun_assert_n_args (argc - first_arg, 1, 2); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; return libcrun_container_pause (&crun_context, argv[first_arg], err); } crun-1.16.1/src/unpause.c0000664000000000000000000000411214035072211013343 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/status.h" #include "libcrun/utils.h" static char doc[] = "OCI runtime"; struct unpause_options_s { }; static struct unpause_options_s unpause_options; static struct argp_option options[] = { { 0, } }; static char args_doc[] = "resume CONTAINER"; static error_t parse_opt (int key, char *arg arg_unused, struct argp_state *state arg_unused) { switch (key) { case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_unpause (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg = 0, ret; libcrun_context_t crun_context = { 0, }; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &unpause_options); crun_assert_n_args (argc - first_arg, 1, 2); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; return libcrun_container_unpause (&crun_context, argv[first_arg], err); } crun-1.16.1/src/oci_features.c0000644000000000000000000002161514614667631014363 0ustar0000000000000000/* * crun - OCI runtime written in C * * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/utils.h" static char doc[] = "OCI runtime"; static struct argp_option options[] = { { 0 } }; static char args_doc[] = "features"; const unsigned char *json_string; size_t json_length; static error_t parse_opt (int key, char *arg arg_unused, struct argp_state *state arg_unused) { if (key != ARGP_KEY_NO_ARGS) { return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; void add_string_to_json (yajl_gen json_gen, const char *key, char *value) { yajl_gen_string (json_gen, (const unsigned char *) key, strlen (key)); yajl_gen_string (json_gen, (const unsigned char *) value, strlen (value)); } void add_bool_to_json (yajl_gen json_gen, const char *key, int value) { yajl_gen_string (json_gen, (const unsigned char *) key, strlen (key)); yajl_gen_bool (json_gen, value); } void add_bool_str_to_json (yajl_gen json_gen, const char *key, int value) { char *val = ""; if (value) { val = "true"; } else { val = "false"; } yajl_gen_string (json_gen, (const unsigned char *) key, strlen (key)); yajl_gen_string (json_gen, (const unsigned char *) val, strlen (val)); } void add_array_to_json (yajl_gen json_gen, const char *key, char **array) { size_t i; yajl_gen_string (json_gen, (const unsigned char *) key, strlen (key)); yajl_gen_array_open (json_gen); for (i = 0; array[i] != NULL; i++) yajl_gen_string (json_gen, (const unsigned char *) array[i], strlen (array[i])); yajl_gen_array_close (json_gen); } void crun_features_add_hooks (yajl_gen json_gen, char **hooks) { add_array_to_json (json_gen, "hooks", hooks); } void crun_features_add_mount_options (yajl_gen json_gen, char **mount_options) { add_array_to_json (json_gen, "mountOptions", mount_options); } void crun_features_add_namespaces (yajl_gen json_gen, const struct linux_info_s *linux) { add_array_to_json (json_gen, "namespaces", linux->namespaces); } void crun_features_add_capabilities (yajl_gen json_gen, const struct linux_info_s *linux) { add_array_to_json (json_gen, "capabilities", linux->capabilities); } void crun_features_add_cgroup_info (yajl_gen json_gen, const struct linux_info_s *linux) { yajl_gen_string (json_gen, (const unsigned char *) "cgroup", strlen ("cgroup")); yajl_gen_map_open (json_gen); add_bool_to_json (json_gen, "v1", linux->cgroup.v1); add_bool_to_json (json_gen, "v2", linux->cgroup.v2); add_bool_to_json (json_gen, "systemd", linux->cgroup.systemd); add_bool_to_json (json_gen, "systemdUser", linux->cgroup.systemd_user); yajl_gen_map_close (json_gen); } void crun_features_add_seccomp_info (yajl_gen json_gen, const struct linux_info_s *linux) { yajl_gen_string (json_gen, (const unsigned char *) "seccomp", strlen ("seccomp")); yajl_gen_map_open (json_gen); add_bool_to_json (json_gen, "enabled", linux->seccomp.enabled); add_array_to_json (json_gen, "actions", linux->seccomp.actions); add_array_to_json (json_gen, "operators", linux->seccomp.operators); yajl_gen_map_close (json_gen); } void crun_features_add_apparmor_info (yajl_gen json_gen, const struct linux_info_s *linux) { yajl_gen_string (json_gen, (const unsigned char *) "apparmor", strlen ("apparmor")); yajl_gen_map_open (json_gen); add_bool_to_json (json_gen, "enabled", linux->apparmor.enabled); yajl_gen_map_close (json_gen); } void crun_features_add_selinux_info (yajl_gen json_gen, const struct linux_info_s *linux) { yajl_gen_string (json_gen, (const unsigned char *) "selinux", strlen ("selinux")); yajl_gen_map_open (json_gen); add_bool_to_json (json_gen, "enabled", linux->selinux.enabled); yajl_gen_map_close (json_gen); } void crun_features_add_mount_ext_info (yajl_gen json_gen, const struct linux_info_s *linux) { yajl_gen_string (json_gen, (const unsigned char *) "mountExtensions", strlen ("mountExtensions")); yajl_gen_map_open (json_gen); yajl_gen_string (json_gen, (const unsigned char *) "idmap", strlen ("idmap")); yajl_gen_map_open (json_gen); add_bool_to_json (json_gen, "enabled", linux->mount_ext.idmap.enabled); yajl_gen_map_close (json_gen); yajl_gen_map_close (json_gen); } void crun_features_add_intel_rdt (yajl_gen json_gen, const struct linux_info_s *linux) { yajl_gen_string (json_gen, (const unsigned char *) "intelRdt", strlen ("intelRdt")); yajl_gen_map_open (json_gen); add_bool_to_json (json_gen, "enabled", linux->intel_rdt.enabled); yajl_gen_map_close (json_gen); } void crun_features_add_linux_info (yajl_gen json_gen, const struct linux_info_s *linux) { yajl_gen_string (json_gen, (const unsigned char *) "linux", strlen ("linux")); yajl_gen_map_open (json_gen); crun_features_add_namespaces (json_gen, linux); crun_features_add_capabilities (json_gen, linux); crun_features_add_cgroup_info (json_gen, linux); crun_features_add_seccomp_info (json_gen, linux); crun_features_add_apparmor_info (json_gen, linux); crun_features_add_selinux_info (json_gen, linux); crun_features_add_mount_ext_info (json_gen, linux); crun_features_add_intel_rdt (json_gen, linux); yajl_gen_map_close (json_gen); } void crun_features_add_annotations_info (yajl_gen json_gen, const struct annotations_info_s *annotation) { yajl_gen_string (json_gen, (const unsigned char *) "annotations", strlen ("annotations")); yajl_gen_map_open (json_gen); add_string_to_json (json_gen, "io.github.seccomp.libseccomp.version", annotation->io_github_seccomp_libseccomp_version); add_bool_str_to_json (json_gen, "org.opencontainers.runc.checkpoint.enabled", annotation->run_oci_crun_checkpoint_enabled); add_bool_str_to_json (json_gen, "run.oci.crun.checkpoint.enabled", annotation->run_oci_crun_checkpoint_enabled); add_string_to_json (json_gen, "run.oci.crun.commit", annotation->run_oci_crun_commit); add_string_to_json (json_gen, "run.oci.crun.version", annotation->run_oci_crun_version); add_bool_str_to_json (json_gen, "run.oci.crun.wasm", annotation->run_oci_crun_wasm); yajl_gen_map_close (json_gen); } void crun_features_add_potentially_unsafe_config_annotations_info (yajl_gen json_gen, char **annotations) { add_array_to_json (json_gen, "potentiallyUnsafeConfigAnnotations", annotations); } int crun_command_features (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { cleanup_struct_features struct features_info_s *info = NULL; int first_arg = 0, ret = 0; libcrun_context_t crun_context = { 0, }; yajl_gen json_gen; argp_parse (&run_argp, argc, argv, 0, 0, &options); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; // Call the function in features.c to gather the feature information ret = libcrun_container_get_features (&crun_context, &info, err); if (UNLIKELY (ret < 0)) return ret; // Prepare the JSON output json_gen = yajl_gen_alloc (NULL); if (json_gen == NULL) return libcrun_make_error (err, 0, "Failed to initialize json structure"); yajl_gen_config (json_gen, yajl_gen_beautify, 1); // Optional: Enable pretty formatting // Start building the JSON yajl_gen_map_open (json_gen); // Add ociVersionMin field add_string_to_json (json_gen, "ociVersionMin", info->oci_version_min); // Add ociVersionMax field add_string_to_json (json_gen, "ociVersionMax", info->oci_version_max); // Add hooks array crun_features_add_hooks (json_gen, info->hooks); // Add mountOptions array crun_features_add_mount_options (json_gen, info->mount_options); // Add linux struct info crun_features_add_linux_info (json_gen, &info->linux); // Add annotations struct info crun_features_add_annotations_info (json_gen, &info->annotations); // Add potentially unsafe config annotatinos info crun_features_add_potentially_unsafe_config_annotations_info (json_gen, info->potentially_unsafe_annotations); // End building the JSON yajl_gen_map_close (json_gen); yajl_gen_get_buf (json_gen, &json_string, &json_length); printf ("%s", (const char *) json_string); yajl_gen_free (json_gen); return 0; } crun-1.16.1/src/spec.c0000644000000000000000000000702114551252466012634 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/utils.h" static char doc[] = "OCI runtime"; struct spec_options_s { bool rootless; }; enum { OPTION_ROOTLESS = 1000 }; static const char *bundle; static const char *fname; static struct spec_options_s spec_options; static struct argp_option options[] = { { "bundle", 'b', "DIR", 0, "path to the root of the bundle dir (default \".\")", 0 }, { "file", 'f', "PATH", 0, "destination file", 0 }, { "rootless", OPTION_ROOTLESS, 0, 0, "spec for the rootless case", 0 }, { 0, } }; static char args_doc[] = "spec"; static error_t parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { case 'b': bundle = argp_mandatory_argument (arg, state); break; case 'f': fname = argp_mandatory_argument (arg, state); break; case OPTION_ROOTLESS: spec_options.rootless = true; break; default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_spec (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg; libcrun_context_t crun_context = { 0, }; cleanup_file FILE *f = NULL; cleanup_free char *bundle_cleanup = NULL; const char *where; int ret; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &spec_options); crun_assert_n_args (argc - first_arg, 0, 0); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; /* Change dir only if -b or --bundle is defined and make sure the bundle is an absolute path. */ if (bundle != NULL) { if (bundle[0] != '/') { bundle_cleanup = realpath (bundle, NULL); if (bundle_cleanup == NULL) libcrun_fail_with_error (errno, "realpath `%s` failed", bundle); bundle = bundle_cleanup; } if (chdir (bundle) < 0) libcrun_fail_with_error (errno, "chdir `%s` failed", bundle); } where = fname ? fname : "config.json"; if (fname == NULL) { ret = access (where, F_OK); if (ret == 0) return libcrun_make_error (err, 0, "`%s` already exists", where); } f = fopen (where, "w+e"); if (f == NULL) return libcrun_make_error (err, errno, "cannot open `%s`", where); ret = libcrun_container_spec (! spec_options.rootless, f, err); return ret >= 0 ? 0 : ret; } crun-1.16.1/src/exec.c0000644000000000000000000002401114406334420012612 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/utils.h" #include "libcrun/linux.h" static char doc[] = "OCI runtime"; struct exec_options_s { bool tty; bool detach; bool no_new_privs; int preserve_fds; const char *process; const char *console_socket; const char *pid_file; char *process_label; char *apparmor; char *cwd; char *user; char **env; char **cap; size_t cap_size; size_t env_size; char *cgroup; }; enum { OPTION_CONSOLE_SOCKET = 1000, OPTION_PID_FILE, OPTION_CWD, OPTION_PRESERVE_FDS, OPTION_NO_NEW_PRIVS, OPTION_PROCESS_LABEL, OPTION_APPARMOR, OPTION_CGROUP, }; static struct exec_options_s exec_options; static struct argp_option options[] = { { "console-socket", OPTION_CONSOLE_SOCKET, "SOCKET", 0, "path to a socket that will receive the ptmx end of the tty", 0 }, { "tty", 't', "TTY", OPTION_ARG_OPTIONAL, "allocate a pseudo-TTY", 0 }, { "process", 'p', "FILE", 0, "path to the process.json", 0 }, { "cwd", OPTION_CWD, "CWD", 0, "current working directory", 0 }, { "cgroup", OPTION_CGROUP, "PATH", 0, "sub-cgroup in the container", 0 }, { "detach", 'd', 0, 0, "detach the command in the background", 0 }, { "user", 'u', "USERSPEC", 0, "specify the user in the form UID[:GID]", 0 }, { "env", 'e', "ENV", 0, "add an environment variable", 0 }, { "cap", 'c', "CAP", 0, "add a capability", 0 }, { "pid-file", OPTION_PID_FILE, "FILE", 0, "where to write the PID of the container", 0 }, { "preserve-fds", OPTION_PRESERVE_FDS, "N", 0, "pass additional FDs to the container", 0 }, { "no-new-privs", OPTION_NO_NEW_PRIVS, 0, 0, "set the no new privileges value for the process", 0 }, { "process-label", OPTION_PROCESS_LABEL, "VALUE", 0, "set the asm process label for the process commonly used with selinux", 0 }, { "apparmor", OPTION_APPARMOR, "VALUE", 0, "set the apparmor profile for the process", 0 }, { 0, } }; static char args_doc[] = "exec CONTAINER cmd"; static void append_env (const char *arg) { exec_options.env = realloc (exec_options.env, (exec_options.env_size + 2) * sizeof (*exec_options.env)); if (exec_options.env == NULL) error (EXIT_FAILURE, errno, "cannot allocate memory"); exec_options.env[exec_options.env_size + 1] = NULL; exec_options.env[exec_options.env_size] = xstrdup (arg); exec_options.env_size++; } static void append_cap (const char *arg) { exec_options.cap = realloc (exec_options.cap, (exec_options.cap_size + 2) * sizeof (*exec_options.cap)); if (exec_options.cap == NULL) error (EXIT_FAILURE, errno, "cannot allocate memory"); exec_options.cap[exec_options.cap_size + 1] = NULL; exec_options.cap[exec_options.cap_size] = xstrdup (arg); exec_options.cap_size++; } static char ** dup_array (char **arr, size_t len) { size_t i; char **ret; ret = malloc (sizeof (char *) * (len + 1)); if (ret == NULL) error (EXIT_FAILURE, errno, "cannot allocate memory"); for (i = 0; i < len; i++) ret[i] = xstrdup (arr[i]); ret[i] = NULL; return ret; } static error_t parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { case OPTION_CONSOLE_SOCKET: exec_options.console_socket = arg; break; case OPTION_PID_FILE: exec_options.pid_file = arg; break; case OPTION_NO_NEW_PRIVS: exec_options.no_new_privs = true; break; case OPTION_PROCESS_LABEL: exec_options.process_label = argp_mandatory_argument (arg, state); break; case OPTION_APPARMOR: exec_options.apparmor = argp_mandatory_argument (arg, state); break; case OPTION_PRESERVE_FDS: exec_options.preserve_fds = strtoul (argp_mandatory_argument (arg, state), NULL, 10); break; case OPTION_CGROUP: exec_options.cgroup = argp_mandatory_argument (arg, state); break; case 'd': exec_options.detach = true; break; case 'p': exec_options.process = arg; break; case 't': exec_options.tty = arg == NULL || (strcmp (arg, "false") != 0 && strcmp (arg, "no") != 0); break; case 'u': exec_options.user = arg; break; case 'e': append_env (arg); break; case 'c': append_cap (arg); break; case OPTION_CWD: exec_options.cwd = xstrdup (arg); break; case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; static runtime_spec_schema_config_schema_process_user * make_oci_process_user (const char *userspec) { runtime_spec_schema_config_schema_process_user *u; char *endptr = NULL; if (userspec == NULL) return NULL; u = xmalloc0 (sizeof (runtime_spec_schema_config_schema_process_user)); errno = 0; u->uid = strtol (userspec, &endptr, 10); if (errno == ERANGE) libcrun_fail_with_error (0, "invalid UID specified"); if (*endptr == '\0') return u; if (*endptr != ':') libcrun_fail_with_error (0, "invalid USERSPEC specified"); errno = 0; u->gid = strtol (endptr + 1, &endptr, 10); if (errno == ERANGE) libcrun_fail_with_error (0, "invalid GID specified"); if (*endptr != '\0') libcrun_fail_with_error (0, "invalid USERSPEC specified"); return u; } #define cleanup_process_schema __attribute__ ((cleanup (cleanup_process_schemap))) #ifdef SHARED_LIBCRUN void __attribute__ ((weak)) free_runtime_spec_schema_config_schema_process (runtime_spec_schema_config_schema_process *ptr); #endif static inline void cleanup_process_schemap (runtime_spec_schema_config_schema_process **p) { runtime_spec_schema_config_schema_process *process = *p; if (process) (void) free_runtime_spec_schema_config_schema_process (process); } int crun_command_exec (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg = 0, ret = 0; libcrun_context_t crun_context = { 0, }; cleanup_process_schema runtime_spec_schema_config_schema_process *process = NULL; struct libcrun_container_exec_options_s exec_opts; memset (&exec_opts, 0, sizeof (exec_opts)); exec_opts.struct_size = sizeof (exec_opts); crun_context.preserve_fds = 0; crun_context.listen_fds = 0; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &exec_options); crun_assert_n_args (argc - first_arg, exec_options.process ? 1 : 2, -1); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; crun_context.detach = exec_options.detach; crun_context.console_socket = exec_options.console_socket; crun_context.pid_file = exec_options.pid_file; crun_context.preserve_fds = exec_options.preserve_fds; if (getenv ("LISTEN_FDS")) { crun_context.listen_fds = strtoll (getenv ("LISTEN_FDS"), NULL, 10); crun_context.preserve_fds += crun_context.listen_fds; } if (exec_options.process) exec_opts.path = exec_options.process; else { process = xmalloc0 (sizeof (*process)); int i; process->args_len = argc; process->args = xmalloc0 ((argc + 1) * sizeof (*process->args)); for (i = 0; i < argc - first_arg; i++) process->args[i] = xstrdup (argv[first_arg + i + 1]); process->args[i] = NULL; if (exec_options.cwd) process->cwd = exec_options.cwd; process->terminal = exec_options.tty; process->env = exec_options.env; process->env_len = exec_options.env_size; process->user = make_oci_process_user (exec_options.user); if (exec_options.process_label != NULL) process->selinux_label = xstrdup (exec_options.process_label); if (exec_options.apparmor != NULL) process->apparmor_profile = xstrdup (exec_options.apparmor); if (exec_options.cap_size > 0) { runtime_spec_schema_config_schema_process_capabilities *capabilities = xmalloc (sizeof (runtime_spec_schema_config_schema_process_capabilities)); capabilities->effective = exec_options.cap; capabilities->effective_len = exec_options.cap_size; capabilities->inheritable = NULL; capabilities->inheritable_len = 0; capabilities->bounding = dup_array (exec_options.cap, exec_options.cap_size); capabilities->bounding_len = exec_options.cap_size; capabilities->ambient = dup_array (exec_options.cap, exec_options.cap_size); capabilities->ambient_len = exec_options.cap_size; capabilities->permitted = dup_array (exec_options.cap, exec_options.cap_size); capabilities->permitted_len = exec_options.cap_size; process->capabilities = capabilities; } // noNewPriviledges will remain `false` if basespec has `false` unless specified // Default is always `true` in generated basespec config if (exec_options.no_new_privs) process->no_new_privileges = 1; exec_opts.process = process; } exec_opts.cgroup = exec_options.cgroup; return libcrun_container_exec_with_options (&crun_context, argv[first_arg], &exec_opts, err); } crun-1.16.1/src/list.c0000644000000000000000000001044114551252466012655 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/utils.h" #include "libcrun/status.h" static char doc[] = "OCI runtime"; enum { OPTION_CONSOLE_SOCKET = 1000, OPTION_PID_FILE, OPTION_NO_SUBREAPER, OPTION_NO_NEW_KEYRING, OPTION_PRESERVE_FDS }; struct list_options_s { bool quiet; int format; }; enum { LIST_TABLE = 100, LIST_JSON, }; static struct list_options_s list_options; static struct argp_option options[] = { { "quiet", 'q', 0, 0, "show only IDs", 0 }, { "format", 'f', "FORMAT", 0, "select one of: table or json (default: \"table\")", 0 }, { 0, } }; static char args_doc[] = "list"; static error_t parse_opt (int key, char *arg, struct argp_state *state arg_unused) { switch (key) { case 'q': list_options.quiet = true; break; case 'f': if (strcmp (arg, "table") == 0) list_options.format = LIST_TABLE; else if (strcmp (arg, "json") == 0) list_options.format = LIST_JSON; else error (EXIT_FAILURE, 0, "invalid format `%s`", arg); break; default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_list (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg; int ret, max_length = 4; libcrun_context_t crun_context = { 0, }; libcrun_container_list_t *list = NULL, *it; list_options.format = LIST_TABLE; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &list_options); crun_assert_n_args (argc - first_arg, 0, 0); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; if (list_options.format == LIST_JSON) return libcrun_write_json_containers_list (&crun_context, stdout, err); ret = libcrun_get_containers_list (&list, crun_context.state_root, err); if (UNLIKELY (ret < 0)) return ret; for (it = list; it; it = it->next) { int l = strlen (it->name); if (l > max_length) max_length = l; } max_length++; if (! list_options.quiet) printf ("%-*s%-10s%-8s %-39s %-30s %s\n", max_length, "NAME", "PID", "STATUS", "BUNDLE PATH", "CREATED", "OWNER"); for (it = list; it; it = it->next) { libcrun_container_status_t status; ret = libcrun_read_container_status (&status, crun_context.state_root, it->name, err); if (UNLIKELY (ret < 0)) { libcrun_error_write_warning_and_release (stderr, &err); continue; } if (list_options.quiet) printf ("%s\n", it->name); else { int running = 0; int pid = status.pid; const char *container_status = NULL; ret = libcrun_get_container_state_string (it->name, &status, crun_context.state_root, &container_status, &running, err); if (UNLIKELY (ret < 0)) { libcrun_error_write_warning_and_release (stderr, &err); continue; } if (! running) pid = 0; printf ("%-*s%-10d%-8s %-39s %-30s %s\n", max_length, it->name, pid, container_status, status.bundle, status.created, status.owner); } libcrun_free_container_status (&status); } libcrun_free_containers_list (list); return ret >= 0 ? 0 : ret; } crun-1.16.1/src/create.c0000644000000000000000000001220114551252466013141 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2020 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/utils.h" enum { OPTION_CONSOLE_SOCKET = 1000, OPTION_PID_FILE, OPTION_NO_SUBREAPER, OPTION_NO_NEW_KEYRING, OPTION_PRESERVE_FDS, OPTION_NO_PIVOT }; static const char *bundle = NULL; static libcrun_context_t crun_context; static struct argp_option options[] = { { "bundle", 'b', "DIR", 0, "container bundle (default \".\")", 0 }, { "config", 'f', "FILE", 0, "override the config file name", 0 }, { "console-socket", OPTION_CONSOLE_SOCKET, "SOCK", 0, "path to a socket that will receive the ptmx end of the tty", 0 }, { "preserve-fds", OPTION_PRESERVE_FDS, "N", 0, "pass additional FDs to the container", 0 }, { "no-pivot", OPTION_NO_PIVOT, 0, 0, "do not use pivot_root", 0 }, { "pid-file", OPTION_PID_FILE, "FILE", 0, "where to write the PID of the container", 0 }, { "no-subreaper", OPTION_NO_SUBREAPER, 0, 0, "do not create a subreaper process (ignored)", 0 }, { "no-new-keyring", OPTION_NO_NEW_KEYRING, 0, 0, "keep the same session key", 0 }, { 0, } }; static char doc[] = "OCI runtime"; static char args_doc[] = "create [OPTION]... CONTAINER"; static const char *config_file = "config.json"; static error_t parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { case 'b': bundle = crun_context.bundle = argp_mandatory_argument (arg, state); break; case 'f': config_file = argp_mandatory_argument (arg, state); break; case OPTION_CONSOLE_SOCKET: crun_context.console_socket = argp_mandatory_argument (arg, state); break; case OPTION_PRESERVE_FDS: crun_context.preserve_fds = strtoul (argp_mandatory_argument (arg, state), NULL, 10); break; case OPTION_NO_SUBREAPER: break; case OPTION_NO_PIVOT: crun_context.no_pivot = true; break; case OPTION_NO_NEW_KEYRING: crun_context.no_new_keyring = true; break; case OPTION_PID_FILE: crun_context.pid_file = argp_mandatory_argument (arg, state); break; case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_create (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg = 0, ret; cleanup_container libcrun_container_t *container = NULL; cleanup_free char *bundle_cleanup = NULL; cleanup_free char *config_file_cleanup = NULL; crun_context.preserve_fds = 0; crun_context.listen_fds = 0; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &crun_context); crun_assert_n_args (argc - first_arg, 1, 1); /* Make sure the config is an absolute path before changing the directory. */ if ((strcmp ("config.json", config_file) != 0)) { if (config_file[0] != '/') { config_file_cleanup = realpath (config_file, NULL); if (config_file_cleanup == NULL) libcrun_fail_with_error (errno, "realpath `%s` failed", config_file); config_file = config_file_cleanup; } } /* Make sure the bundle is an absolute path. */ if (bundle == NULL) bundle = bundle_cleanup = getcwd (NULL, 0); else { if (bundle[0] != '/') { bundle_cleanup = realpath (bundle, NULL); if (bundle_cleanup == NULL) libcrun_fail_with_error (errno, "realpath `%s` failed", bundle); bundle = bundle_cleanup; } if (chdir (bundle) < 0) libcrun_fail_with_error (errno, "chdir `%s` failed", bundle); } ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; container = libcrun_container_load_from_file (config_file, err); if (container == NULL) libcrun_fail_with_error (0, "error loading config.json"); crun_context.bundle = bundle; if (getenv ("LISTEN_FDS")) { crun_context.listen_fds = strtoll (getenv ("LISTEN_FDS"), NULL, 10); crun_context.preserve_fds += crun_context.listen_fds; } return libcrun_container_create (&crun_context, container, 0, err); } crun-1.16.1/src/start.c0000664000000000000000000000407514035072211013030 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/utils.h" static char doc[] = "OCI runtime"; enum { OPTION_CONSOLE_SOCKET = 1000, OPTION_PID_FILE, OPTION_NO_SUBREAPER, OPTION_NO_NEW_KEYRING, OPTION_PRESERVE_FDS }; static struct argp_option options[] = { { 0, } }; static char args_doc[] = "start CONTAINER"; static error_t parse_opt (int key, char *arg arg_unused, struct argp_state *state arg_unused) { switch (key) { case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_start (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg = 0, ret; libcrun_context_t crun_context = { 0, }; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, NULL); crun_assert_n_args (argc - first_arg, 1, 1); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; return libcrun_container_start (&crun_context, argv[first_arg], err); } crun-1.16.1/src/state.c0000664000000000000000000000423114035072211013005 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/utils.h" static char doc[] = "OCI runtime"; enum { OPTION_CONSOLE_SOCKET = 1000, OPTION_PID_FILE, OPTION_NO_SUBREAPER, OPTION_NO_NEW_KEYRING, OPTION_PRESERVE_FDS }; struct state_options_s { }; static struct state_options_s state_options; static struct argp_option options[] = { { 0, } }; static char args_doc[] = "state CONTAINER"; static error_t parse_opt (int key, char *arg arg_unused, struct argp_state *state arg_unused) { switch (key) { case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_state (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg = 0, ret; libcrun_context_t crun_context = { 0, }; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &state_options); crun_assert_n_args (argc - first_arg, 1, 1); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; return libcrun_container_state (&crun_context, argv[first_arg], stdout, err); } crun-1.16.1/src/update.c0000644000000000000000000001571314514171717013171 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/utils.h" static char doc[] = "OCI runtime"; static char *resources = NULL; static libcrun_context_t crun_context; enum { FIRST_VALUE = 1000, BLKIO_WEIGHT = FIRST_VALUE, CPU_PERIOD, CPU_QUOTA, CPU_SHARE, CPU_RT_PERIOD, CPU_RT_RUNTIME, CPUSET_CPUS, CPUSET_MEMS, KERNEL_MEMORY, KERNEL_MEMORY_TCP, MEMORY, MEMORY_RESERVATION, MEMORY_SWAP, PIDS_LIMIT, /* not in the resources block. */ L3_CACHE_SCHEMA, MEM_BW_SCHEMA, LAST_VALUE, }; struct description_s { int id; const char *section; const char *name; int numeric; }; static struct description_s descriptors[] = { { BLKIO_WEIGHT, "blockIO", "weight", 1 }, { CPU_PERIOD, "cpu", "period", 1 }, { CPU_QUOTA, "cpu", "quota", 1 }, { CPU_SHARE, "cpu", "shares", 1 }, { CPU_RT_PERIOD, "cpu", "realtimePeriod", 1 }, { CPU_RT_RUNTIME, "cpu", "realtimeRuntime", 1 }, { CPUSET_CPUS, "cpu", "cpus", 0 }, { CPUSET_MEMS, "cpu", "mems", 0 }, { KERNEL_MEMORY, "memory", "kernel", 1 }, { KERNEL_MEMORY_TCP, "memory", "kernelTCP", 1 }, { MEMORY, "memory", "limit", 1 }, { MEMORY_RESERVATION, "memory", "reservation", 1 }, { MEMORY_SWAP, "memory", "swap", 1 }, { PIDS_LIMIT, "pids", "limit", 1 }, { 0 } }; static struct libcrun_update_value_s *values; size_t values_len = 0; static void set_value (int id, const char *value) { values = xrealloc (values, (values_len + 1) * sizeof (struct libcrun_update_value_s)); values[values_len].section = descriptors[id - FIRST_VALUE].section; values[values_len].name = descriptors[id - FIRST_VALUE].name; values[values_len].numeric = descriptors[id - FIRST_VALUE].numeric; values[values_len].value = value; values_len++; } static char *l3_cache_schema; static char *mem_bw_schema; static struct argp_option options[] = { { "resources", 'r', "FILE", 0, "path to the file containing the resources to update", 0 }, { "blkio-weight", BLKIO_WEIGHT, "VALUE", 0, "Specifies per cgroup weight", 0 }, { "cpu-period", CPU_PERIOD, "VALUE", 0, "CPU CFS period to be used for hardcapping", 0 }, { "cpu-quota", CPU_QUOTA, "VALUE", 0, "CPU CFS hardcap limit", 0 }, { "cpu-share", CPU_SHARE, "VALUE", 0, "CPU shares", 0 }, { "cpu-rt-period", CPU_RT_PERIOD, "VALUE", 0, "CPU realtime period to be used for hardcapping", 0 }, { "cpu-rt-runtime", CPU_RT_RUNTIME, "VALUE", 0, "CPU realtime hardcap limit", 0 }, { "cpuset-cpus", CPUSET_CPUS, "VALUE", 0, "CPU(s) to use", 0 }, { "cpuset-mems", CPUSET_MEMS, "VALUE", 0, "Memory node(s) to use", 0 }, { "kernel-memory", KERNEL_MEMORY, "VALUE", 0, "Kernel memory limit", 0 }, { "kernel-memory-tcp", KERNEL_MEMORY_TCP, "VALUE", 0, "Kernel memory limit for tcp buffer", 0 }, { "memory", MEMORY, "VALUE", 0, "Memory limit", 0 }, { "memory-reservation", MEMORY_RESERVATION, "VALUE", 0, "Memory reservation or soft_limit", 0 }, { "memory-swap", MEMORY_SWAP, "VALUE", 0, "Total memory usage", 0 }, { "pids-limit", PIDS_LIMIT, "VALUE", 0, "Maximum number of pids allowed in the container", 0 }, { "l3-cache-schema", L3_CACHE_SCHEMA, "VALUE", 0, "The string of Intel RDT/CAT L3 cache schema", 0 }, { "mem-bw-schema", MEM_BW_SCHEMA, "VALUE", 0, "The string of Intel RDT/MBA memory bandwidth schema", 0 }, { 0, } }; static char args_doc[] = "update [OPTION]... CONTAINER"; static error_t parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { case 'r': resources = argp_mandatory_argument (arg, state); break; case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); case BLKIO_WEIGHT: case CPU_PERIOD: case CPU_QUOTA: case CPU_SHARE: case CPU_RT_PERIOD: case CPU_RT_RUNTIME: case CPUSET_CPUS: case CPUSET_MEMS: case KERNEL_MEMORY: case KERNEL_MEMORY_TCP: case MEMORY: case MEMORY_RESERVATION: case MEMORY_SWAP: case PIDS_LIMIT: set_value (key, argp_mandatory_argument (arg, state)); break; case L3_CACHE_SCHEMA: l3_cache_schema = argp_mandatory_argument (arg, state); break; case MEM_BW_SCHEMA: mem_bw_schema = argp_mandatory_argument (arg, state); break; default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_update (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg = 0, ret; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &crun_context); crun_assert_n_args (argc - first_arg, 1, 1); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; if (resources == NULL) { ret = libcrun_container_update_from_values (&crun_context, argv[first_arg], values, values_len, err); free (values); if (ret < 0) return ret; } else { ret = libcrun_container_update_from_file (&crun_context, argv[first_arg], resources, err); if (ret < 0) return ret; } if (l3_cache_schema || mem_bw_schema) { struct libcrun_intel_rdt_update update = { .l3_cache_schema = l3_cache_schema, .mem_bw_schema = mem_bw_schema, }; ret = libcrun_container_update_intel_rdt (&crun_context, argv[first_arg], &update, err); if (ret < 0) return ret; } return 0; } crun-1.16.1/src/ps.c0000644000000000000000000000611514504567214012325 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include "crun.h" #include "libcrun/container.h" #include "libcrun/utils.h" #include "libcrun/cgroup.h" static char doc[] = "OCI runtime"; enum { OPTION_CONSOLE_SOCKET = 1000, OPTION_PID_FILE, OPTION_NO_SUBREAPER, OPTION_NO_NEW_KEYRING, OPTION_PRESERVE_FDS }; struct ps_options_s { int format; }; enum { PS_TABLE = 100, PS_JSON, }; static struct ps_options_s ps_options; static struct argp_option options[] = { { "format", 'f', "FORMAT", 0, "select the output format", 0 }, { 0, } }; static char args_doc[] = "ps"; static error_t parse_opt (int key, char *arg, struct argp_state *state arg_unused) { switch (key) { case 'f': if (strcmp (arg, "table") == 0) ps_options.format = PS_TABLE; else if (strcmp (arg, "json") == 0) ps_options.format = PS_JSON; else error (EXIT_FAILURE, 0, "invalid format `%s`", arg); break; default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_ps (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { int first_arg; int ret; cleanup_free pid_t *pids = NULL; libcrun_context_t crun_context = { 0, }; size_t i; ps_options.format = PS_TABLE; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &ps_options); crun_assert_n_args (argc - first_arg, 1, 1); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; ret = libcrun_container_read_pids (&crun_context, argv[first_arg], true, &pids, err); if (UNLIKELY (ret < 0)) { libcrun_error_write_warning_and_release (stderr, &err); return ret; } switch (ps_options.format) { case PS_JSON: printf ("[\n"); for (i = 0; pids && pids[i]; i++) printf (" %d%s\n", pids[i], pids[i + 1] ? "," : ""); printf ("]\n"); break; case PS_TABLE: printf ("PID\n"); for (i = 0; pids && pids[i]; i++) printf ("%d\n", pids[i]); break; } return 0; } crun-1.16.1/src/checkpoint.c0000644000000000000000000001232614504567214014033 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2020 Adrian Reber * crun 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. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #if HAVE_CRIU && HAVE_DLOPEN # include #endif #include "crun.h" #include "libcrun/container.h" #include "libcrun/status.h" #include "libcrun/utils.h" enum { OPTION_IMAGE_PATH = 1000, OPTION_WORK_PATH, OPTION_LEAVE_RUNNING, OPTION_TCP_ESTABLISHED, OPTION_SHELL_JOB, OPTION_EXT_UNIX_SK, OPTION_FILE_LOCKS, OPTION_PARENT_PATH, OPTION_PRE_DUMP, OPTION_MANAGE_CGROUPS_MODE, }; static char doc[] = "OCI runtime"; static libcrun_checkpoint_restore_t cr_options; static struct argp_option options[] = { { "image-path", OPTION_IMAGE_PATH, "DIR", 0, "path for saving criu image files", 0 }, { "work-path", OPTION_WORK_PATH, "DIR", 0, "path for saving work files and logs", 0 }, { "leave-running", OPTION_LEAVE_RUNNING, 0, 0, "leave the process running after checkpointing", 0 }, { "tcp-established", OPTION_TCP_ESTABLISHED, 0, 0, "allow open tcp connections", 0 }, { "ext-unix-sk", OPTION_EXT_UNIX_SK, 0, 0, "allow external unix sockets", 0 }, { "shell-job", OPTION_SHELL_JOB, 0, 0, "allow shell jobs", 0 }, { "file-locks", OPTION_FILE_LOCKS, 0, 0, "allow file locks", 0 }, #ifdef CRIU_PRE_DUMP_SUPPORT { "parent-path", OPTION_PARENT_PATH, "DIR", 0, "path for previous criu image files in pre-dump", 0 }, { "pre-dump", OPTION_PRE_DUMP, 0, 0, "dump container's memory information only, leave the container running after this", 0 }, #endif { "manage-cgroups-mode", OPTION_MANAGE_CGROUPS_MODE, "MODE", 0, "cgroups mode: 'soft' (default), 'ignore', 'full' and 'strict'", 0 }, { 0, } }; static char args_doc[] = "checkpoint CONTAINER"; int crun_parse_manage_cgroups_mode (char *param arg_unused) { #if HAVE_CRIU && HAVE_DLOPEN if (strcmp (param, "soft") == 0) return CRIU_CG_MODE_SOFT; else if (strcmp (param, "ignore") == 0) return CRIU_CG_MODE_IGNORE; else if (strcmp (param, "full") == 0) return CRIU_CG_MODE_FULL; else if (strcmp (param, "strict") == 0) return CRIU_CG_MODE_STRICT; else libcrun_fail_with_error (0, "unknown cgroup mode specified"); #else return 0; #endif } static error_t parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); case OPTION_IMAGE_PATH: cr_options.image_path = argp_mandatory_argument (arg, state); break; case OPTION_WORK_PATH: cr_options.work_path = argp_mandatory_argument (arg, state); break; case OPTION_PARENT_PATH: cr_options.parent_path = argp_mandatory_argument (arg, state); break; case OPTION_PRE_DUMP: cr_options.pre_dump = true; break; case OPTION_LEAVE_RUNNING: cr_options.leave_running = true; break; case OPTION_TCP_ESTABLISHED: cr_options.tcp_established = true; break; case OPTION_EXT_UNIX_SK: cr_options.ext_unix_sk = true; break; case OPTION_SHELL_JOB: cr_options.shell_job = true; break; case OPTION_FILE_LOCKS: cr_options.file_locks = true; break; case OPTION_MANAGE_CGROUPS_MODE: cr_options.manage_cgroups_mode = crun_parse_manage_cgroups_mode (argp_mandatory_argument (arg, state)); break; default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_checkpoint (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { cleanup_free char *cr_path = NULL; int first_arg; int ret; libcrun_context_t crun_context = { 0, }; cr_options.manage_cgroups_mode = -1; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &cr_options); crun_assert_n_args (argc - first_arg, 1, 2); ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; if (cr_options.image_path == NULL) { cleanup_free char *path = NULL; path = getcwd (NULL, 0); if (UNLIKELY (path == NULL)) libcrun_fail_with_error (0, "realloc failed"); ret = asprintf (&cr_path, "%s/checkpoint", path); if (UNLIKELY (ret < 0)) OOM (); cr_options.image_path = cr_path; } return libcrun_container_checkpoint (&crun_context, argv[first_arg], &cr_options, err); } crun-1.16.1/src/restore.c0000644000000000000000000001250514654642544013374 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2020 Adrian Reber * crun 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. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include "crun.h" #include "checkpoint.h" #include "libcrun/container.h" #include "libcrun/status.h" #include "libcrun/utils.h" enum { OPTION_IMAGE_PATH = 1000, OPTION_WORK_PATH, OPTION_TCP_ESTABLISHED, OPTION_SHELL_JOB, OPTION_EXT_UNIX_SK, OPTION_PID_FILE, OPTION_CONSOLE_SOCKET, OPTION_FILE_LOCKS, OPTION_MANAGE_CGROUPS_MODE, }; static char doc[] = "OCI runtime"; static const char *bundle = NULL; static libcrun_context_t crun_context; static libcrun_checkpoint_restore_t cr_options; static struct argp_option options[] = { { "bundle", 'b', "DIR", 0, "container bundle (default \".\")", 0 }, { "image-path", OPTION_IMAGE_PATH, "DIR", 0, "path for saving criu image files", 0 }, { "work-path", OPTION_WORK_PATH, "DIR", 0, "path for saving work files and logs", 0 }, { "tcp-established", OPTION_TCP_ESTABLISHED, 0, 0, "allow open tcp connections", 0 }, { "ext-unix-sk", OPTION_EXT_UNIX_SK, 0, 0, "allow external unix sockets", 0 }, { "shell-job", OPTION_SHELL_JOB, 0, 0, "allow shell jobs", 0 }, { "detach", 'd', 0, 0, "detach from the container's process", 0 }, { "pid-file", OPTION_PID_FILE, "FILE", 0, "where to write the PID of the container", 0 }, { "console-socket", OPTION_CONSOLE_SOCKET, "SOCKET", 0, "path to a socket that will receive the ptmx end of the tty", 0 }, { "file-locks", OPTION_FILE_LOCKS, 0, 0, "allow file locks", 0 }, { "manage-cgroups-mode", OPTION_MANAGE_CGROUPS_MODE, "MODE", 0, "cgroups mode: 'soft' (default), 'ignore', 'full' and 'strict'", 0 }, { 0, } }; static char args_doc[] = "restore CONTAINER"; static error_t parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); case OPTION_IMAGE_PATH: cr_options.image_path = argp_mandatory_argument (arg, state); break; case OPTION_WORK_PATH: cr_options.work_path = argp_mandatory_argument (arg, state); break; case 'b': bundle = argp_mandatory_argument (arg, state); break; case OPTION_TCP_ESTABLISHED: cr_options.tcp_established = true; break; case OPTION_EXT_UNIX_SK: cr_options.ext_unix_sk = true; break; case OPTION_SHELL_JOB: cr_options.shell_job = true; break; case OPTION_FILE_LOCKS: cr_options.file_locks = true; break; case 'd': cr_options.detach = true; break; case OPTION_CONSOLE_SOCKET: cr_options.console_socket = argp_mandatory_argument (arg, state); break; case OPTION_PID_FILE: crun_context.pid_file = argp_mandatory_argument (arg, state); break; case OPTION_MANAGE_CGROUPS_MODE: cr_options.manage_cgroups_mode = crun_parse_manage_cgroups_mode (argp_mandatory_argument (arg, state)); break; default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp run_argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; int crun_command_restore (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err) { cleanup_free char *bundle_cleanup = NULL; cleanup_free char *cr_path = NULL; int first_arg; int ret; argp_parse (&run_argp, argc, argv, ARGP_IN_ORDER, &first_arg, &cr_options); crun_assert_n_args (argc - first_arg, 1, 2); /* Make sure the bundle is an absolute path. */ if (bundle == NULL) { bundle = realpath (".", NULL); } else { if (bundle[0] != '/') { bundle_cleanup = realpath (bundle, NULL); if (bundle_cleanup == NULL) libcrun_fail_with_error (errno, "realpath `%s` failed", bundle); bundle = bundle_cleanup; } if (chdir (bundle) < 0) libcrun_fail_with_error (errno, "chdir `%s` failed", bundle); } ret = init_libcrun_context (&crun_context, argv[first_arg], global_args, err); if (UNLIKELY (ret < 0)) return ret; if (cr_options.image_path == NULL) { cleanup_free char *path = NULL; path = getcwd (NULL, 0); if (UNLIKELY (path == NULL)) libcrun_fail_with_error (0, "realloc failed"); ret = asprintf (&cr_path, "%s/checkpoint", path); if (UNLIKELY (ret < 0)) OOM (); cr_options.image_path = cr_path; } crun_context.bundle = bundle; return libcrun_container_restore (&crun_context, argv[first_arg], &cr_options, err); } crun-1.16.1/src/crun.h0000644000000000000000000000243514406334420012650 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef CRUN_H #define CRUN_H #include "libcrun/container.h" struct crun_global_arguments { char *root; char *log; char *log_format; const char *handler; int argc; char **argv; bool command; bool debug; bool option_systemd_cgroup; bool option_force_no_cgroup; }; char *argp_mandatory_argument (char *arg, struct argp_state *state); int init_libcrun_context (libcrun_context_t *con, const char *id, struct crun_global_arguments *glob, libcrun_error_t *err); void crun_assert_n_args (int n, int min, int max); #endif crun-1.16.1/src/list.h0000664000000000000000000000162314011447015012651 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef LIST_H #define LIST_H #include "crun.h" int crun_command_list (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/run.h0000664000000000000000000000162014011447015012477 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef RUN_H #define RUN_H #include "crun.h" int crun_command_run (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/delete.h0000664000000000000000000000163114011447015013137 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef DELETE_H #define DELETE_H #include "crun.h" int crun_command_delete (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/kill.h0000664000000000000000000000162314011447015012631 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef KILL_H #define KILL_H #include "crun.h" int crun_command_kill (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/pause.h0000664000000000000000000000162614011447015013016 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef PAUSE_H #define PAUSE_H #include "crun.h" int crun_command_pause (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/unpause.h0000664000000000000000000000163414011447015013360 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef UNPAUSE_H #define UNPAUSE_H #include "crun.h" int crun_command_unpause (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/create.h0000664000000000000000000000163114011447015013140 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef CREATE_H #define CREATE_H #include "crun.h" int crun_command_create (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/start.h0000664000000000000000000000162614011447015013036 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef START_H #define START_H #include "crun.h" int crun_command_start (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/state.h0000664000000000000000000000162614011447015013021 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef STATE_H #define STATE_H #include "crun.h" int crun_command_state (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/exec.h0000664000000000000000000000162314011447015012622 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef EXEC_H #define EXEC_H #include "crun.h" int crun_command_exec (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/oci_features.h0000644000000000000000000000164714504567214014365 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef OCI_FEATURES_H #define OCI_FEATURES_H #include "crun.h" int crun_command_features (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/spec.h0000664000000000000000000000162314011447015012630 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef SPEC_H #define SPEC_H #include "crun.h" int crun_command_spec (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/update.h0000664000000000000000000000162714011447015013164 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef UPDATE_H #define UPDATE_H #include "crun.h" int crun_command_update (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err); #endif crun-1.16.1/src/ps.h0000664000000000000000000000161514011447015012321 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #ifndef PS_H #define PS_H #include "crun.h" int crun_command_ps (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/checkpoint.h0000644000000000000000000000170214406334420014024 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2020 Adrian Reber * crun 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. * * crun 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 crun. If not, see . */ #ifndef CHECKPOINT_H #define CHECKPOINT_H #include "crun.h" int crun_parse_manage_cgroups_mode (char *param); int crun_command_checkpoint (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/src/restore.h0000664000000000000000000000160714011447015013363 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2020 Adrian Reber * crun 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. * * crun 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 crun. If not, see . */ #ifndef RESTORE_H #define RESTORE_H #include "crun.h" int crun_command_restore (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *error); #endif crun-1.16.1/tests/0000755000000000000000000000000014656670213012111 5ustar0000000000000000crun-1.16.1/tests/init.c0000644000000000000000000004424614654642544013236 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun 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. * * crun 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 crun. If not, see . */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_LINUX_IOPRIO_H # include #endif #ifdef HAVE_SECCOMP # include # include # include # ifndef SECCOMP_FILTER_FLAG_NEW_LISTENER # define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3) # endif # ifndef SECCOMP_SET_MODE_FILTER # define SECCOMP_SET_MODE_FILTER 1 # endif # ifndef __NR_seccomp # define __NR_seccomp 0xffff // seccomp syscall number unknown for this architecture # endif #endif #ifdef HAVE_ERROR_H # include #else # define error(status, errno, fmt, ...) \ do \ { \ if (errno == 0) \ fprintf (stderr, "crun: " fmt "\n", ##__VA_ARGS__); \ else \ { \ fprintf (stderr, "crun: " fmt, ##__VA_ARGS__); \ fprintf (stderr, ": %s\n", strerror (errno)); \ } \ if (status) \ exit (status); \ } while (0) #endif #ifdef HAVE_LINUX_IOPRIO_H static int syscall_ioprio_get (int which, int who) { # ifdef __NR_ioprio_get return syscall (__NR_ioprio_get, which, who); # else (void) which; (void) who; (void) ioprio; errno = ENOSYS; return -1; # endif } #endif struct mount_attr_s { uint64_t attr_set; uint64_t attr_clr; uint64_t propagation; uint64_t userns_fd; }; #ifndef MOUNT_ATTR_IDMAP # define MOUNT_ATTR_IDMAP 0x00100000 /* Idmap mount to @userns_fd in struct mount_attr. */ #endif #ifndef OPEN_TREE_CLONE # define OPEN_TREE_CLONE 1 #endif #ifndef OPEN_TREE_CLOEXEC # define OPEN_TREE_CLOEXEC O_CLOEXEC #endif static int syscall_clone (unsigned long flags, void *child_stack) { #if defined __s390__ || defined __CRIS__ return (int) syscall (__NR_clone, child_stack, flags); #else return (int) syscall (__NR_clone, flags, child_stack); #endif } static int syscall_open_tree (int dfd, const char *pathname, unsigned int flags) { #if defined __NR_open_tree return (int) syscall (__NR_open_tree, dfd, pathname, flags); #else (void) dfd; (void) pathname; (void) flags; errno = ENOSYS; return -1; #endif } static int syscall_mount_setattr (int dfd, const char *path, unsigned int flags, struct mount_attr_s *attr) { #ifdef __NR_mount_setattr return (int) syscall (__NR_mount_setattr, dfd, path, flags, attr, sizeof (*attr)); #else (void) dfd; (void) path; (void) flags; (void) attr; errno = ENOSYS; return -1; #endif } static void write_to (const char *path, const char *str) { int fd = open (path, O_WRONLY); if (fd < 0) error (EXIT_FAILURE, errno, "open `%s`", path); if (write (fd, str, strlen (str)) < 0) error (EXIT_FAILURE, errno, "write to `%s`", path); if (close (fd) < 0) error (EXIT_FAILURE, errno, "close file `%s`", path); } /* Check that the file system at the specified path supports idmapped mounts. */ __attribute__ ((noreturn)) static void check_idmapped_mounts (const char *path) { struct mount_attr_s attr = { 0, }; char proc_path[64]; int open_tree_fd; pid_t pid; int fd; pid = syscall_clone (CLONE_NEWUSER | SIGCHLD, NULL); if (pid < 0) error (EXIT_FAILURE, errno, "clone"); if (pid == 0) { prctl (PR_SET_PDEATHSIG, SIGKILL); while (1) pause (); _exit (EXIT_SUCCESS); } sprintf (proc_path, "/proc/%d/uid_map", pid); write_to (proc_path, "0 0 1"); sprintf (proc_path, "/proc/%d/gid_map", pid); write_to (proc_path, "0 0 1"); sprintf (proc_path, "/proc/%d/ns/user", pid); fd = open (proc_path, O_RDONLY); if (fd < 0) error (EXIT_FAILURE, errno, "open `%s`", proc_path); open_tree_fd = syscall_open_tree (-1, path, AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | OPEN_TREE_CLOEXEC | OPEN_TREE_CLONE); if (open_tree_fd < 0) error (EXIT_FAILURE, errno, "open `%s`", path); attr.attr_set = MOUNT_ATTR_IDMAP; attr.userns_fd = fd; if (syscall_mount_setattr (open_tree_fd, "", AT_EMPTY_PATH, &attr) < 0) error (EXIT_FAILURE, errno, "mount_setattr `%s`", path); exit (EXIT_SUCCESS); } static int cat (char *file) { FILE *f = fopen (file, "rbe"); char buf[512]; if (f == NULL) error (EXIT_FAILURE, errno, "fopen"); while (1) { size_t s = fread (buf, 1, sizeof (buf), f); if (s == 0) { if (feof (f)) { fclose (f); return 0; } fclose (f); error (EXIT_FAILURE, errno, "fread"); } s = fwrite (buf, 1, s, stdout); if (s == 0) error (EXIT_FAILURE, errno, "fwrite"); } } static int open_only (char *file) { int fd = open (file, O_RDONLY); if (fd >= 0) { close (fd); exit (0); } error (EXIT_FAILURE, errno, "could not open %s", file); return -1; } static int ls (char *path) { DIR *dir = opendir (path); if (dir == NULL) error (EXIT_FAILURE, errno, "opendir"); for (;;) { struct dirent *de; errno = 0; de = readdir (dir); if (de == NULL && errno) error (EXIT_FAILURE, errno, "readdir"); if (de == NULL) { closedir (dir); return 0; } printf ("%s\n", de->d_name); } closedir (dir); return 0; } static int sd_notify () { int ret; int notify_socket_fd; char *notify_socket_name; struct sockaddr_un notify_socket_unix_name; const char *ready_data = "READY=1"; const int ready_data_len = 7; notify_socket_name = getenv ("NOTIFY_SOCKET"); if (notify_socket_name == NULL) error (EXIT_FAILURE, 0, "NOTIFY_SOCKET not found in environment"); notify_socket_fd = socket (AF_UNIX, SOCK_DGRAM, 0); if (notify_socket_fd < 0) error (EXIT_FAILURE, errno, "socket"); notify_socket_unix_name.sun_family = AF_UNIX; strncpy (notify_socket_unix_name.sun_path, notify_socket_name, sizeof (notify_socket_unix_name.sun_path)); ret = sendto (notify_socket_fd, ready_data, ready_data_len, 0, (struct sockaddr *) ¬ify_socket_unix_name, sizeof (notify_socket_unix_name)); if (ret < 0) error (EXIT_FAILURE, 0, "sendto"); return 0; } static int syscall_seccomp (unsigned int operation, unsigned int flags, void *args) { return (int) syscall (__NR_seccomp, operation, flags, args); } static void do_pause () { unsigned int remaining = 120; close (1); close (2); while (remaining) remaining = sleep (remaining); exit (0); } static int memhog (int megabytes) { char *buf; int pos = 0; if (megabytes < 1) error (EXIT_FAILURE, 0, "memhog argument needs to be at least 1"); buf = malloc (megabytes * 1024 * 1024); if (buf == NULL) error (EXIT_FAILURE, 0, "malloc"); close (1); close (2); while (1) { /* write each page once */ buf[pos] = 'c'; pos += sysconf (_SC_PAGESIZE); if (pos > megabytes * 1024 * 1024) break; } pos = 0; while (1) { /* change one page each 0.1 seconds */ nanosleep ((const struct timespec[]){ { 0, 100000000L } }, NULL); buf[pos] = 'c'; pos += sysconf (_SC_PAGESIZE); if (pos > megabytes * 1024 * 1024) pos = 0; } return 0; } int main (int argc, char **argv) { if (argc < 2) error (EXIT_FAILURE, 0, "specify at least one command"); if (strcmp (argv[1], "true") == 0) { exit (0); } if (strcmp (argv[1], "echo") == 0) { if (argc < 3) error (EXIT_FAILURE, 0, "'echo' requires an argument"); fputs (argv[2], stdout); exit (0); } if (strcmp (argv[1], "printenv") == 0) { if (argc < 3) error (EXIT_FAILURE, 0, "'printenv' requires an argument"); fputs (getenv (argv[2]), stdout); exit (0); } if (strcmp (argv[1], "groups") == 0) { gid_t groups[10]; int max_groups = sizeof (groups) / sizeof (groups[0]); int n_groups, i; n_groups = getgroups (max_groups, groups); fputs ("GROUPS=[", stdout); for (i = 0; i < n_groups; i++) printf ("%s%d", i == 0 ? "" : " ", groups[i]); fputs ("]\n", stdout); exit (0); } if (strcmp (argv[1], "cat") == 0) { if (argc < 3) error (EXIT_FAILURE, 0, "'cat' requires an argument"); return cat (argv[2]); } if (strcmp (argv[1], "readlink") == 0) { ssize_t ret; char *buf = malloc (PATH_MAX); if (buf == NULL) error (EXIT_FAILURE, errno, "malloc"); if (argc < 3) error (EXIT_FAILURE, 0, "'readlink' requires an argument"); ret = readlink (argv[2], buf, PATH_MAX); if (ret < 0) error (EXIT_FAILURE, errno, "readlink"); printf ("%.*s", (int) ret, buf); free (buf); return 0; } if (strcmp (argv[1], "open") == 0) { if (argc < 3) error (EXIT_FAILURE, 0, "'open' requires an argument"); return open_only (argv[2]); } if (strcmp (argv[1], "access") == 0) { if (argc < 3) error (EXIT_FAILURE, 0, "'access' requires an argument"); if (access (argv[2], F_OK) < 0) error (EXIT_FAILURE, errno, "could not access %s", argv[2]); return 0; } if (strcmp (argv[1], "type") == 0) { struct stat st; if (argc < 3) error (EXIT_FAILURE, 0, "'type' requires two arguments"); if (stat (argv[2], &st) < 0) error (EXIT_FAILURE, errno, "stat %s", argv[2]); switch (st.st_mode & S_IFMT) { case S_IFBLK: printf ("block device\n"); break; case S_IFCHR: printf ("character device\n"); break; case S_IFDIR: printf ("directory\n"); break; case S_IFIFO: printf ("FIFO/pipe\n"); break; case S_IFLNK: printf ("symlink\n"); break; case S_IFREG: printf ("regular file\n"); break; case S_IFSOCK: printf ("socket\n"); break; default: printf ("unknown?\n"); break; } return 0; } if (strcmp (argv[1], "owner") == 0) { struct stat st; if (argc < 3) error (EXIT_FAILURE, 0, "'owner' requires two arguments"); if (stat (argv[2], &st) < 0) error (EXIT_FAILURE, errno, "stat %s", argv[2]); printf ("%d:%d", st.st_uid, st.st_gid); return 0; } if (strcmp (argv[1], "mode") == 0) { struct stat st; if (argc < 3) error (EXIT_FAILURE, 0, "'mode' requires two arguments"); if (stat (argv[2], &st) < 0) error (EXIT_FAILURE, errno, "stat %s", argv[2]); printf ("%o", st.st_mode & 07777); return 0; } if (strcmp (argv[1], "id") == 0) { int ret; ret = printf ("%d:%d", getuid (), getgid ()); if (ret < 0) error (EXIT_FAILURE, errno, "printf"); return 0; } if (strcmp (argv[1], "cwd") == 0) { int ret; char *wd = getcwd (NULL, 0); if (wd == NULL) error (EXIT_FAILURE, 0, "OOM"); ret = printf ("%s\n", wd); if (ret < 0) error (EXIT_FAILURE, errno, "printf"); return 0; } if (strcmp (argv[1], "gethostname") == 0) { char buffer[64] = {}; int ret; ret = gethostname (buffer, sizeof (buffer) - 1); if (ret < 0) error (EXIT_FAILURE, errno, "gethostname"); ret = printf ("%s\n", buffer); if (ret < 0) error (EXIT_FAILURE, errno, "printf"); return 0; } if (strcmp (argv[1], "getdomainname") == 0) { char buffer[64] = {}; int ret; ret = getdomainname (buffer, sizeof (buffer) - 1); if (ret < 0) error (EXIT_FAILURE, errno, "getdomainname"); ret = printf ("%s\n", buffer); if (ret < 0) error (EXIT_FAILURE, errno, "printf"); return 0; } if (strcmp (argv[1], "isatty") == 0) { int fd; if (argc < 3) error (EXIT_FAILURE, 0, "'isatty' requires two arguments"); fd = atoi (argv[2]); printf (isatty (fd) ? "true" : "false"); return 0; } if (strcmp (argv[1], "write") == 0) { if (argc < 3) error (EXIT_FAILURE, 0, "'write' requires two arguments"); write_to (argv[2], argv[3]); exit (EXIT_SUCCESS); } if (strcmp (argv[1], "pause") == 0) { do_pause (); } if (strcmp (argv[1], "memhog") == 0) { if (argc < 3) error (EXIT_FAILURE, 0, "'memhog' requires an argument"); return memhog (atoi (argv[2])); } if (strcmp (argv[1], "create-sub-cgroup-and-wait") == 0) { char path[PATH_MAX]; int ret; int fd; if (argc < 3) error (EXIT_FAILURE, 0, "'create-sub-cgroup-and-wait' requires an argument"); sprintf (path, "/sys/fs/cgroup/%s", argv[2]); ret = mkdir (path, 0700); if (ret < 0) error (EXIT_FAILURE, errno, "mkdir"); sprintf (path, "/sys/fs/cgroup/%s/cgroup.procs", argv[2]); fd = open (path, O_WRONLY); if (fd < 0) error (EXIT_FAILURE, errno, "open `%s`", path); ret = write (fd, "1", 1); if (ret < 0) error (EXIT_FAILURE, errno, "open `%s`", path); close (fd); do_pause (); } if (strcmp (argv[1], "forkbomb") == 0) { int i, n; if (argc < 3) error (EXIT_FAILURE, 0, "'forkbomb' requires two arguments"); n = atoi (argv[2]); if (n < 0) return 0; for (i = 0; i < n; i++) { pid_t pid = fork (); if (pid < 0) error (EXIT_FAILURE, errno, "fork"); if (pid == 0) sleep (100); } return 0; } if (strcmp (argv[1], "ioprio") == 0) { #ifdef HAVE_LINUX_IOPRIO_H int ret = syscall_ioprio_get (IOPRIO_WHO_PROCESS, 0); if (ret >= 0) { printf ("%d\n", ret); return 0; } error (EXIT_FAILURE, errno, "`ioprio_get` failed"); #else error (EXIT_FAILURE, 0, "`ioprio_get` not supported"); #endif } if (strcmp (argv[1], "ls") == 0) { /* Fork so that ls /proc/1/fd doesn't show more fd's. */ pid_t pid; if (argc < 3) error (EXIT_FAILURE, 0, "'ls' requires two arguments"); pid = fork (); if (pid < 0) error (EXIT_FAILURE, errno, "fork"); if (pid) { int ret, status; do ret = waitpid (pid, &status, 0); while (ret < 0 && errno == EINTR); if (ret < 0) return ret; return status; } return ls (argv[2]); } if (strcmp (argv[1], "systemd-notify") == 0) return sd_notify (); if (strcmp (argv[1], "check-feature") == 0) { if (argc < 3) error (EXIT_FAILURE, 0, "`check-feature` requires an argument"); if (strcmp (argv[2], "ioprio") == 0) { #ifdef HAVE_LINUX_IOPRIO_H if (syscall_ioprio_get (IOPRIO_WHO_PROCESS, 0) >= 0) return 0; #endif return 1; } if (strcmp (argv[2], "idmapped-mounts") == 0) { if (argc < 4) error (EXIT_FAILURE, 0, "`idmapped-mounts` requires an argument"); check_idmapped_mounts (argv[3]); } if (strcmp (argv[2], "open_tree") == 0) { #if defined __NR_open_tree int ret; ret = syscall (__NR_open_tree); return (ret >= 0 || errno != ENOSYS) ? 0 : 1; #else return 1; #endif } else if (strcmp (argv[2], "move_mount") == 0) { #if defined __NR_move_mount int ret; ret = syscall (__NR_move_mount); return (ret >= 0 || errno != ENOSYS) ? 0 : 1; #else return 1; #endif } else if (strcmp (argv[2], "seccomp-listener") == 0) { #ifdef HAVE_SECCOMP int ret; int p = fork (); if (p < 0) return 1; if (p) { int status; do ret = waitpid (p, &status, 0); while (ret < 0 && errno == EINTR); if (ret == p && WIFEXITED (status) && WEXITSTATUS (status) == 0) return 0; return 1; } else { struct sock_fprog seccomp_filter; const char bpf[] = { 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f }; seccomp_filter.len = 1; seccomp_filter.filter = (struct sock_filter *) bpf; if (prctl (PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0) return 1; ret = syscall_seccomp (SECCOMP_SET_MODE_FILTER, SECCOMP_FILTER_FLAG_NEW_LISTENER, &seccomp_filter); if (ret <= 0) return 1; return 0; } #endif return 1; } else error (EXIT_FAILURE, 0, "unknown feature"); } error (EXIT_FAILURE, 0, "unknown command '%s' specified", argv[1]); return 0; } crun-1.16.1/tests/tests_libcrun_errors.c0000644000000000000000000000457014406334420016525 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #include #include #include typedef int (*test) (); static int test_crun_make_error () { libcrun_error_t err = NULL; int ret = crun_make_error (&err, 12, "HELLO %s", "WORLD"); if (ret >= 0) return -1; if (err->status != 12) return -1; if (strcmp (err->msg, "HELLO WORLD") != 0) return -1; crun_error_release (&err); return 0; } static int test_crun_write_warning_and_release () { libcrun_error_t err_data = NULL; libcrun_error_t *err = &err_data; cleanup_free char *buffer = NULL; size_t len; FILE *stream; int ret = crun_make_error (err, 0, "HELLO %s", "WORLD"); if (ret >= 0) return -1; if ((*err)->status != 0) return -1; if ((*err)->msg == NULL) return -1; stream = open_memstream (&buffer, &len); crun_error_write_warning_and_release (stream, &err); fclose (stream); if (len != 12) return -1; if (*err) return -1; if (strcmp (buffer, "HELLO WORLD\n") != 0) return -1; return 0; } static void run_and_print_test_result (const char *name, int id, test t) { int ret = t (); if (ret == 0) printf ("ok %d - %s\n", id, name); else if (ret == 77) printf ("ok %d - %s #SKIP\n", id, name); else printf ("not ok %d - %s\n", id, name); } #define RUN_TEST(T) \ do \ { \ run_and_print_test_result (#T, id++, T); \ } while (0) int main () { int id = 1; printf ("1..2\n"); RUN_TEST (test_crun_make_error); RUN_TEST (test_crun_write_warning_and_release); return 0; } crun-1.16.1/tests/tests_libcrun_fuzzer.c0000644000000000000000000002617114516475732016555 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2021 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static int test_mode = -1; extern int compare_rdt_configurations (const char *a, const char *b); #ifdef HAVE_SYSTEMD extern int cpuset_string_to_bitmask (const char *str, char **out, size_t *out_size, libcrun_error_t *err); #endif static char * make_nul_terminated (uint8_t *buf, size_t len) { char *r; r = malloc (len + 1); if (r == NULL) return 0; memcpy (r, buf, len); r[len] = '\0'; return r; } static int test_generate_ebpf (uint8_t *buf, size_t len) { libcrun_error_t err = NULL; cleanup_free struct bpf_program *program = NULL; cleanup_free char *copy = NULL; struct bpf_program *new_program; cleanup_close int fd = -1; char access[4]; copy = make_nul_terminated (buf, len); if (copy == NULL) return 0; program = bpf_program_new (2048); bpf_program_init_dev (program, &err); crun_error_release (&err); new_program = bpf_program_append (program, copy, len / 2); if (new_program == NULL) return 0; program = new_program; if (len < 10) return 0; memcpy (access, buf, 3); access[3] = '\0'; new_program = bpf_program_append_dev (program, access, copy[3], copy[4], copy[5], copy[6] & 0x1, &err); if (new_program == NULL) { crun_error_release (&err); return 0; } program = new_program; new_program = bpf_program_init_dev (program, &err); if (new_program == NULL) { crun_error_release (&err); return 0; } program = new_program; fd = open ("/dev/null", O_WRONLY); if (fd < 0) return 0; libcrun_ebpf_load (program, fd, NULL, &err); crun_error_release (&err); return 0; } char *chroot_realpath (const char *chroot, const char *path, char resolved_path[]); static int test_chroot_realpath (uint8_t *buf, size_t len) { cleanup_free char *path = NULL; char resolved_path[PATH_MAX]; path = make_nul_terminated (buf, len); if (path == NULL) return 0; chroot_realpath (".", path, resolved_path); (void) resolved_path; return 0; } static int test_str2sig (uint8_t *buf, size_t len) { cleanup_free char *name = NULL; name = make_nul_terminated (buf, len); if (name == NULL) return 0; str2sig (name); return 0; } static int generate_seccomp (uint8_t *buf, size_t len) { libcrun_error_t err = NULL; cleanup_container libcrun_container_t *container = NULL; cleanup_free char *conf = NULL; cleanup_close int outfd = -1; struct libcrun_seccomp_gen_ctx_s ctx; conf = make_nul_terminated (buf, len); if (conf == NULL) return 0; container = libcrun_container_load_from_memory (conf, &err); if (container == NULL) { crun_error_release (&err); return 0; } outfd = open ("/dev/null", O_WRONLY); if (outfd < 0) return 0; libcrun_seccomp_gen_ctx_init (&ctx, container, true, 0); ctx.fd = outfd; libcrun_generate_seccomp (&ctx, &err); crun_error_release (&err); return 0; } static int test_read_cgroup_pids (uint8_t *buf, size_t len) { cleanup_free pid_t *pids = NULL; cleanup_free char *path = NULL; libcrun_error_t err = NULL; path = make_nul_terminated (buf, len); if (path == NULL) return 0; libcrun_cgroup_read_pids_from_path (path, true, &pids, &err); crun_error_release (&err); return 0; } static int test_get_file_type (uint8_t *buf, size_t len) { cleanup_free char *path = NULL; libcrun_error_t err = NULL; mode_t mode; path = make_nul_terminated (buf, len); if (path == NULL) return 0; if (get_file_type_at (AT_FDCWD, &mode, true, path) < 0) crun_error_release (&err); if (get_file_type_at (AT_FDCWD, &mode, false, path) < 0) crun_error_release (&err); if (get_file_type (&mode, true, path) < 0) crun_error_release (&err); if (get_file_type (&mode, false, path) < 0) crun_error_release (&err); return 0; } static int test_path_exists (uint8_t *buf, size_t len) { cleanup_free char *path = NULL; libcrun_error_t err = NULL; path = make_nul_terminated (buf, len); if (path == NULL) return 0; if (crun_path_exists (path, &err) < 0) crun_error_release (&err); if (crun_dir_p (path, true, &err) < 0) crun_error_release (&err); if (crun_dir_p (path, false, &err) < 0) crun_error_release (&err); if (crun_dir_p_at (AT_FDCWD, path, true, &err) < 0) crun_error_release (&err); if (crun_dir_p_at (AT_FDCWD, path, false, &err) < 0) crun_error_release (&err); return 0; } static int test_read_files (uint8_t *buf, size_t len) { cleanup_free char *path = NULL; path = make_nul_terminated (buf, len); if (path == NULL) return 0; { cleanup_free char *out = NULL; libcrun_error_t err = NULL; size_t size = 0; if (read_all_file (path, &out, &size, &err) < 0) crun_error_release (&err); } { cleanup_free char *out = NULL; libcrun_error_t err = NULL; size_t size = 0; if (read_all_file_at (AT_FDCWD, path, &out, &size, &err) < 0) crun_error_release (&err); } return 0; } static int test_parse_sd_array (uint8_t *buf, size_t len) { #ifdef HAVE_SYSTEMD char *out = NULL, *next = NULL; cleanup_free char *data = NULL; libcrun_error_t err = NULL; data = make_nul_terminated (buf, len); if (data == NULL) return 0; if (parse_sd_array (data, &out, &next, &err) < 0) crun_error_release (&err); #else (void) buf; (void) len; #endif return 0; } static int test_parse_idmapped_mounts (uint8_t *buf, size_t len) { cleanup_free char *data = NULL; cleanup_free char *out = NULL; libcrun_error_t err = NULL; data = make_nul_terminated (buf, len); if (data == NULL) return 0; if (parse_idmapped_mount_option (NULL, buf[0] & 1, data, &out, &len, &err) < 0) crun_error_release (&err); return 0; } static int run_one_container (uint8_t *buf, size_t len, bool detach) { cleanup_free char *conf = NULL; const char *container_status = NULL; cleanup_container libcrun_container_t *container = NULL; libcrun_context_t ctx; char id[64]; static unsigned long long counter = 0; libcrun_error_t err = NULL; libcrun_container_status_t status; int running; conf = make_nul_terminated (buf, len); if (conf == NULL) return 0; container = libcrun_container_load_from_memory (conf, &err); if (container == NULL) { crun_error_release (&err); return 0; } memset (&ctx, 0, sizeof (ctx)); sprintf (id, "fuzzer-%d-%llu", getpid (), counter++); ctx.id = id; ctx.bundle = "rootfs"; ctx.detach = detach; ctx.fifo_exec_wait_fd = -1; libcrun_container_run (&ctx, container, LIBCRUN_RUN_OPTIONS_PREFORK, &err); crun_error_release (&err); memset (&status, 0, sizeof (status)); if (libcrun_read_container_status (&status, NULL, id, &err) < 0) crun_error_release (&err); if (libcrun_get_container_state_string (id, &status, NULL, &container_status, &running, &err) < 0) crun_error_release (&err); libcrun_free_container_status (&status); if (libcrun_container_delete (&ctx, container->container_def, id, false, &err) < 0) crun_error_release (&err); if (libcrun_container_delete (&ctx, container->container_def, id, true, &err) < 0) crun_error_release (&err); return 0; } static int run_one_test (int mode, uint8_t *buf, size_t len) { int i; switch (mode) { case 0: /* expects config.json. */ run_one_container (buf, len, false); break; case 1: /* expects config.json. */ run_one_container (buf, len, true); break; case 2: /* expects config.json/linux/seccomp. */ generate_seccomp (buf, len); break; case 3: /* expects signals. */ test_str2sig (buf, len); break; case 4: /* expects paths. */ test_chroot_realpath (buf, len); test_read_cgroup_pids (buf, len); test_read_files (buf, len); test_path_exists (buf, len); test_get_file_type (buf, len); break; case 5: /* expects random data. */ test_generate_ebpf (buf, len); break; case 6: /* expects annotations data. */ test_parse_sd_array (buf, len); break; case 7: /* expects idmapped mounts annotation. */ test_parse_idmapped_mounts (buf, len); break; case 8: { cleanup_free char *a = make_nul_terminated (buf, len / 2); cleanup_free char *b = make_nul_terminated (buf + len / 2, len / 2); compare_rdt_configurations (a, b); } break; case 9: { #ifdef HAVE_SYSTEMD libcrun_error_t err = NULL; cleanup_free char *a = make_nul_terminated (buf, len); cleanup_free char *out = NULL; size_t len; cpuset_string_to_bitmask (a, &out, &len, &err); crun_error_release (&err); #endif } break; /* ALL mode. */ case -1: for (i = 0; i <= 8; i++) run_one_test (i, buf, len); break; default: fprintf (stderr, "invalid mode %d\n", mode); raise (SIGABRT); break; } return 0; } int LLVMFuzzerInitialize (int *argc arg_unused, char ***argv arg_unused) { return 0; } int LLVMFuzzerTestOneInput (uint8_t *buf, size_t len) { run_one_test (test_mode, buf, len); return 0; } static void sig_chld () { int status; pid_t p; do p = waitpid (-1, &status, WNOHANG); while (p > 0); } int main (int argc, char **argv) { const char *t = getenv ("FUZZING_MODE"); if (t) test_mode = atoi (t); if (prctl (PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0) < 0) libcrun_fail_with_error (1, "%s", "cannot set subreaper"); signal (SIGCHLD, sig_chld); if (argc > 1) { libcrun_error_t err = NULL; cleanup_free uint8_t *content = NULL; size_t len; if (read_all_file (argv[1], (char **) &content, &len, &err) < 0) { libcrun_fail_with_error (err->status, "%s", err->msg); return -1; } return LLVMFuzzerTestOneInput (content, len); } #ifdef FUZZER extern void HF_ITER (uint8_t * *buf, size_t * len); for (;;) { size_t len; uint8_t *buf; HF_ITER (&buf, &len); LLVMFuzzerTestOneInput (buf, len); } #endif return 0; } crun-1.16.1/tests/tests_libcrun_intelrdt.c0000644000000000000000000000656714514171717017056 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019, 2023 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #include #include #include #include #include typedef int (*test) (); extern int compare_rdt_configurations (const char *a, const char *b); extern char *intelrdt_clean_l3_cache_schema (const char *l3_cache_schema); static int test_compare_rdt_configurations () { if (compare_rdt_configurations ("L3:1=1f;0=7f0;", "L3:0=7f0;1=01f;")) return 1; if (compare_rdt_configurations ("L3:1=1f;0=7f0;", "L3:0=7f0;1=01f")) return 1; if (compare_rdt_configurations ("MB:0=20;1=70", "MB:0=20;1=70")) return 1; if (compare_rdt_configurations ("MB:0=20;1=70;", "0= 20;1= 70")) return 1; return 0; } static int test_intelrdt_clean_l3_cache_schema () { #define COMPARE(X, Y) \ do \ { \ char *res = intelrdt_clean_l3_cache_schema (X); \ int r = strcmp (res, Y); \ free (res); \ if (r) \ return 1; \ } while (0) COMPARE ("L3:2=2e;1=8e1;", "L3:2=2e;1=8e1;"); COMPARE ("L3:2=2e;1=8e1", "L3:2=2e;1=8e1"); COMPARE ("L3:2=2e;1=8e1;\nMB:13", "L3:2=2e;1=8e1;\n"); COMPARE ("MB:13\nL3:2=2e;1=8e1", "L3:2=2e;1=8e1"); COMPARE ("L3:2=2e;1=8e1\nMB:foo1=bar1\n", "L3:2=2e;1=8e1\n"); COMPARE ("L3:3=3d;2=9d2;", "L3:3=3d;2=9d2;"); COMPARE ("L3:3=3d;2=9d2", "L3:3=3d;2=9d2"); COMPARE ("L3:3=3d;2=9d2;\nMB:14", "L3:3=3d;2=9d2;\n"); COMPARE ("MB:14\nL3:3=3d;2=9d2", "L3:3=3d;2=9d2"); COMPARE ("L3:3=3d;2=9d2\nMB:foo2=bar2\n", "L3:3=3d;2=9d2\n"); COMPARE ("L3:4=4c;3=ac3;", "L3:4=4c;3=ac3;"); COMPARE ("L3:4=4c;3=ac3", "L3:4=4c;3=ac3"); COMPARE ("L3:4=4c;3=ac3;\nMB:15", "L3:4=4c;3=ac3;\n"); COMPARE ("MB:15\nL3:4=4c;3=ac3", "L3:4=4c;3=ac3"); COMPARE ("L3:4=4c;3=ac3\nMB:foo3=bar3\n", "L3:4=4c;3=ac3\n"); #undef COMPARE return 0; } static void run_and_print_test_result (const char *name, int id, test t) { int ret = t (); if (ret == 0) printf ("ok %d - %s\n", id, name); else if (ret == 77) printf ("ok %d - %s #SKIP\n", id, name); else printf ("not ok %d - %s\n", id, name); } #define RUN_TEST(T) \ do \ { \ run_and_print_test_result (#T, id++, T); \ } while (0) int main () { int id = 1; printf ("1..2\n"); RUN_TEST (test_compare_rdt_configurations); RUN_TEST (test_intelrdt_clean_l3_cache_schema); return 0; } crun-1.16.1/tests/tests_libcrun_utils.c0000644000000000000000000003070714516475732016370 0ustar0000000000000000/* * crun - OCI runtime written in C * * Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano * crun is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * crun 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 crun. If not, see . */ #include #include #include #include #include #include #include typedef int (*test) (); extern int cpuset_string_to_bitmask (const char *str, char **out, size_t *out_size, libcrun_error_t *err); static int test_socket_pair () { libcrun_error_t err = NULL; int fds[2]; __attribute__ ((unused)) cleanup_close int fd0 = -1; __attribute__ ((unused)) cleanup_close int fd1 = -1; char buffer[256]; int ret = create_socket_pair (fds, &err); if (ret < 0) return -1; fd0 = fds[0]; fd1 = fds[1]; if (err != NULL) return -1; ret = write (fds[0], "HELLO", 6); if (ret != 6) return -1; ret = read (fds[1], buffer, sizeof (buffer)); if (ret != 6) return -1; if (strcmp (buffer, "HELLO") != 0) return -1; ret = write (fds[1], "WORLD", 6); if (ret != 6) return -1; ret = read (fds[0], buffer, sizeof (buffer)); if (ret != 6) return -1; if (strcmp (buffer, "WORLD") != 0) return -1; return 0; } static int test_send_receive_fd () { libcrun_error_t err = NULL; int fds[2], pipes[2]; cleanup_close int fd0 = -1; cleanup_close int fd1 = -1; pid_t pid; int ret = create_socket_pair (fds, &err); if (ret < 0) return -1; fd0 = fds[0]; fd1 = fds[1]; if (err != NULL) return -1; pid = fork (); if (pid < 0) return -1; if (pid) { cleanup_close int pipefd0 = -1; cleanup_close int pipefd1 = -1; char buffer[256]; const char *test_string = "TEST STRING"; if (pipe (pipes) < 0) return -1; pipefd0 = pipes[0]; pipefd1 = pipes[1]; close (fd0); fd0 = -1; if (send_fd_to_socket (fd1, pipefd0, &err) < 0) return -1; if (write (pipefd1, test_string, strlen (test_string) + 1) < 0) return -1; ret = read (fd1, buffer, sizeof (buffer)); if (ret < 0) return -1; if (ret != (int) strlen (test_string) + 1) return -1; return strcmp (buffer, test_string); } else { char buffer[256]; int ret, fd = receive_fd_from_socket (fd0, &err); if (fd < 0) _exit (1); close (fd1); fd1 = -1; ret = read (fd, buffer, sizeof (buffer)); if (ret <= 0) return -1; if (write (fd0, buffer, ret) < 0) return -1; _exit (0); } return 0; } static int test_run_process () { libcrun_error_t err = NULL; { char *args[] = { "/bin/true", NULL }; if (run_process (args, &err) != 0) return -1; } { char *args[] = { "/bin/false", NULL }; if (run_process (args, &err) <= 0) return -1; if (err != NULL) return -1; } { char *args[] = { "/does/not/exist", NULL }; int r = run_process (args, &err); if (r <= 0) return -1; if (err != NULL) return -1; } return 0; } static int test_dir_p () { libcrun_error_t err; if (crun_dir_p ("/usr", false, &err) <= 0) return -1; if (crun_dir_p ("/dev/zero", false, &err) != 0) return -1; if (crun_dir_p ("/hopefully/does/not/really/exist", false, &err) >= 0) return -1; return 0; } static int test_write_read_file () { libcrun_error_t err = NULL; cleanup_free char *name = NULL; size_t len; size_t i; int ret, failed = 0; size_t max = 1 << 10; cleanup_free char *written = xmalloc (max); xasprintf (&name, "tests/write-file-%i", getpid ()); for (i = 0; i < max; i++) written[i] = i; for (i = 1; i <= max; i *= 2) { cleanup_free char *read_buf = NULL; ret = write_file (name, written, i, &err); if (ret < 0) { failed = 1; break; } ret = read_all_file (name, &read_buf, &len, &err); if (ret < 0) { failed = 1; break; } if (len != i) { failed = 1; break; } if (memcmp (read_buf, written, len) != 0) { failed = 1; break; } } unlink (name); return failed ? -1 : 0; } static int test_crun_path_exists () { libcrun_error_t err = NULL; if (crun_path_exists ("/dev/null", &err) <= 0) return -1; if (crun_path_exists ("/usr/foo/bin/ls", &err) != 0) return -1; if (crun_path_exists ("/proc/sysrq-trigger", &err) != 1) return -1; return 0; } static int test_path_is_slash_dev () { if (! path_is_slash_dev ("/dev")) return -1; if (! path_is_slash_dev ("/dev//")) return -1; if (! path_is_slash_dev ("///dev///")) return -1; if (! path_is_slash_dev ("/dev/")) return -1; if (! path_is_slash_dev ("dev")) return -1; if (! path_is_slash_dev ("dev////")) return -1; if (path_is_slash_dev ("dev////foo")) return -1; if (path_is_slash_dev ("/dev/foo")) return -1; if (path_is_slash_dev ("/dev/foo/")) return -1; if (path_is_slash_dev ("/dev/foo/bar")) return -1; if (path_is_slash_dev ("///dev/foo//bar")) return -1; if (path_is_slash_dev ("///dev/foo/////")) return -1; return 0; } static int test_append_paths () { #define PROLOGUE() \ cleanup_free char *out = NULL; \ libcrun_error_t err = NULL; \ int ret; #define EXPECT_STRING(exp) \ { \ if (ret < 0 || out == NULL) \ { \ crun_error_release (&err); \ return ret; \ } \ if (strcmp (out, exp)) \ return -1; \ } { PROLOGUE (); ret = append_paths (&out, &err, "/sys/fs/cgroup/", "memory", "some/path", NULL); EXPECT_STRING ("/sys/fs/cgroup/memory/some/path"); } { PROLOGUE (); ret = append_paths (&out, &err, "/sys/fs/cgroup", "memory", "some/path", NULL); EXPECT_STRING ("/sys/fs/cgroup/memory/some/path"); } { PROLOGUE (); ret = append_paths (&out, &err, "/sys/fs/cgroup////////", "memory////////", "some/path//////", NULL); EXPECT_STRING ("/sys/fs/cgroup/memory/some/path"); } { PROLOGUE (); ret = append_paths (&out, &err, "/sys/fs/cgroup////////", "memory////////", "///////some/path//////", NULL); EXPECT_STRING ("/sys/fs/cgroup/memory/some/path"); } { PROLOGUE (); ret = append_paths (&out, &err, "", "//", "", "", "", NULL); EXPECT_STRING ("/"); } { PROLOGUE (); ret = append_paths (&out, &err, "///", "/", "", "///", "a", NULL); EXPECT_STRING ("/a"); } { PROLOGUE (); ret = append_paths (&out, &err, "////", "/////", "///", "", "", NULL); EXPECT_STRING ("/"); } { PROLOGUE (); ret = append_paths (&out, &err, "", "", "", "", "", NULL); EXPECT_STRING (""); } { PROLOGUE (); ret = append_paths (&out, &err, "", "///sys/fs/cgroup////////", "", "some/path", NULL); EXPECT_STRING ("/sys/fs/cgroup/some/path"); } { PROLOGUE (); ret = append_paths (&out, &err, "a", "b", "c", "d", "a", "b", "c", "d", "a", "b", "c", "d", "a", "b", "c", "d", "a", "b", "c", "d", "a", "b", "c", "d", "a", "b", "c", "d", "a", "b", "c", "d", "a", "b", "c", "d", NULL); if (ret == 0) return -1; crun_error_release (&err); } return 0; } #ifdef HAVE_SYSTEMD static int test_parse_sd_array () { char *out, *next; libcrun_error_t err = NULL; { cleanup_free char *s = xstrdup (" 'firewalld.service' "); if (parse_sd_array (s, &out, &next, &err) < 0) { crun_error_release (&err); return -1; } if (strcmp (out, "firewalld.service")) return -1; if (next != NULL) return -1; } { cleanup_free char *s = xstrdup ("'fir\\ewalld.ser\\vi\\ce']"); if (parse_sd_array (s, &out, &next, &err) < 0) { crun_error_release (&err); return -1; } if (strcmp (out, "firewalld.service")) return -1; if (next != NULL) return -1; } { cleanup_free char *s = xstrdup ("'fi\\rew\\alld.s\\erv\\ice', 'foo.service']"); if (parse_sd_array (s, &out, &next, &err) < 0) { crun_error_release (&err); return -1; } if (strcmp (out, "firewalld.service")) return -1; if (strcmp (next, " 'foo.service']")) return -1; } return 0; } static int test_get_scope_path () { # define CHECK(x, y) \ { \ cleanup_free char *r = x; \ if (strcmp (r, y)) \ { \ fprintf (stderr, "expected %s, got %s\n", y, r); \ return -1; \ } \ } CHECK (get_cgroup_scope_path ("foo.scope", "foo.scope"), "foo.scope"); CHECK (get_cgroup_scope_path ("/foo/bar/user.slice/foo.scope/a/b/c", "foo.scope"), "/foo/bar/user.slice/foo.scope"); CHECK (get_cgroup_scope_path ("/foo/bar-foo.scope/user.slice/foo.scope/a/b/c", "foo.scope"), "/foo/bar-foo.scope/user.slice/foo.scope"); CHECK (get_cgroup_scope_path ("/foo/foo.scope-bar/user.slice/foo.scope/a/b/c", "foo.scope"), "/foo/foo.scope-bar/user.slice/foo.scope"); CHECK (get_cgroup_scope_path ("////foo.scope", "foo.scope"), "////foo.scope"); # undef CHECK return 0; } static int test_cpuset_string_to_bitmask () { libcrun_error_t err = NULL; cleanup_free char *mask = NULL; size_t mask_size; if (cpuset_string_to_bitmask ("0", &mask, &mask_size, &err) < 0) return -1; if (mask_size != 1 || mask[0] != 0x01) return -1; free (mask); mask = NULL; if (cpuset_string_to_bitmask ("0-1", &mask, &mask_size, &err) < 0) return -1; if (mask_size != 1 || mask[0] != 0x03) return -1; free (mask); mask = NULL; if (cpuset_string_to_bitmask ("0,2", &mask, &mask_size, &err) < 0) return -1; if (mask_size != 1 || mask[0] != 0x05) return -1; free (mask); mask = NULL; if (cpuset_string_to_bitmask ("0-2", &mask, &mask_size, &err) < 0) return -1; if (mask_size != 1 || mask[0] != 0x07) return -1; free (mask); mask = NULL; if (cpuset_string_to_bitmask ("0,8", &mask, &mask_size, &err) < 0) return -1; if (mask_size != 2 || mask[0] != 0x01 || mask[1] != 0x01) return -1; free (mask); mask = NULL; if (cpuset_string_to_bitmask ("a", &mask, &mask_size, &err) == 0) return -1; if (cpuset_string_to_bitmask ("-1", &mask, &mask_size, &err) == 0) return -1; if (cpuset_string_to_bitmask ("0-", &mask, &mask_size, &err) == 0) return -1; if (cpuset_string_to_bitmask ("0-2,4-6", &mask, &mask_size, &err) < 0) return -1; if (mask_size != 1 || mask[0] != 0x77) return -1; free (mask); mask = NULL; return 0; } #endif static void run_and_print_test_result (const char *name, int id, test t) { int ret = t (); if (ret == 0) printf ("ok %d - %s\n", id, name); else if (ret == 77) printf ("ok %d - %s #SKIP\n", id, name); else printf ("not ok %d - %s\n", id, name); } #define RUN_TEST(T) \ do \ { \ run_and_print_test_result (#T, id++, T); \ } while (0) int main () { int id = 1; #ifdef HAVE_SYSTEMD printf ("1..11\n"); #else printf ("1..8\n"); #endif RUN_TEST (test_crun_path_exists); RUN_TEST (test_write_read_file); RUN_TEST (test_run_process); RUN_TEST (test_dir_p); RUN_TEST (test_socket_pair); RUN_TEST (test_send_receive_fd); RUN_TEST (test_append_paths); RUN_TEST (test_path_is_slash_dev); #ifdef HAVE_SYSTEMD RUN_TEST (test_parse_sd_array); RUN_TEST (test_get_scope_path); RUN_TEST (test_cpuset_string_to_bitmask); #endif return 0; } crun-1.16.1/tests/test_capabilities.py0000775000000000000000000001362214127766112016161 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import json import os import shutil import sys from tests_utils import * def test_no_caps(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/status'] add_all_namespaces(conf) conf['process']['capabilities'] = {} for i in ['bounding', 'effective', 'inheritable', 'permitted', 'ambient']: conf['process']['capabilities'][i] = [] out, _ = run_and_get_output(conf) proc_status = parse_proc_status(out) for i in ['CapInh', 'CapPrm', 'CapEff', 'CapBnd', 'CapAmb']: if proc_status[i] != "0000000000000000": return -1 return 0 def test_some_caps(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/status'] add_all_namespaces(conf) conf['process']['capabilities'] = {} for i in ['bounding', 'effective', 'inheritable', 'permitted', 'ambient']: conf['process']['capabilities'][i] = [] out, _ = run_and_get_output(conf) proc_status = parse_proc_status(out) for i in ['CapInh', 'CapPrm', 'CapEff', 'CapBnd', 'CapAmb']: if proc_status[i] != "0000000000000000": return -1 return 0 def test_unknown_caps(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/status'] add_all_namespaces(conf) conf['process']['capabilities'] = {} # unknown caps must be ignored for i in ['bounding', 'effective', 'inheritable', 'permitted', 'ambient']: conf['process']['capabilities'][i] = ['CAP_UNKNOWN', 'UNKNOWN_CAP'] out, _ = run_and_get_output(conf) proc_status = parse_proc_status(out) for i in ['CapInh', 'CapPrm', 'CapEff', 'CapBnd', 'CapAmb']: if proc_status[i] != "0000000000000000": return -1 return 0 def test_new_privs(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/status'] add_all_namespaces(conf) conf['process']['noNewPrivileges'] = True out, _ = run_and_get_output(conf) proc_status = parse_proc_status(out) no_new_privs = proc_status['NoNewPrivs'] if no_new_privs != "1": print("invalid value for NoNewPrivs, found %s" % no_new_privs) return -1 with open("/proc/self/status") as f: host_proc_status = parse_proc_status("\n".join(f.readlines())) no_new_privs = proc_status['NoNewPrivs'] # if nonewprivs is already set, it cannot be unset, so skip the # next test if no_new_privs: return 0 conf['process']['noNewPrivileges'] = False out, _ = run_and_get_output(conf) proc_status = parse_proc_status(out) no_new_privs = proc_status['NoNewPrivs'] if no_new_privs != "0": print("invalid value for NoNewPrivs, found %s" % no_new_privs) return -1 return 0 def helper_test_some_caps(uid, captypes, proc_name): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/status'] add_all_namespaces(conf) conf['process']['user']['uid'] = uid conf['process']['capabilities'] = {} for i in captypes + ['bounding']: conf['process']['capabilities'][i] = ["CAP_SYS_ADMIN"] out, _ = run_and_get_output(conf) proc_status = parse_proc_status(out) if proc_status[proc_name] != "0000000000200000": return -1 return 0 def test_some_caps_bounding(): return helper_test_some_caps(0, ["bounding"], 'CapBnd') def test_some_caps_inheritable(): return helper_test_some_caps(0, ["inheritable"], 'CapInh') def test_some_caps_ambient(): return helper_test_some_caps(0, ["ambient", "permitted", "inheritable"], 'CapAmb') def test_some_caps_permitted(): return helper_test_some_caps(0, ["permitted"], 'CapPrm') def test_some_caps_effective_non_root(): if is_rootless(): return 77 return helper_test_some_caps(1000, ["effective", "permitted", "inheritable", "ambient"], 'CapEff') def test_some_caps_bounding_non_root(): if is_rootless(): return 77 return helper_test_some_caps(1000, ["bounding"], 'CapBnd') def test_some_caps_inheritable_non_root(): if is_rootless(): return 77 return helper_test_some_caps(1000, ["inheritable"], 'CapInh') def test_some_caps_ambient_non_root(): if is_rootless(): return 77 return helper_test_some_caps(1000, ["ambient", "permitted", "inheritable"], 'CapAmb') def test_some_caps_permitted_non_root(): if is_rootless(): return 77 return helper_test_some_caps(1000, ["ambient", "permitted", "inheritable"], 'CapPrm') all_tests = { "no-caps" : test_no_caps, "new-privs" : test_new_privs, "some-caps-bounding" : test_some_caps_bounding, "some-caps-inheritable" : test_some_caps_inheritable, "some-caps-ambient" : test_some_caps_ambient, "some-caps-permitted" : test_some_caps_permitted, "some-caps-effective-non-root" : test_some_caps_effective_non_root, "some-caps-bounding-non-root" : test_some_caps_bounding_non_root, "some-caps-inheritable-non-root" : test_some_caps_inheritable_non_root, "some-caps-ambient-non-root" : test_some_caps_ambient_non_root, "some-caps-permitted-non-root" : test_some_caps_permitted_non_root, "unknown-caps" : test_unknown_caps, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_cwd.py0000775000000000000000000000213114127766112014276 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . from tests_utils import * def test_cwd(): conf = base_config() conf['process']['args'] = ['/init', 'cwd'] conf['process']['cwd'] = "/var" add_all_namespaces(conf) out, _ = run_and_get_output(conf) if "/var" not in out: return -1 return 0 all_tests = { "cwd" : test_cwd, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_checkpoint_restore.py0000755000000000000000000001541614406334420017414 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2020 Adrian Reber # crun 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. # # crun 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 crun. If not, see . import time import json import os import subprocess from tests_utils import * criu_version = 0 def _get_criu_version(): global criu_version if criu_version != 0: return criu_version args = ["criu", "--version"] version_output = subprocess.check_output(args, close_fds=False).decode().split('\n') if len(version_output) < 1: return 0 first_line = version_output[0].split(':') if len(first_line) != 2: return 0 version_string = first_line[1].split('.') if len(version_string) < 2: return 0 version = int(version_string[0]) * 10000 version += int(version_string[1]) * 100 if len(version_string) == 3: version += int(version_string[2]) if len(version_output) > 1: if version_output[1].startswith('GitID'): version -= version % 100 version += 100 return version def _get_cmdline(cid, tests_root): s = {} for _ in range(50): try: if os.path.exists(os.path.join(tests_root, 'root/%s/status' % cid)): s = json.loads(run_crun_command(["state", cid])) break else: time.sleep(0.1) except Exception as e: time.sleep(0.1) if len(s) == 0: return "" if s['status'] != "running": return "" if s['id'] != cid: return "" with open("/proc/%s/cmdline" % s['pid'], 'r') as cmdline_fd: return cmdline_fd.read() return "" def run_cr_test(conf): cid = None cr_dir = os.path.join(get_tests_root(), 'checkpoint') try: _, cid = run_and_get_output( conf, all_dev_null=True, use_popen=True, detach=True ) first_cmdline = _get_cmdline(cid, get_tests_root()) if first_cmdline == "": return -1 run_crun_command(["checkpoint", "--image-path=%s" % cr_dir, cid]) bundle = os.path.join( get_tests_root(), cid.split('-')[1] ) run_crun_command([ "restore", "-d", "--image-path=%s" % cr_dir, "--bundle=%s" % bundle, cid ]) second_cmdline = _get_cmdline(cid, get_tests_root()) if first_cmdline != second_cmdline: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_cr_pre_dump(): if is_rootless() or 'CRIU' not in get_crun_feature_string(): return 77 if _get_criu_version() < 31700: return 77 has_pre_dump = False for i in run_crun_command(["checkpoint", "--help"]).split('\n'): if "pre-dump" in i: has_pre_dump = True break if not has_pre_dump: return 77 def _get_pre_dump_size(cr_dir): size = 0 for f in os.listdir(cr_dir): if os.path.isfile(os.path.join(cr_dir, f)): size += os.path.getsize(os.path.join(cr_dir, f)) return size conf = base_config() conf['process']['args'] = [ '/init', 'memhog', '10' ] add_all_namespaces(conf) cid = None cr_dir = os.path.join(get_tests_root(), 'pre-dump') try: _, cid = run_and_get_output( conf, all_dev_null=True, use_popen=True, detach=True ) first_cmdline = _get_cmdline(cid, get_tests_root()) if first_cmdline == "": return -1 # Let's do one pre-dump first run_crun_command([ "checkpoint", "--pre-dump", "--image-path=%s" % cr_dir, cid ]) # Get the size of the pre-dump pre_dump_size = _get_pre_dump_size(cr_dir) # Do the final dump. This dump should be much smaller. cr_dir = os.path.join(get_tests_root(), 'checkpoint') run_crun_command([ "checkpoint", "--parent-path=../pre-dump", "--image-path=%s" % cr_dir, cid ]) final_dump_size = _get_pre_dump_size(cr_dir) if (final_dump_size > pre_dump_size): # If the final dump is not smaller than the pre-dump # something was not working as expected. return -1 bundle = os.path.join( get_tests_root(), cid.split('-')[1] ) run_crun_command([ "restore", "-d", "--image-path=%s" % cr_dir, "--bundle=%s" % bundle, cid ]) second_cmdline = _get_cmdline(cid, get_tests_root()) if first_cmdline != second_cmdline: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_cr(): if is_rootless() or 'CRIU' not in get_crun_feature_string(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) return run_cr_test(conf) def test_cr_with_ext_ns(): if is_rootless() or 'CRIU' not in get_crun_feature_string(): return 77 if _get_criu_version() < 31601: return 77 conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) ns_path = os.path.join('/proc', str(os.getpid()), 'ns') for ns in conf['linux']['namespaces']: if ns['type'] == 'pid': ns.update({'path': os.path.join(ns_path, 'pid')}) if ns['type'] == 'network': ns.update({'path': os.path.join(ns_path, 'net')}) if ns['type'] == 'ipc': ns.update({'path': os.path.join(ns_path, 'ipc')}) if ns['type'] == 'uts': ns.update({'path': os.path.join(ns_path, 'uts')}) if ns['type'] == 'time': ns.update({'path': os.path.join(ns_path, 'time')}) return run_cr_test(conf) all_tests = { "checkpoint-restore": test_cr, "checkpoint-restore-ext-ns": test_cr_with_ext_ns, "checkpoint-restore-pre-dump": test_cr_pre_dump, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_devices.py0000755000000000000000000001500514554235516015150 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import os from tests_utils import * def test_mode_device(): if is_rootless(): return 77 # verify the umask doesn't affect the result os.umask(0o22) for have_userns in [True, False]: conf = base_config() add_all_namespaces(conf, userns=have_userns) if have_userns: fullMapping = [ { "containerID": 0, "hostID": 0, "size": 4294967295 } ] conf['linux']['uidMappings'] = fullMapping conf['linux']['gidMappings'] = fullMapping conf['process']['args'] = ['/init', 'mode', '/dev/foo'] conf['linux']['devices'] = [{"path": "/dev/foo", "type": "b", "major": 1, "minor": 5, "uid": 10, "gid": 11, "fileMode": 0o157},] try: expected = "157" out = run_and_get_output(conf) if expected not in out[0]: sys.stderr.write("wrong file mode, found %s instead of %s with userns=%s" % (out[0], expected, have_userns)) return True return False except Exception as e: print(e) return -1 return 0 def test_owner_device(): if is_rootless(): return 77 for have_userns in [True, False]: conf = base_config() add_all_namespaces(conf, userns=have_userns) if have_userns: fullMapping = [ { "containerID": 0, "hostID": 0, "size": 4294967295 } ] conf['linux']['uidMappings'] = fullMapping conf['linux']['gidMappings'] = fullMapping conf['process']['args'] = ['/init', 'owner', '/dev/foo'] conf['linux']['devices'] = [{"path": "/dev/foo", "type": "b", "major": 1, "minor": 5, "uid": 10, "gid": 11},] try: expected = "10:11" out = run_and_get_output(conf) if expected not in out[0]: sys.stderr.write("wrong file owner, found %s instead of %s with userns=%s" % (out[0], expected, have_userns)) return True return False except Exception as e: return -1 return 0 def test_deny_devices(): if is_rootless(): return 77 try: os.stat("/dev/fuse") except: return 77 conf = base_config() add_all_namespaces(conf) conf['process']['args'] = ['/init', 'open', '/dev/fuse'] conf['linux']['resources'] = {"devices": [{"allow": False, "access": "rwm"}]} dev = { "destination": "/dev", "type": "bind", "source": "/dev", "options": [ "rbind", "rw" ] } conf['mounts'].append(dev) try: run_and_get_output(conf) except Exception as e: if "Operation not permitted" in e.output.decode(): return 0 return -1 def test_create_or_bind_mount_device(): try: os.stat("/dev/fuse") except: return 77 conf = base_config() add_all_namespaces(conf) conf['process']['args'] = ['/init', 'access', '/dev/fuse'] conf['linux']['devices'] = [{ "path": "/dev/fuse", "type": "c", "major": 10, "minor": 229, "fileMode": 0o775, "uid": 0, "gid": 0 }] try: run_and_get_output(conf) except Exception as e: sys.stderr.write(str(e) + "\n") return -1 return 0 def test_allow_device(): if is_rootless(): return 77 try: os.stat("/dev/fuse") except: return 77 conf = base_config() add_all_namespaces(conf) conf['process']['args'] = ['/init', 'open', '/dev/fuse'] conf['linux']['resources'] = {"devices": [{"allow": False, "access": "rwm"}, {"allow": True, "type": "c", "major": 10, "minor": 229, "access": "r"}]} dev = { "destination": "/dev", "type": "bind", "source": "/dev", "options": [ "rbind", "rw" ] } conf['mounts'].append(dev) try: run_and_get_output(conf) except Exception as e: return -1 return 0 def test_allow_access(): if is_rootless(): return 77 try: os.stat("/dev/fuse") except: return 77 conf = base_config() add_all_namespaces(conf) conf['process']['args'] = ['/init', 'access', '/dev/fuse'] conf['linux']['resources'] = {"devices": [{"allow": False, "access": "rwm"}, {"allow": True, "type": "c", "major": 10, "minor": 229, "access": "rw"}]} dev = { "destination": "/dev", "type": "bind", "source": "/dev", "options": [ "rbind", "rw" ] } conf['mounts'].append(dev) try: run_and_get_output(conf) except Exception as e: return -1 return 0 def test_mknod_device(): if is_rootless(): return 77 conf = base_config() add_all_namespaces(conf) conf['process']['args'] = ['/init', 'true'] conf['linux']['devices'] = [{"path": "/foo-dev", "type": "b", "major": 10, "minor": 229}, {"path": "/subdir/foo-dev", "type": "b", "major": 10, "minor": 229},] try: run_and_get_output(conf) except Exception as e: return -1 return 0 all_tests = { "owner-device" : test_owner_device, "deny-devices" : test_deny_devices, "allow-device" : test_allow_device, "allow-access" : test_allow_access, "mknod-device" : test_mknod_device, "mode-device" : test_mode_device, "create-or-bind-mount-device" : test_create_or_bind_mount_device, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_hostname.py0000775000000000000000000000216614127766112015347 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . from tests_utils import * def test_hostname(): conf = base_config() conf['process']['args'] = ['/init', 'gethostname'] conf['hostname'] = "foomachine" add_all_namespaces(conf) out, _ = run_and_get_output(conf) if "foomachine" not in out: return -1 return 0 all_tests = { "hostname" : test_hostname, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_limits.py0000755000000000000000000000377114551252466015036 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . from tests_utils import * def test_limit_pid_minus_1(): conf = base_config() add_all_namespaces(conf) if is_rootless(): return 77 conf['process']['args'] = ['/init', 'cat', '/dev/null'] conf['linux']['resources'] = {"pids" : {"limit" : -1}} out, _ = run_and_get_output(conf) if len(out) == 0: return 0 return -1 def test_limit_pid_0(): conf = base_config() add_all_namespaces(conf) if is_rootless(): return 77 conf['process']['args'] = ['/init', 'cat', '/dev/null'] conf['linux']['resources'] = {"pids" : {"limit" : 0}} out, _ = run_and_get_output(conf) if len(out) == 0: return 0 return -1 def test_limit_pid_n(): conf = base_config() if is_rootless(): return 77 add_all_namespaces(conf) conf['process']['args'] = ['/init', 'forkbomb', '20'] conf['linux']['resources'] = {"pids" : {"limit" : 10}} try: run_and_get_output(conf) except Exception as e: if "fork: Resource temporarily unavailable" in e.output.decode(): return 0 return -1 all_tests = { "limit-pid-minus-1" : test_limit_pid_minus_1, "limit-pid-0" : test_limit_pid_0, "limit-pid-n" : test_limit_pid_n, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_oci_features.py0000644000000000000000000001753414614667631016210 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # crun 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. # # crun 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 crun. If not, see . import subprocess import json import re from tests_utils import * def is_systemd_enabled(): return 'SYSTEMD' in get_crun_feature_string() def is_seccomp_enabled(): return 'SECCOMP' in get_crun_feature_string() def get_crun_commit(): try: output = subprocess.check_output([get_crun_path(), "--version"]).decode() commit_match = re.search(r"commit: ([\w]+)", output) if commit_match: return commit_match.group(1) else: raise ValueError("Commit information not found") except (subprocess.CalledProcessError, ValueError) as e: print(f"Error retrieving crun commit: {str(e)}") return None def test_crun_features(): try: output = run_crun_command(["features"]) features = json.loads(output) expected_features = { "ociVersionMin": "1.0.0", "ociVersionMax": "1.1.0+dev", "hooks": [ "prestart", "createRuntime", "createContainer", "startContainer", "poststart", "poststop" ], "mountOptions": [ "rw", "rrw", "ro", "rro", "rdirsync", "rdiratime", "rnodev", "rnorelatime", "nodiratime", "rnodiratime", "diratime", "rnoatime", "rnomand", "ratime", "rmand", "mand", "idmap", "noatime", "nomand", "dirsync", "rnosuid", "atime", "rnoexec", "nodev", "rbind", "norelatime", "bind", "rnostrictatime", "strictatime", "rstrictatime", "rprivate", "rsuid", "remount", "suid", "nostrictatime", "rrelatime", "nosuid", "noexec", "rslave", "dev", "rdev", "rsync", "relatime", "sync", "shared", "rshared", "unbindable", "runbindable", "defaults", "async", "rasync", "private", "tmpcopyup", "rexec", "copy-symlink", "exec", "slave" ], "linux": { "namespaces": [ "cgroup", "ipc", "mount", "network", "pid", "user", "uts" ], "capabilities": [ ], "cgroup": { "v1": True, "v2": True, }, "seccomp": { "actions": [ "SCMP_ACT_ALLOW", "SCMP_ACT_ERRNO", "SCMP_ACT_KILL", "SCMP_ACT_KILL_PROCESS", "SCMP_ACT_KILL_THREAD", "SCMP_ACT_LOG", "SCMP_ACT_NOTIFY", "SCMP_ACT_TRACE", "SCMP_ACT_TRAP" ], "operators": [ "SCMP_CMP_NE", "SCMP_CMP_LT", "SCMP_CMP_LE", "SCMP_CMP_EQ", "SCMP_CMP_GE", "SCMP_CMP_GT", "SCMP_CMP_MASKED_EQ" ] }, "apparmor": { "enabled": True }, "selinux": { "enabled": True }, "mountExtensions": { "idmap": { "enabled": True, }, } }, "annotations": { "org.opencontainers.runc.checkpoint.enabled": "true", "run.oci.checkpoint.enabled": "true", "run.oci.commit": get_crun_commit(), }, "potentiallyUnsafeConfigAnnotations": [ "module.wasm.image/variant", "io.kubernetes.cri.container-type", "run.oci.", ] } systemd_enabled = is_systemd_enabled() seccomp_enabled = is_seccomp_enabled() if seccomp_enabled: expected_features["linux"]["seccomp"]["enabled"] = True # Check if systemd is enabled and set systemdUser accordingly if systemd_enabled: expected_features["linux"]["cgroup"]["systemd"] = True expected_features["linux"]["cgroup"]["systemdUser"] = True for key, value in expected_features.items(): if key == "linux" and isinstance(value, dict) and "capabilities" in value: if "capabilities" in features.get("linux", {}): capabilities = features["linux"]["capabilities"] if not ("CAP_SYS_ADMIN" in capabilities and "CAP_KILL" in capabilities and "CAP_NET_BIND_SERVICE" in capabilities): return -1 continue if key == "annotations": if "annotations" not in features: sys.stderr.write("Annotations section is missing\n") return -1 annotations = features["annotations"] if annotations.get("run.oci.crun.commit") != get_crun_commit(): sys.stderr.write("wrong value for run.oci.crun.commit\n") return -1 if ('WASM' in get_crun_feature_string() and annotations.get("run.oci.crun.wasm") != "true"): sys.stderr.write("wrong value for run.oci.crun.wasm\n") return -1 if 'CRIU' in get_crun_feature_string(): if annotations.get("org.opencontainers.runc.checkpoint.enabled") != "true": sys.stderr.write("wrong value for org.opencontainers.runc.checkpoint.enabled\n") return -1 if annotations.get("run.oci.crun.checkpoint.enabled") != "true": sys.stderr.write("wrong value for run.oci.crun.checkpoint.enabled\n") return -1 else: if key not in features or sorted(features[key]) != sorted(value): sys.stderr.write(f"Mismatch in feature: {key}\n") sys.stderr.write(f"Expected: {value}\n") sys.stderr.write(f"Actual: {features.get(key)}\n") return -1 return 0 except Exception as e: print("Error running crun features:", str(e)) return -1 all_tests = { "crun-features" : test_crun_features, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_mounts.py0000755000000000000000000005213314654642544015062 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import sys import copy import socket from tests_utils import * import tempfile try: import libmount except Exception: print("1..0") sys.exit(0) def helper_mount(options, tmpfs=True, userns=False, is_file=False): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/mountinfo'] add_all_namespaces(conf, userns=userns) source_file = os.path.join(get_tests_root(), "a-file") if is_file: with open(source_file, 'w'): pass mount_opt = {"destination": "/var/file", "type": "bind", "source": source_file, "options": ["bind", "rprivate"] + [options]} elif tmpfs: mount_opt = {"destination": "/var/dir", "type": "tmpfs", "source": "tmpfs", "options": [options]} else: mount_opt = {"destination": "/var/dir", "type": "bind", "source": get_tests_root(), "options": ["bind", "rprivate"] + [options]} conf['mounts'].append(mount_opt) out, _ = run_and_get_output(conf, hide_stderr=True) with tempfile.NamedTemporaryFile(mode='w', delete=True) as f: f.write(out) f.flush() t = libmount.Table(f.name) if is_file: m = t.find_target('/var/file') else: m = t.find_target('/var/dir') return [m.vfs_options, m.fs_options] return -1 def test_mount_symlink(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/mountinfo'] add_all_namespaces(conf) mount_opt = {"destination": "/etc/localtime", "type": "bind", "source": "/etc/localtime", "options": ["bind", "ro"]} conf['mounts'].append(mount_opt) out, _ = run_and_get_output(conf, hide_stderr=True) if "Rome" in out: return 0 return -1 def test_mount_fifo(): conf = base_config() conf['process']['args'] = ['/init', 'type', '/fifo'] add_all_namespaces(conf) source_file = os.path.join(get_tests_root(), "a-fifo") os.mkfifo(source_file) for options in ([], ["ro"], ["rro"]): mount_opt = {"destination": "/fifo", "type": "bind", "source": source_file, "options": options + ["bind"]} conf['mounts'].append(mount_opt) out, _ = run_and_get_output(conf, hide_stderr=True) if "FIFO" not in out: return 1 return 0 def test_mount_unix_socket(): conf = base_config() conf['process']['args'] = ['/init', 'type', '/unix-socket'] add_all_namespaces(conf) source_file = os.path.join(get_tests_root(), "unix-socket") server = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) server.bind(source_file) for options in ([], ["ro"], ["rro"]): mount_opt = {"destination": "/unix-socket", "type": "bind", "source": source_file, "options": options + ["bind"]} conf['mounts'].append(mount_opt) out, _ = run_and_get_output(conf, hide_stderr=True) if "socket" not in out: return 1 return 0 def test_mount_tmpfs_permissions(): def prepare_rootfs(rootfs): path = os.path.join(rootfs, "tmp") os.mkdir(path) os.chmod(path, 0o712) conf = base_config() conf['process']['args'] = ['/init', 'mode', '/tmp'] add_all_namespaces(conf) mount_opt = {"destination": "/tmp", "type": "tmpfs", "source": "tmpfs", "options": ["bind", "ro"]} out, _ = run_and_get_output(conf, hide_stderr=True, callback_prepare_rootfs=prepare_rootfs) if "712" in out: return 0 return -1 def test_ro_cgroup(): for cgroupns in [True, False]: for netns in [True, False]: for has_cgroup_mount in [True, False]: conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/mountinfo'] add_all_namespaces(conf, cgroupns=cgroupns, netns=netns) mounts = [ { "destination": "/sys", "type": "sysfs", "source": "sysfs", "options": [ "nosuid", "noexec", "nodev", "ro" ] }, { "destination": "/proc", "type": "proc" } ] if has_cgroup_mount: mounts.append({ "destination": "/sys/fs/cgroup", "type": "cgroup", "source": "cgroup", "options": [ "nosuid", "noexec", "nodev", "relatime", "ro" ] }) conf['mounts'] = mounts out, _ = run_and_get_output(conf, hide_stderr=True) for i in reversed(out.split("\n")): if i.find("/sys/fs/cgroup") >= 0: if i.find("ro,") < 0: print("fail with cgroupns=%s, netns=%s and cgroup_mount=%s, got %s" % (cgroupns, netns, has_cgroup_mount, i), file=sys.stderr) return -1 break return 0 def test_mount_symlink_not_existing(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/mountinfo'] add_all_namespaces(conf) mount_opt = {"destination": "/etc/not-existing", "type": "bind", "source": "/etc/localtime", "options": ["bind", "ro"]} conf['mounts'].append(mount_opt) out, _ = run_and_get_output(conf, hide_stderr=True) if "foo/bar" in out: return 0 return -1 def test_mount_readonly_should_inherit_options_from_parent(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/mountinfo'] add_all_namespaces(conf) mount_opt = {"destination": "/test", "type": "bind", "source": "/tmp", "options": ["rbind", "nosuid","noexec","nodev"]} conf['mounts'].append(mount_opt) mount_opt = {"destination": "/test/world", "type": "bind", "source": "/etc", "options": ["rbind", "nosuid","noexec","nodev"]} conf['mounts'].append(mount_opt) # Move test/world to a readonly path conf['linux']['readonlyPaths'] = ["/test/world"] out, _ = run_and_get_output(conf, hide_stderr=True) # final mount info must contain /test/world which is converted to readonly # but also inherits the flags from its parent if "/test/world ro,nosuid,nodev,noexec,relatime" in out: return 0 return -1 def test_proc_readonly_should_inherit_options_from_parent(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/mountinfo'] add_all_namespaces(conf) for mount in conf['mounts']: if mount['destination'] == "/proc": mount['options'] = ["nosuid", "noexec","nodev"] # Move `/proc/bus` to a readonly path conf['linux']['readonlyPaths'] = ["/proc/bus"] out, _ = run_and_get_output(conf, hide_stderr=True) # final mount info must contain /proc/bus which is converted to readonly # but also inherits the flags from /proc if "/proc/bus ro,nosuid,nodev,noexec,relatime" in out: return 0 return -1 def test_copy_symlink(): root = get_tests_root() symlink = os.path.join(root, "a-broken-link") target = "point-to-nowhere" os.symlink(target, symlink) conf = base_config() conf['process']['args'] = ['/init', 'readlink', '/a/sym/link'] add_all_namespaces(conf) mount_opt = {"destination": "/a/sym/link", "type": "bind", "source": symlink, "options": ["rbind", "copy-symlink"]} conf['mounts'].append(mount_opt) out, _ = run_and_get_output(conf, hide_stderr=True) if target in out: return 0 return -1 def test_mount_path_with_multiple_slashes(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/mountinfo'] add_all_namespaces(conf) mount_opt = {"destination": "/test//test", "type": "bind", "source": "/tmp", "options": ["rbind"]} conf['mounts'].append(mount_opt) out, _ = run_and_get_output(conf, hide_stderr=True) if "test/test" in out: return 0 return -1 def test_mount_ro(): for userns in [True, False]: a = helper_mount("ro", userns=userns, is_file=True)[0] if "ro" not in a: return -1 a = helper_mount("ro", userns=userns)[0] if "ro" not in a: return -1 a = helper_mount("ro", userns=userns, tmpfs=False)[0] if "ro" not in a: return -1 return 0 def test_mount_rro(): for userns in [True, False]: a = helper_mount("rro", userns=userns, is_file=True)[0] if "ro" not in a: return -1 a = helper_mount("rro", userns=userns)[0] if "ro" not in a: return -1 a = helper_mount("rro", userns=userns, tmpfs=False)[0] if "ro" not in a: return -1 return 0 def test_mount_rw(): for userns in [True, False]: a = helper_mount("rw", tmpfs=False, userns=userns)[0] if "rw" not in a: return -1 a = helper_mount("rw", userns=userns, is_file=True)[0] if "rw" not in a: return -1 a = helper_mount("rw", userns=userns)[0] if "rw" not in a: return -1 return 0 def test_mount_relatime(): for userns in [True, False]: a = helper_mount("relatime", tmpfs=False, userns=userns)[0] if "relatime" not in a: return -1 a = helper_mount("relatime", is_file=True, userns=userns)[0] if "relatime" not in a: return -1 a = helper_mount("relatime", userns=userns)[0] if "relatime" not in a: return -1 return 0 def test_mount_strictatime(): for userns in [True, False]: a = helper_mount("strictatime", is_file=True, userns=userns)[0] if "relatime" not in a: return 0 a = helper_mount("strictatime", tmpfs=False, userns=userns)[0] if "relatime" not in a: return 0 a = helper_mount("strictatime", userns=userns)[0] if "relatime" not in a: return 0 return -1 def test_mount_exec(): for userns in [True, False]: a = helper_mount("exec", is_file=True, userns=userns)[0] if "noexec" in a: return -1 a = helper_mount("exec", tmpfs=False, userns=userns)[0] if "noexec" in a: return -1 a = helper_mount("exec", userns=userns)[0] if "noexec" in a: return -1 return 0 def test_mount_noexec(): for userns in [True, False]: a = helper_mount("noexec", is_file=True, userns=userns)[0] if "noexec" not in a: return -1 a = helper_mount("noexec", tmpfs=False, userns=userns)[0] if "noexec" not in a: return -1 a = helper_mount("noexec", userns=userns)[0] if "noexec" not in a: return -1 return 0 def test_mount_suid(): for userns in [True, False]: a = helper_mount("suid", is_file=True, userns=userns)[0] if "nosuid" in a: return -1 a = helper_mount("suid", tmpfs=False, userns=userns)[0] if "nosuid" in a: return -1 a = helper_mount("suid", userns=userns)[0] if "nosuid" in a: return -1 return 0 def test_mount_nosuid(): for userns in [True, False]: a = helper_mount("nosuid", is_file=True, userns=userns)[0] if "nosuid" not in a: return -1 a = helper_mount("nosuid", tmpfs=False, userns=userns)[0] if "nosuid" not in a: return -1 a = helper_mount("nosuid", userns=userns)[0] if "nosuid" not in a: return -1 return 0 def test_mount_sync(): for userns in [True, False]: a = helper_mount("sync", userns=userns)[1] if "sync" not in a: return -1 return 0 def test_mount_dirsync(): for userns in [True, False]: a = helper_mount("dirsync", userns=userns)[1] if "dirsync" not in a: return -1 return 0 def test_mount_nodev(): for userns in [True, False]: a = helper_mount("nodev", is_file=True)[0] if "nodev" not in a: return -1 a = helper_mount("nodev", tmpfs=False)[0] if "nodev" not in a: return -1 a = helper_mount("nodev", userns=userns)[0] if "nodev" not in a: return -1 return 0 def test_mount_dev(): for userns in [True, False]: a = helper_mount("dev", userns=userns, tmpfs=False)[0] if "nodev" in a: return -1 a = helper_mount("dev", userns=userns, is_file=True)[0] if "nodev" in a: return -1 a = helper_mount("dev", userns=userns)[0] if "nodev" in a: return -1 return 0 def test_userns_bind_mount(): if is_rootless(): return 77 conf = base_config() add_all_namespaces(conf, userns=True) fullMapping = [ { "containerID": 0, "hostID": 1, "size": 10 } ] conf['linux']['uidMappings'] = fullMapping conf['linux']['gidMappings'] = fullMapping bind_dir_parent = os.path.join(get_tests_root(), "bind-mount-userns") bind_dir = os.path.join(bind_dir_parent, "m") try: os.makedirs(bind_dir) mount_opt = {"destination": "/foo", "type": "bind", "source": bind_dir, "options": ["bind", "ro"]} conf['mounts'].append(mount_opt) os.chown(bind_dir_parent, 0, 0) os.chmod(bind_dir_parent, 0o000) conf['process']['args'] = ['/init', 'true'] run_and_get_output(conf, chown_rootfs_to=1) finally: shutil.rmtree(bind_dir) return 0 def test_userns_bind_mount_symlink(): if is_rootless(): return 77 conf = base_config() add_all_namespaces(conf, userns=True) fullMapping = [ { "containerID": 0, "hostID": 1, "size": 10 } ] conf['linux']['uidMappings'] = fullMapping conf['linux']['gidMappings'] = fullMapping sys.stderr.write("start") bind_dir_parent = os.path.join(get_tests_root(), "bind-mount-userns-symlink") bind_dir = os.path.join(bind_dir_parent, "m") bind_dir_symlink = os.path.join(bind_dir_parent, "s") try: os.makedirs(bind_dir) os.symlink(bind_dir, bind_dir_symlink) with open(os.path.join(bind_dir, "content"), "w+") as f: f.write("hello") mount_opt = {"destination": "/foo", "type": "bind", "source": bind_dir_symlink, "options": ["bind", "ro"]} conf['mounts'].append(mount_opt) os.chown(bind_dir_parent, 0, 0) os.chmod(bind_dir_parent, 0o000) conf['process']['args'] = ['/init', 'cat', "/foo/content"] out, _ = run_and_get_output(conf, chown_rootfs_to=1) if out != "hello": sys.stderr.write("wrong file owner, found %s instead of %s" % (out, "hello")) return -1 finally: shutil.rmtree(bind_dir) return 0 def test_idmapped_mounts(): if is_rootless(): return 77 source_dir = os.path.join(get_tests_root(), "test-idmapped-mounts") try: os.makedirs(source_dir) target = os.path.join(source_dir, "file") with open(target, "w+") as f: f.write("") os.chown(target, 0, 0) idmapped_mounts_status = subprocess.call([get_init_path(), "check-feature", "idmapped-mounts", source_dir]) if idmapped_mounts_status != 0: return 77 template = base_config() add_all_namespaces(template, userns=True) fullMapping = [ { "containerID": 0, "hostID": 1, "size": 10 } ] template['linux']['uidMappings'] = fullMapping template['linux']['gidMappings'] = fullMapping template['process']['args'] = ['/init', 'owner', '/foo/file'] def check(uidMappings, gidMappings, recursive, expected): # to properly check recursive we'd need to add a mount on the host. But we don't want to perform # any mount on the host, so we just check that the recursive option at least doesn't fail and works # as a regular idmapped mount. conf = copy.deepcopy(template) idmapOption = "ridmap" if recursive else "idmap" options = ["bind", "ro", idmapOption] mount_opt = {"destination": "/foo", "type": "bind", "source": source_dir, "options": options} if uidMappings is not None: mount_opt["uidMappings"] = uidMappings if gidMappings is not None: mount_opt["gidMappings"] = gidMappings conf['mounts'].append(mount_opt) out = run_and_get_output(conf, chown_rootfs_to=1) if expected not in out[0]: sys.stderr.write("wrong file owner, found %s instead of %s" % (out[0], expected)) return True return False # and now test with uidMappings and gidMappings os.chown(target, 0, 0) mountMappings = [ { "containerID": 0, "hostID": 1, "size": 10 } ] if check(mountMappings, mountMappings, False, "0:0"): return 1 if check(mountMappings, mountMappings, True, "0:0"): return 1 mountMappings = [ { "containerID": 0, "hostID": 2, "size": 10 } ] if check(mountMappings, mountMappings, False, "1:1"): return 1 if check(mountMappings, mountMappings, True, "1:1"): return 1 finally: shutil.rmtree(source_dir) return 0 def test_cgroup_mount_without_netns(): for cgroupns in [True, False]: conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/mountinfo'] add_all_namespaces(conf, cgroupns=cgroupns, netns=False) mounts = [ { "destination": "/proc", "type": "proc" }, { "destination": "/sys", "type": "bind", "source": "/sys", "options": [ "rprivate", "nosuid", "noexec", "nodev", "ro", "rbind" ] }, { "destination": "/sys/fs/cgroup", "type": "cgroup", "source": "cgroup", "options": [ "rprivate", "nosuid", "noexec", "nodev", "rprivate", "relatime", "ro" ] } ] conf['mounts'] = mounts out, _ = run_and_get_output(conf) print(out) for i in out.split("\n"): if i.find("/sys/fs/cgroup") >= 0: if i.find("tmpfs") >= 0: print("tmpfs temporary mount still present with cgroupns=%s %s" % (cgroupns, i)) return -1 return 0 all_tests = { "mount-ro" : test_mount_ro, "mount-rro" : test_mount_rro, "mount-rw" : test_mount_rw, "mount-relatime" : test_mount_relatime, "mount-strictatime" : test_mount_strictatime, "mount-exec" : test_mount_exec, "mount-noexec" : test_mount_noexec, "mount-suid" : test_mount_suid, "mount-nosuid" : test_mount_nosuid, "mount-sync" : test_mount_sync, "mount-dirsync" : test_mount_dirsync, "mount-symlink" : test_mount_symlink, "mount-fifo" : test_mount_fifo, "mount-unix-socket" : test_mount_unix_socket, "mount-symlink-not-existing" : test_mount_symlink_not_existing, "mount-dev" : test_mount_dev, "mount-nodev" : test_mount_nodev, "mount-path-with-multiple-slashes" : test_mount_path_with_multiple_slashes, "mount-userns-bind-mount" : test_userns_bind_mount, "mount-idmapped-mounts" : test_idmapped_mounts, "mount-idmapped-mounts-symlink" : test_userns_bind_mount_symlink, "mount-linux-readonly-should-inherit-flags": test_mount_readonly_should_inherit_options_from_parent, "proc-linux-readonly-should-inherit-flags": test_proc_readonly_should_inherit_options_from_parent, "mount-ro-cgroup": test_ro_cgroup, "mount-cgroup-without-netns": test_cgroup_mount_without_netns, "mount-copy-symlink": test_copy_symlink, "mount-tmpfs-permissions": test_mount_tmpfs_permissions, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_paths.py0000775000000000000000000000313114127766112014641 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . from tests_utils import * def test_readonly_paths(): conf = base_config() conf['root']['readonly'] = False conf['process']['args'] = ['/init', 'write', '/var/file', 'hello'] conf['linux']['readonlyPaths'] = ['/var/file'] add_all_namespaces(conf) try: run_and_get_output(conf) except Exception as e: if "Read-only file system" in e.output.decode(): return 0 return -1 def test_masked_paths(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/var/file'] conf['linux']['maskedPaths'] = ['/var/file'] add_all_namespaces(conf) out, _ = run_and_get_output(conf, hide_stderr=True) if len(out) > 0: return -1 return 0 all_tests = { "readonly-paths" : test_readonly_paths, "masked-paths" : test_masked_paths, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_pid.py0000775000000000000000000000273314127766112014305 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . from tests_utils import * def test_pid(): if is_rootless(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/status'] conf['linux']['namespaces'].append({"type" : "pid"}) out, _ = run_and_get_output(conf) pid = parse_proc_status(out)['Pid'] if pid == "1": return 0 return -1 def test_pid_user(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/status'] add_all_namespaces(conf) out, _ = run_and_get_output(conf) pid = parse_proc_status(out)['Pid'] if pid == "1": return 0 return -1 all_tests = { "pid" : test_pid, "pid-user" : test_pid_user, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_pid_file.py0000775000000000000000000000243714127766112015305 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import os from tests_utils import * def test_pid_file(): conf = base_config() add_all_namespaces(conf) conf['process']['args'] = ['/init', 'cwd', ''] pid_file = os.path.abspath('test-pid-%s' % os.getpid()) try: run_and_get_output(conf, pid_file=pid_file) with open(pid_file) as p: content = p.read() if len(content) > 0: return 0 finally: os.unlink(pid_file) return -1 all_tests = { "test_pid_file" : test_pid_file, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_preserve_fds.py0000775000000000000000000000365214127766112016221 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import os from tests_utils import * def test_preserve_fds_0(): conf = base_config() add_all_namespaces(conf) conf['process']['args'] = ['/init', 'ls', '/proc/1/fd'] out, _ = run_and_get_output(conf, preserve_fds="0", hide_stderr=True) files = [x for x in out.split('\n') if len(x) > 0 and x[0] != '.'] if all([int(x) < 3 for x in files]): return 0 return -1 def test_preserve_fds_some(): conf = base_config() add_all_namespaces(conf) conf['process']['args'] = ['/init', 'ls', '/proc/1/fd'] with open('/dev/null', 'r') as f1, open('/dev/null', 'r') as f2, open('/dev/null', 'r') as f3: if hasattr(os, 'set_inheritable'): for i in range(100): try: os.set_inheritable(i, True) except: pass out, _ = run_and_get_output(conf, preserve_fds="100", hide_stderr=True) files = [x for x in out.split('\n') if len(x) > 0 and x[0] != '.'] if any([int(x) > 3 for x in files]): return 0 return -1 all_tests = { "preserve-fds-0" : test_preserve_fds_0, "preserve-fds-some" : test_preserve_fds_some, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_uid_gid.py0000755000000000000000000000666214406334420015131 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import os from tests_utils import * def test_userns_full_mapping(): if is_rootless(): return 77 conf = base_config() add_all_namespaces(conf, userns=True) fullMapping = [ { "containerID": 0, "hostID": 0, "size": 4294967295 } ] conf['linux']['uidMappings'] = fullMapping conf['linux']['gidMappings'] = fullMapping for filename in ['uid_map', 'gid_map']: conf['process']['args'] = ['/init', 'cat', '/proc/self/%s' % filename] out, _ = run_and_get_output(conf) proc_status = parse_proc_status(out) if "4294967295" not in out: return -1 return 0 def test_uid(): if is_rootless(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/status'] add_all_namespaces(conf) conf['process']['user']['uid'] = 1000 out, _ = run_and_get_output(conf) proc_status = parse_proc_status(out) ids = proc_status['Uid'].split() for i in ids: if i != "1000": return -1 return 0 def test_gid(): if is_rootless(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/status'] add_all_namespaces(conf) conf['process']['user']['gid'] = 1000 out, _ = run_and_get_output(conf) proc_status = parse_proc_status(out) ids = proc_status['Gid'].split() for i in ids: if i != "1000": return -1 return 0 def test_no_groups(): if is_rootless(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/status'] add_all_namespaces(conf) conf['process']['user']['gid'] = 1000 out, _ = run_and_get_output(conf) proc_status = parse_proc_status(out) ids = proc_status['Groups'].split() if len(ids) > 0: return -1 return 0 def test_keep_groups(): if is_rootless(): return 77 oldgroups = os.getgroups() out = "" try: os.setgroups([1,2,3,4,5]) conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/status'] add_all_namespaces(conf) conf['annotations'] = {} conf['annotations']['run.oci.keep_original_groups'] = "1" out, _ = run_and_get_output(conf) finally: os.setgroups(oldgroups) proc_status = parse_proc_status(out) ids = proc_status['Groups'].split() if len(ids) == 0: return -1 return 0 all_tests = { "uid" : test_uid, "gid" : test_gid, "userns-full-mapping" : test_userns_full_mapping, "no-groups" : test_no_groups, "keep-groups" : test_keep_groups, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_rlimits.py0000775000000000000000000000422514127766112015212 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import sys from tests_utils import * def parse_proc_limits(content): lines = content.split("\n") r = {} mappings = {'Max open files' : "RLIMIT_NOFILE", 'Max processes' : "RLIMIT_NPROC", 'Max cpu time' : "RLIMIT_CPU", 'Max pending signals' : "RLIMIT_SIGPENDING"} for i in lines[1:-1]: s = [x.strip() for x in i.split(" ") if x != ""] r[mappings.get(s[0], s[0])] = s return r def test_rlimits(): if is_rootless(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/limits'] rlimits = [ {"type" : "RLIMIT_SIGPENDING", "soft" : 100, "hard" : 200}, {"type" : "RLIMIT_NPROC", "soft" : 50, "hard" : 100}, {"type" : "RLIMIT_NOFILE", "soft" : 512, "hard" : 512}, {"type" : "RLIMIT_CPU", "soft" : 2, "hard" : 3}, ] conf['process']['rlimits'] = rlimits add_all_namespaces(conf) out, _ = run_and_get_output(conf) limits = parse_proc_limits(out) for v in rlimits: limit = limits.get(v['type']) if str(limit[1]) != str(v['soft']) or str(limit[2]) != str(v['hard']): sys.stderr.write("%s: %s %s\n" % (limit[0], limit[1], limit[2])) return -1 return 0 all_tests = { "rlimits" : test_rlimits, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_tty.py0000775000000000000000000000353514127766112014352 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import os from tests_utils import * def tty_helper(fd): if os.isatty(1) == False: return 77 conf = base_config() conf['process']['args'] = ['/init', 'isatty', fd] conf['process']['terminal'] = True add_all_namespaces(conf) out, _ = run_and_get_output(conf) if "true" not in out: return -1 return 0 def test_stdin_tty(): return tty_helper("0") def test_stdout_tty(): return tty_helper("1") def test_stderr_tty(): return tty_helper("2") def test_tty_and_detach(): if os.isatty(1) == False: return 77 conf = base_config() conf['process']['args'] = ['/init', 'isatty', 0] conf['process']['terminal'] = True add_all_namespaces(conf) try: out, _ = run_and_get_output(conf, detach=True) except Exception as e: if "use --console-socket" in e.output.decode(): return 0 return -1 all_tests = { "test-stdin-tty" : test_stdin_tty, "test-stdout-tty" : test_stdout_tty, "test-stderr-tty" : test_stderr_tty, "test-detach-tty" : test_tty_and_detach, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_hooks.py0000755000000000000000000000433114406334420014637 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import os from tests_utils import * def test_fail_prestart(): conf = base_config() conf['hooks'] = {"prestart" : [{"path" : "/bin/false"}]} add_all_namespaces(conf) try: out, _ = run_and_get_output(conf) except: return 0 return -1 def test_success_prestart(): conf = base_config() conf['hooks'] = {"prestart" : [{"path" : "/bin/true"}]} add_all_namespaces(conf) try: out, _ = run_and_get_output(conf) except: return -1 return 0 def test_hook_env_inherit(): conf = base_config() path = os.getenv("PATH") hook = {"path" : "/bin/sh", "args" : ["/bin/sh", "-c", "test \"$PATH\" = %s" % path]} conf['hooks'] = {"prestart" : [hook]} add_all_namespaces(conf) print(conf['hooks']) try: out, _ = run_and_get_output(conf) except: return -1 return 0 def test_hook_env_no_inherit(): conf = base_config() hook = {"path" : "/bin/sh", "env": ["PATH=/foo"], "args" : ["/bin/sh", "-c", "/bin/test \"$PATH\" == '/foo'"]} conf['hooks'] = {"prestart" : [hook]} add_all_namespaces(conf) print(conf['hooks']) try: out, _ = run_and_get_output(conf) except: return -1 return 0 all_tests = { "test-fail-prestart" : test_fail_prestart, "test-success-prestart" : test_success_prestart, "test-hook-env-inherit" : test_hook_env_inherit, "test-hook-env-no-inherit" : test_hook_env_no_inherit, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_update.py0000775000000000000000000000341214127766112015006 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import os import shutil from tests_utils import * def test_update(): conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) temp_dir = tempfile.mkdtemp(dir=get_tests_root()) out, container_id = run_and_get_output(conf, detach=True) try: p = "/sys/fs/cgroup/memory/system.slice/libcrun-%s.scope/memory.limit_in_bytes" % container_id if not os.path.exists(p): return 77 with open(p) as f: oldval = f.read() res_file = os.path.join(temp_dir, "resources") with open(res_file, 'w') as f: f.write('{"memory": {"limit": 2000000}}') run_crun_command(["update", "-r", res_file, container_id]) with open(p) as f: newval = f.read() if newval != oldval: return 0 finally: run_crun_command(["delete", "-f", container_id]) shutil.rmtree(temp_dir) return 1 all_tests = { "test-update" : test_update, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_detach.py0000775000000000000000000000260314127766112014755 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import json from tests_utils import * def test_detach(): conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) out, container_id = run_and_get_output(conf, detach=True, hide_stderr=True) if out != "": return -1 try: state = json.loads(run_crun_command(["state", container_id])) if state['status'] != "running": return -1 if state['id'] != container_id: return -1 finally: run_crun_command(["delete", "-f", container_id]) return 0 all_tests = { "test-detach" : test_detach, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_delete.py0000644000000000000000000000764314406334420014764 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import json import subprocess import os from tests_utils import * def test_simple_delete(): conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) out, container_id = run_and_get_output(conf, detach=True, hide_stderr=True) if out != "": return -1 try: state = json.loads(run_crun_command(["state", container_id])) if state['status'] != "running": return -1 if state['id'] != container_id: return -1 finally: freezerCreated=False if not os.path.exists("/sys/fs/cgroup/cgroup.controllers") and os.access('/sys/fs/cgroup/freezer/', os.W_OK): # cgroupv1 freezer can easily simulate stuck or breaking `crun delete -f ` # this should be only done on cgroupv1 systems if not os.path.exists("/sys/fs/cgroup/freezer/frozen/"): freezerCreated=True os.makedirs("/sys/fs/cgroup/freezer/frozen/") with open('/sys/fs/cgroup/freezer/frozen/tasks', 'w') as f: f.write(str(state['pid'])) with open('/sys/fs/cgroup/freezer/frozen/freezer.state', 'w') as f: f.write('FROZEN') try: output = run_crun_command_raw(["delete", "-f", container_id]) except subprocess.CalledProcessError as exc: print("Status : FAIL", exc.returncode, exc.output) return -1 else: # this is expected for cgroup v1 so ignore if not output or b'Device or resource busy' in output: # if output is empty or expected error pass pass else: # anything else is error print(output) return -1 if freezerCreated: os.rmdir("/sys/fs/cgroup/freezer/frozen/") return 0 def test_multiple_containers_delete(): """Delete multiple containers with a regular expression""" conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) out_test1, container_id_test1 = run_and_get_output(conf, detach=True, hide_stderr=True) if out_test1 != "": return -1 out_test2, container_id_test2 = run_and_get_output(conf, detach=True, hide_stderr=True) if out_test2 != "": return -1 try: state_test1 = json.loads(run_crun_command(["state", container_id_test1])) if state_test1['status'] != "running": return -1 if state_test1['id'] != container_id_test1: return -1 state_test2 = json.loads(run_crun_command(["state", container_id_test2])) if state_test2['status'] != "running": return -1 if state_test2['id'] != container_id_test2: return -1 finally: try: output = run_crun_command_raw(["delete", "-f", "--regex", "test-*"]) except subprocess.CalledProcessError as exc: print("Status : FAIL", exc.returncode, exc.output) return -1 return 0 all_tests = { "test_simple_delete" : test_simple_delete, "test_multiple_containers_delete" : test_multiple_containers_delete, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_resources.py0000755000000000000000000002621014504567214015536 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import subprocess import sys import time from tests_utils import * def is_cgroup_v2_unified(): return subprocess.check_output("stat -c%T -f /sys/fs/cgroup".split()).decode("utf-8").strip() == "cgroup2fs" def test_resources_fail_with_enoent(): if is_rootless(): return 77 if not is_cgroup_v2_unified(): return 77 conf = base_config() add_all_namespaces(conf) conf['linux']['resources'] = {"unified" : {"memory.DOESNTEXIST" : "baz"}} conf['process']['args'] = ['/init', 'echo', 'hi'] proc, _ = run_and_get_output(conf, use_popen=True) out, _ = proc.communicate() if "no such file or directory" in out.decode().lower(): return 0 return -1 def test_resources_pid_limit(): if is_rootless(): return 77 conf = base_config() conf['linux']['resources'] = {"pids" : {"limit" : 1024}} add_all_namespaces(conf) fn = "/sys/fs/cgroup/pids/pids.max" if is_cgroup_v2_unified(): fn = "/sys/fs/cgroup/pids.max" conf['linux']['namespaces'].append({"type" : "cgroup"}) conf['process']['args'] = ['/init', 'cat', fn] out, _ = run_and_get_output(conf) if "1024" not in out: sys.stderr.write("found %s instead of 1024\n" % out) return -1 return 0 def test_resources_pid_limit_userns(): if is_rootless(): return 77 conf = base_config() conf['linux']['resources'] = {"pids" : {"limit" : 1024}} add_all_namespaces(conf) mappings = [ { "containerID": 0, "hostID": 1, "size": 1, }, { "containerID": 1, "hostID": 0, "size": 1, } ] conf['linux']['namespaces'].append({"type" : "user"}) conf['linux']['uidMappings'] = mappings conf['linux']['gidMappings'] = mappings fn = "/sys/fs/cgroup/pids/pids.max" if is_cgroup_v2_unified(): fn = "/sys/fs/cgroup/pids.max" conf['linux']['namespaces'].append({"type" : "cgroup"}) conf['process']['args'] = ['/init', 'cat', fn] out, _ = run_and_get_output(conf) if "1024" not in out: sys.stderr.write("found %s instead of 1024\n" % out) return -1 return 0 def test_resources_unified_invalid_controller(): if not is_cgroup_v2_unified() or is_rootless(): return 77 conf = base_config() add_all_namespaces(conf, cgroupns=True) conf['process']['args'] = ['/init', 'pause'] conf['linux']['resources'] = {} conf['linux']['resources']['unified'] = { "foo.bar": "doesntmatter" } cid = None try: out, cid = run_and_get_output(conf, command='run', detach=True) # must raise an exception, fail if it doesn't. return -1 except Exception as e: if 'the requested cgroup controller `foo` is not available' in e.stdout.decode("utf-8").strip(): return 0 return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_resources_unified_invalid_key(): if not is_cgroup_v2_unified() or is_rootless(): return 77 conf = base_config() add_all_namespaces(conf, cgroupns=True) conf['process']['args'] = ['/init', 'pause'] conf['linux']['resources'] = {} conf['linux']['resources']['unified'] = { "NOT-A-VALID-KEY": "doesntmatter" } cid = None try: out, cid = run_and_get_output(conf, command='run', detach=True) # must raise an exception, fail if it doesn't. return -1 except Exception as e: if 'the specified key has not the form CONTROLLER.VALUE `NOT-A-VALID-KEY`' in e.stdout.decode("utf-8").strip(): return 0 return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_resources_unified(): if not is_cgroup_v2_unified() or is_rootless(): return 77 conf = base_config() add_all_namespaces(conf, cgroupns=True) conf['process']['args'] = ['/init', 'pause'] conf['linux']['resources'] = {} conf['linux']['resources']['unified'] = { "memory.high": "1073741824" } cid = None try: _, cid = run_and_get_output(conf, command='run', detach=True) out = run_crun_command(["exec", cid, "/init", "cat", "/sys/fs/cgroup/memory.high"]) if "1073741824" not in out: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_resources_cpu_weight(): if not is_cgroup_v2_unified() or is_rootless(): return 77 conf = base_config() add_all_namespaces(conf, cgroupns=True) conf['process']['args'] = ['/init', 'pause'] conf['linux']['resources'] = {} conf['linux']['resources']['unified'] = { "cpu.weight": "1234" } cid = None try: _, cid = run_and_get_output(conf, command='run', detach=True) out = run_crun_command(["exec", cid, "/init", "cat", "/sys/fs/cgroup/cpu.weight"]) if "1234" not in out: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_resources_cgroupv2_swap_0(): if not is_cgroup_v2_unified() or is_rootless(): return 77 conf = base_config() add_all_namespaces(conf, cgroupns=True) conf['process']['args'] = ['/init', 'pause'] conf['linux']['resources'] = {} conf['linux']['resources']['memory'] = { "swap": 0 } cid = None try: _, cid = run_and_get_output(conf, command='run', detach=True) out = run_crun_command(["exec", cid, "/init", "cat", "/sys/fs/cgroup/memory.swap.max"]) if "0" not in out: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_resources_cpu_quota_minus_one(): if is_cgroup_v2_unified() or is_rootless(): return 77 conf = base_config() add_all_namespaces(conf, cgroupns=True) conf['process']['args'] = ['/init', 'cat', '/sys/fs/cgroup/cpu/cpu.cfs_quota_us'] conf['linux']['resources'] = {} conf['linux']['resources']['cpu'] = { "quota": -1 } cid = None try: out, cid = run_and_get_output(conf, command='run') if "-1" not in out: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_resources_cpu_weight_systemd(): if not is_cgroup_v2_unified() or is_rootless(): return 77 if 'SYSTEMD' not in get_crun_feature_string(): return 77 if not running_on_systemd(): return 77 conf = base_config() add_all_namespaces(conf, cgroupns=True) conf['process']['args'] = ['/init', 'pause'] conf['linux']['resources'] = {} conf['linux']['resources']['unified'] = { "cpu.weight": "1234" } cid = None try: _, cid = run_and_get_output(conf, command='run', detach=True, cgroup_manager="systemd") out = run_crun_command(["exec", cid, "/init", "cat", "/sys/fs/cgroup/cpu.weight"]) if "1234" not in out: sys.stderr.write("found wrong CPUWeight for the container cgroup\n") return -1 state = run_crun_command(['state', cid]) scope = json.loads(state)['systemd-scope'] out = subprocess.check_output(['systemctl', 'show','-PCPUWeight', scope ], close_fds=False).decode().strip() # try once more against the user manager, as if one exists, crun will prefer it; see bug #1197 if out != "1234": out = subprocess.check_output(['systemctl', '--user', 'show','-PCPUWeight', scope ], close_fds=False).decode().strip() if out != "1234": sys.stderr.write("found wrong CPUWeight for the systemd scope\n") return 1 run_crun_command(['update', '--cpu-share', '4321', cid]) # this is the expected cpu weight after the conversion from the CPUShares expected_weight = "165" out = run_crun_command(["exec", cid, "/init", "cat", "/sys/fs/cgroup/cpu.weight"]) if expected_weight not in out: sys.stderr.write("found wrong CPUWeight %s for the container cgroup\n" % out) return -1 out = subprocess.check_output(['systemctl', 'show','-PCPUWeight', scope ], close_fds=False).decode().strip() # as above if out != expected_weight: out = subprocess.check_output(['systemctl', '--user', 'show','-PCPUWeight', scope ], close_fds=False).decode().strip() if out != expected_weight: sys.stderr.write("found wrong CPUWeight for the systemd scope\n") return 1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_resources_exec_cgroup(): if not is_cgroup_v2_unified() or is_rootless(): return 77 conf = base_config() add_all_namespaces(conf, cgroupns=True) conf['process']['args'] = ['/init', 'create-sub-cgroup-and-wait', 'foo'] cid = None try: out, cid = run_and_get_output(conf, command='run', detach=True) # Give some time to pid 1 to move to the new cgroup time.sleep(2) out = run_crun_command(["exec", "--cgroup=/foo", cid, "/init", "cat", "/proc/self/cgroup"]) for i in out.split("\n"): if i == "": continue if "/foo" not in i: sys.stderr.write("/foo not found in the output") return -1 return 0 except Exception as e: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 all_tests = { "resources-v2-swap-disabled": test_resources_cgroupv2_swap_0, "resources-pid-limit" : test_resources_pid_limit, "resources-pid-limit-userns" : test_resources_pid_limit_userns, "resources-unified" : test_resources_unified, "resources-unified-invalid-controller" : test_resources_unified_invalid_controller, "resources-unified-invalid-key" : test_resources_unified_invalid_key, "resources-unified-exec-cgroup" : test_resources_exec_cgroup, "resources-fail-with-enoent" : test_resources_fail_with_enoent, "resources-cpu-weight" : test_resources_cpu_weight, "resources-cpu-weight-systemd" : test_resources_cpu_weight_systemd, "resources-cpu-quota-minus-one" : test_resources_cpu_quota_minus_one, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_start.py0000755000000000000000000004150114614667631014667 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import time import subprocess import os import os.path import threading import socket import json from tests_utils import * def test_cwd_relative(): conf = base_config() conf['process']['args'] = ['./init', 'echo', 'hello'] conf['process']['cwd'] = "/sbin" add_all_namespaces(conf) try: out, _ = run_and_get_output(conf) if "hello" not in str(out): return -1 except Exception as e: return -1 return 0 def test_cwd_relative_subdir(): conf = base_config() conf['process']['args'] = ['sbin/init', 'echo', 'hello'] conf['process']['cwd'] = "/" add_all_namespaces(conf) try: out, _ = run_and_get_output(conf) if "hello" not in str(out): return -1 except: return -1 return 0 def test_cwd_not_exist(): conf = base_config() conf['process']['args'] = ['/init', 'true'] conf['process']['cwd'] = "/doesnotexist" add_all_namespaces(conf) try: run_and_get_output(conf) except: return -1 return 0 def test_cwd_absolute(): conf = base_config() conf['process']['args'] = ['/init', 'echo', 'hello'] conf['process']['cwd'] = "/sbin" add_all_namespaces(conf) try: out, _ = run_and_get_output(conf) if "hello" not in str(out): return -1 except: return -1 return 0 def test_not_allowed_ipc_sysctl(): if is_rootless(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'true'] add_all_namespaces(conf, ipcns=False) conf['linux']['sysctl'] = {'fs.mqueue.queues_max' : '100'} cid = None try: _, cid = run_and_get_output(conf) sys.stderr.write("unexpected success\n") return -1 except: pass finally: if cid is not None: run_crun_command(["delete", "-f", cid]) conf = base_config() conf['process']['args'] = ['/init', 'true'] add_all_namespaces(conf, ipcns=False) conf['linux']['sysctl'] = {'kernel.msgmax' : '8192'} cid = None try: _, cid = run_and_get_output(conf) sys.stderr.write("unexpected success\n") return -1 except: pass finally: if cid is not None: run_crun_command(["delete", "-f", cid]) conf = base_config() conf['process']['args'] = ['/init', 'true'] add_all_namespaces(conf) conf['linux']['sysctl'] = {'kernel.msgmax' : '8192'} cid = None try: _, cid = run_and_get_output(conf) except Exception as e: sys.stderr.write("setting msgmax with new ipc namespace failed\n") return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_not_allowed_net_sysctl(): if is_rootless(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'true'] add_all_namespaces(conf, netns=False) conf['linux']['sysctl'] = {'net.ipv4.ping_group_range' : '0 0'} cid = None try: _, cid = run_and_get_output(conf) sys.stderr.write("unexpected success\n") return -1 except: pass finally: if cid is not None: run_crun_command(["delete", "-f", cid]) conf = base_config() conf['process']['args'] = ['/init', 'true'] add_all_namespaces(conf) conf['linux']['sysctl'] = {'net.ipv4.ping_group_range' : '0 0'} cid = None try: _, cid = run_and_get_output(conf) except Exception as e: sys.stderr.write("setting net.ipv4.ping_group_range with new net namespace failed\n") return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_unknown_sysctl(): if is_rootless(): return 77 for sysctl in ['kernel.foo', 'bar.baz', 'fs.baz']: conf = base_config() conf['process']['args'] = ['/init', 'true'] add_all_namespaces(conf) conf['linux']['sysctl'] = {sysctl : 'value'} cid = None try: _, cid = run_and_get_output(conf) sys.stderr.write("unexpected success\n") return -1 except: return 0 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_uts_sysctl(): if is_rootless(): return 77 # setting kernel.hostname must always fail. for utsns in [True, False]: conf = base_config() conf['process']['args'] = ['/init', 'true'] add_all_namespaces(conf, utsns=utsns) conf['linux']['sysctl'] = {'kernel.hostname' : 'foo'} cid = None try: _, cid = run_and_get_output(conf) sys.stderr.write("unexpected success\n") return -1 except: return 0 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) conf = base_config() conf['process']['args'] = ['/init', 'true'] add_all_namespaces(conf, utsns=False) conf['linux']['sysctl'] = {'kernel.domainname' : 'foo'} cid = None try: _, cid = run_and_get_output(conf) sys.stderr.write("unexpected success\n") return -1 except: return 0 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) conf = base_config() conf['process']['args'] = ['/init', 'true'] add_all_namespaces(conf) conf['linux']['sysctl'] = {'kernel.domainname' : 'foo'} cid = None try: _, cid = run_and_get_output(conf) return 0 except: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_start(): conf = base_config() conf['process']['args'] = ['/init', 'echo', 'hello'] add_all_namespaces(conf) cid = None try: proc, cid = run_and_get_output(conf, command='create', use_popen=True) for i in range(50): try: s = run_crun_command(["state", cid]) break except Exception as e: time.sleep(0.1) run_crun_command(["start", cid]) out, _ = proc.communicate() if "hello" not in str(out): return -1 # verify that the external_descriptors are stored correctly path = os.path.join(get_tests_root_status(), cid, "status") with open(path) as f: status = json.load(f) descriptors = status["external_descriptors"] if not isinstance(descriptors, str): print("external_descriptors is not a string") return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_start_override_config(): conf = base_config() conf['process']['args'] = ['/init', 'echo', 'hello'] add_all_namespaces(conf) cid = None try: proc, cid = run_and_get_output(conf, command='create', use_popen=True, relative_config_path="config/config.json") for i in range(50): try: s = run_crun_command(["state", cid]) break except Exception as e: time.sleep(0.1) run_crun_command(["start", cid]) out, _ = proc.communicate() if "hello" not in str(out): return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_run_twice(): conf = base_config() conf['process']['args'] = ['/init', 'echo', 'hi'] add_all_namespaces(conf) try: id_container = "container-%s" % os.getpid() for i in range(2): out, cid = run_and_get_output(conf, command='run', id_container=id_container) if "hi" not in str(out): return -1 except: return -1 return 0 def test_sd_notify(): if 'SYSTEMD' not in get_crun_feature_string(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'cat', '/proc/self/mountinfo'] add_all_namespaces(conf) env = dict(os.environ) env["NOTIFY_SOCKET"] = "/run/notify/the-socket" try: out, cid = run_and_get_output(conf, env=env, command='run') if "/run/notify/the-socket" not in str(out): return -1 except: return -1 return 0 def test_sd_notify_file(): if 'SYSTEMD' not in get_crun_feature_string(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'ls', '/tmp/parent-dir/the-socket/'] add_all_namespaces(conf) env = dict(os.environ) env["NOTIFY_SOCKET"] = "/tmp/parent-dir/the-socket" try: out, cid = run_and_get_output(conf, env=env, command='run') if "notify" not in str(out): return -1 except: return -1 return 0 def test_sd_notify_env(): if 'SYSTEMD' not in get_crun_feature_string(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'printenv', 'NOTIFY_SOCKET'] add_all_namespaces(conf) env = dict(os.environ) env["NOTIFY_SOCKET"] = "/tmp/parent-dir/the-socket" try: out, cid = run_and_get_output(conf, env=env, command='run') if "/tmp/parent-dir/the-socket/notify" not in str(out): return -1 except: return -1 return 0 def test_delete_in_created_state(): conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) cid = None try: proc, cid = run_and_get_output(conf, command='create', use_popen=True) proc.wait() run_crun_command(["delete", cid]) except: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_sd_notify_proxy(): if 'SYSTEMD' not in get_crun_feature_string(): return 77 if is_rootless(): return 77 has_open_tree_status = subprocess.call([get_init_path(), "check-feature", "open_tree"]) has_move_mount_status = subprocess.call([get_init_path(), "check-feature", "move_mount"]) if has_open_tree_status != 0 or has_move_mount_status != 0: return 77 conf = base_config() conf['process']['args'] = ['/init', 'systemd-notify', '--ready'] add_all_namespaces(conf, cgroupns=True, userns=True) mappings = [ { "containerID": 0, # + getuid() makes sure we don't accidentally run the container as the user that's running the test. "hostID": 8000 + os.getuid(), "size": 1, }, ] conf['linux']['uidMappings'] = mappings conf['linux']['gidMappings'] = mappings env = dict(os.environ) with tempfile.TemporaryDirectory() as socket_dir: env["NOTIFY_SOCKET"] = os.path.join(socket_dir, "notify.socket") ready_datagram = None with socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) as s: s.bind(env["NOTIFY_SOCKET"]) s.settimeout(2) def notify_server(): nonlocal ready_datagram ready_datagram = s.recv(1024) notify_thread = threading.Thread(target=notify_server) notify_thread.start() try: run_and_get_output(conf, env=env, command='run', chown_rootfs_to=8000) notify_thread.join() if ready_datagram != b"READY=1": return -1 except: return -1 finally: try: notify_thread.join() except: pass return 0 def test_empty_home(): conf = base_config() conf['process']['args'] = ['/sbin/init', 'printenv', 'HOME'] add_all_namespaces(conf) try: out, _ = run_and_get_output(conf) if "/" not in str(out): return -1 except Exception as e: return -1 return 0 def test_run_rootless_netns_with_userns(): if not is_rootless(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf, netns=False) # rootless should not be able to join the pid=1 netns conf['linux']['namespaces'].append({"type" : "network", "path" : "/proc/1/ns/net"}) cid = None try: _, cid = run_and_get_output(conf, command='run', detach=True) except: # expect a failure return 0 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return -1 # Following test is for a special case where crun sets LISTEN_PID=1 when nothing is specified # to make sure that primary process is 1, this feature makes sure crun is in parity with runc. def test_listen_pid_env(): conf = base_config() conf['process']['args'] = ['/init', 'printenv', 'LISTEN_PID'] add_all_namespaces(conf) env = dict(os.environ) env["LISTEN_FDS"] = "1" try: out, cid = run_and_get_output(conf, env=env, command='run') if "1" not in str(out): return -1 except: return -1 return 0 def test_ioprio(): IOPRIO_CLASS_NONE = 0 IOPRIO_CLASS_RT = 1 IOPRIO_CLASS_BE = 2 IOPRIO_CLASS_IDLE = 3 IOPRIO_CLASS_SHIFT = 13 IOPRIO_CLASS_MASK = 0x07 IOPRIO_PRIO_MASK = (1 << IOPRIO_CLASS_SHIFT) - 1 supported = subprocess.call([get_init_path(), "check-feature", "ioprio"]) if supported != 0: return 77 conf = base_config() add_all_namespaces(conf, netns=False) conf['process']['args'] = ['/init', 'ioprio'] conf['process']['ioPriority'] = { "class": "IOPRIO_CLASS_IDLE", "priority": 0 } cid = None try: output, cid = run_and_get_output(conf, command='run') value = int(output) if ((value >> IOPRIO_CLASS_SHIFT) & IOPRIO_CLASS_MASK) != IOPRIO_CLASS_IDLE: print("invalid ioprio class returned") return 1 if value & IOPRIO_PRIO_MASK != 0: print("invalid ioprio priority returned") return 1 return 0 except Exception as e: return 1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_run_keep(): conf = base_config() conf['process']['args'] = ['/init', 'cat', '/dev/null'] add_all_namespaces(conf) try: out, cid = run_and_get_output(conf, command='run') except: sys.stderr.write("failed to create container\n") return -1 # without --keep, we must be able to recreate the container with the same id try: out, cid = run_and_get_output(conf, command='run', keep=True, id_container=cid) except: sys.stderr.write("failed to create container\n") return -1 # now it must fail try: try: out, cid = run_and_get_output(conf, command='run', keep=True, id_container=cid) sys.stderr.write("run --keep succeeded twice\n") return -1 except: # expected pass try: s = run_crun_command(["state", cid]) except: sys.stderr.write("crun state failed on --keep container\n") return -1 finally: run_crun_command(["delete", "-f", cid]) return 0 all_tests = { "start" : test_start, "start-override-config" : test_start_override_config, "run-twice" : test_run_twice, "sd-notify" : test_sd_notify, "sd-notify-file" : test_sd_notify_file, "sd-notify-env" : test_sd_notify_env, "sd-notify-proxy": test_sd_notify_proxy, "listen_pid_env": test_listen_pid_env, "cwd-relative": test_cwd_relative, "cwd-relative-subdir": test_cwd_relative_subdir, "cwd-absolute": test_cwd_absolute, "cwd-not-exist" : test_cwd_not_exist, "empty-home": test_empty_home, "delete-in-created-state": test_delete_in_created_state, "run-rootless-netns-with-userns" : test_run_rootless_netns_with_userns, "not-allowed-ipc-sysctl": test_not_allowed_ipc_sysctl, "not-allowed-net-sysctl": test_not_allowed_net_sysctl, "uts-sysctl": test_uts_sysctl, "unknown-sysctl": test_unknown_sysctl, "ioprio": test_ioprio, "run-keep": test_run_keep, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_exec.py0000755000000000000000000003206214504567214014452 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import json import os import re import shutil import tempfile from tests_utils import * import time def test_exec(): conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) cid = None try: _, cid = run_and_get_output(conf, command='run', detach=True) out = run_crun_command(["exec", cid, "/init", "echo", "foo"]) if "foo" not in out: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_uid_tty(): # we need at least two uids if is_rootless(): return 77 if os.isatty(1) == False: return 77 conf = base_config() conf['process']['args'] = ['/init', 'pause'] conf['process']['terminal'] = True add_all_namespaces(conf) cid = None ret = 1 try: cid = "container-%s" % os.getpid() proc = run_and_get_output(conf, command='run', id_container=cid, use_popen=True) for i in range(0, 500): try: out = run_crun_command(["exec", "-t", "--user", "1", cid, "/init", "owner", "/proc/self/fd/0"]) if "1:" in out: ret = 0 break except: pass time.sleep(0.01) return ret finally: if cid is not None: try: run_crun_command(["delete", "-f", cid]) except: pass return 0 def test_exec_root_netns_with_userns(): if is_rootless(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf, netns=False) conf['linux']['namespaces'].append({"type" : "network", "path" : "/proc/1/ns/net"}) cid = None try: _, cid = run_and_get_output(conf, command='run', detach=True) with open("/proc/net/route") as f: payload = f.read() host_routes = [i.split('\t')[0] for i in payload.split('\n')[1:]] out = run_crun_command(["exec", cid, "/init", "cat", "/proc/net/route"]) container_routes = [i.split('\t')[0] for i in payload.split('\n')[1:]] if len(container_routes) != len(host_routes): sys.stderr.write("different length for the routes in the container and on the host\n") host_routes.sort() container_routes.sort() for i in zip(container_routes, host_routes): if i[0] != i[1]: sys.stderr.write("different network device found\n") return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_exec_not_exists_helper(detach): conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) cid = None try: _, cid = run_and_get_output(conf, command='run', detach=True) try: if detach: out = run_crun_command(["exec", "-d", cid, "/not.here"]) else: out = run_crun_command(["exec", cid, "/not.here"]) except Exception as e: return 0 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 1 def test_exec_not_exists(): return test_exec_not_exists_helper(False) def test_exec_detach_not_exists(): return test_exec_not_exists_helper(True) def test_exec_additional_gids(): if is_rootless(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) cid = None tempdir = tempfile.mkdtemp() try: _, cid = run_and_get_output(conf, command='run', detach=True) process_file = os.path.join(tempdir, "process.json") with open(process_file, "w") as f: json.dump({ "user": { "uid": 0, "gid": 0, "additionalGids": [432] }, "terminal": False, "args": [ "/init", "groups" ], "env": [ "PATH=/bin", "TERM=xterm" ], "cwd": "/", "noNewPrivileges": True }, f) out = run_crun_command(["exec", "--process", process_file, cid]) if "432" not in out: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) shutil.rmtree(tempdir) return 0 def test_exec_populate_home_env_from_process_uid(): if is_rootless(): return 77 conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) cid = None tempdir = tempfile.mkdtemp() try: _, cid = run_and_get_output(conf, command='run', detach=True) process_file = os.path.join(tempdir, "process.json") with open(process_file, "w") as f: json.dump({ "user": { "uid": 1000, "gid": 1000, "additionalGids": [1000] }, "terminal": False, "args": [ "/init", "printenv", "HOME" ], "env": [ "PATH=/bin", "TERM=xterm" ], "cwd": "/", "noNewPrivileges": True }, f) out = run_crun_command(["exec", "--process", process_file, cid]) if "/var/empty" not in out: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) shutil.rmtree(tempdir) return 0 def test_exec_add_capability(): """Specify an additional capability to add to the process""" conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) conf['process']['capabilities'] = {} cid = None cap_unknown_dict = {"CapInh":"0000000000000000", \ "CapPrm":"0000000000000000", \ "CapEff":"0000000000000000", \ "CapBnd":"0000000000000000", \ "CapAmb":"0000000000000000"} cap_kill_dict = {"CapInh":"0000000000000000", \ "CapPrm":"0000000000000020", \ "CapEff":"0000000000000020", \ "CapBnd":"0000000000000020", \ "CapAmb":"0000000000000000"} cap_sys_admin_dict = {"CapInh":"0000000000000000", \ "CapPrm":"0000000000200000", \ "CapEff":"0000000000200000", \ "CapBnd":"0000000000200000", \ "CapAmb":"0000000000000000"} cap_dict = {"CAP_UNKNOWN": cap_unknown_dict, \ "CAP_KILL": cap_kill_dict, \ "CAP_SYS_ADMIN": cap_sys_admin_dict} try: _, cid = run_and_get_output(conf, command='run', detach=True) for cap, value in cap_dict.items(): out = run_crun_command(["exec", "--cap", cap, cid, "/init", "cat", "/proc/self/status"]) for i in ['bounding', 'effective', 'inheritable', 'permitted', 'ambient']: conf['process']['capabilities'][i] = [] proc_status = parse_proc_status(out) for i in ['CapInh', 'CapPrm', 'CapEff', 'CapBnd', 'CapAmb']: if proc_status[i] != value[i]: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_exec_add_env(): """Add an environment variable""" conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) conf['process']['capabilities'] = {} cid = None env_args_list = [] env_dict_orig = {"HOME":"/", "PATH":"/bin"} env_dict_new = {"HOME":"/tmp", "PATH":"/usr/bin","FOO":"BAR"} try: _, cid = run_and_get_output(conf, command='run', detach=True) # check original environment variable for env, value in env_dict_orig.items(): out = run_crun_command(["exec", cid, "/init", "printenv", env]) if value not in out: return -1 # check that the environment has the key/value pair we added for env, value in env_dict_new.items(): out = run_crun_command(["exec", "--env", "%s=%s" %(env,value), \ cid, "/init", "printenv", env]) env_args_list.append("%s=%s" %(env,value)) if value not in out: return -1 # set multiple environment variable at the same time out = run_crun_command(["exec", "--env", env_args_list[0], \ "-e", env_args_list[1], \ "-e", env_args_list[2], \ cid, "/init", "printenv", "PATH"]) if env_dict_new["PATH"] not in out: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_exec_set_user(): """specify the user in the form UID[:GID]""" if is_rootless(): return 77 conf = base_config() add_all_namespaces(conf) conf['process']['args'] = ['/init', 'pause'] cid = None uid_gid_list = ["1000:1000", "0:0", "65535:65535"] try: _, cid = run_and_get_output(conf, command='run', detach=True) # check current user id out = run_crun_command(["exec", cid, "/init", "id"]) if uid_gid_list[1] not in out: return -1 # check that the uid and gid have the value we added for id in uid_gid_list: out = run_crun_command(["exec", "--user", id, cid, "/init", "id"]) if id not in out: return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_exec_no_new_privs(): """Set the no new privileges value for the process""" conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) conf['process']['capabilities'] = {} cid = None try: _, cid = run_and_get_output(conf, command='run', detach=True) # check original value of NoNewPrivs out = run_crun_command(["exec", cid, "/init", "cat", "/proc/self/status"]) proc_status = parse_proc_status(out) if proc_status["NoNewPrivs"] != "0": return -1 out = run_crun_command(["exec", "--no-new-privs", cid, "/init", "cat", "/proc/self/status"]) # check no new privileges value of NoNewPrivs proc_status = parse_proc_status(out) if proc_status["NoNewPrivs"] != "1": return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) return 0 def test_exec_write_pid_file(): """Set the no new privileges value for the process""" conf = base_config() conf['process']['args'] = ['/init', 'pause'] add_all_namespaces(conf) conf['process']['capabilities'] = {} cid = None tempdir = tempfile.mkdtemp() try: _, cid = run_and_get_output(conf, command='run', detach=True) pid_file = os.path.join(tempdir, cid) out = run_crun_command(["exec", "--pid-file", pid_file, cid, "/init", "echo", "hello"]) if "hello" not in out: return -1 if not os.path.exists(pid_file): return -1 regu_cont = re.compile(r'\d+') with open(pid_file, 'r') as fp: contents = fp.read() fp.close() if not regu_cont.match(contents): return -1 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) shutil.rmtree(tempdir) return 0 all_tests = { "exec" : test_exec, "exec-not-exists" : test_exec_not_exists, "exec-detach-not-exists" : test_exec_detach_not_exists, "exec-detach-additional-gids" : test_exec_additional_gids, "exec-root-netns-with-userns" : test_exec_root_netns_with_userns, "exec-add-capability" : test_exec_add_capability, "exec-add-environment_variable" : test_exec_add_env, "exec-set-user-with-uid-gid" : test_exec_set_user, "exec_add_no_new_privileges" : test_exec_no_new_privs, "exec_write_pid_file" : test_exec_write_pid_file, "exec_populate_home_env_from_process_uid" : test_exec_populate_home_env_from_process_uid, "exec-test-uid-tty": test_uid_tty, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_seccomp.py0000755000000000000000000000652014504567214015157 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2021 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import json import subprocess import os import socket import sys import array from tests_utils import * def is_seccomp_listener_supported(): r = subprocess.call([get_init_path(), "check-feature", "open_tree"]) return r == 0 # taken from https://docs.python.org/3/library/socket.html#socket.socket.recvmsg def recv_fds(sock, msglen, maxfds): fds = array.array("i") # Array of ints msg, ancdata, flags, addr = sock.recvmsg(msglen, socket.CMSG_LEN(maxfds * fds.itemsize)) for cmsg_level, cmsg_type, cmsg_data in ancdata: if cmsg_level == socket.SOL_SOCKET and cmsg_type == socket.SCM_RIGHTS: # Append data, ignoring any truncated integers at the end. fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds.itemsize)]) return msg, list(fds) def test_seccomp_listener(): if not is_seccomp_listener_supported(): return 77 listener_path = "%s/seccomp-listener" % get_tests_root() listener_metadata = "SOME-RANDOM-METADATA" sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.bind(listener_path) sock.listen(1) conf = base_config() add_all_namespaces(conf) conf['linux']['seccomp'] = { 'defaultAction': 'SCMP_ACT_ALLOW', 'listenerPath': listener_path, 'listenerMetadata': listener_metadata, } conf['process']['args'] = ['/init', 'true'] cid = None try: _, cid = run_and_get_output(conf, command='run', detach=True) conn = sock.accept() msg, fds = recv_fds(conn[0], 4096, 1) if len(fds) != 1: print("invalid number of FDs received", file=sys.stderr) return 1 m = json.loads(msg) if m['ociVersion'] != '0.2.0': print("invalid OCI version", file=sys.stderr) return 1 if len(m['fds']) != 1: print("invalid fds", file=sys.stderr) return 1 if 'pid' not in m != 1: print("invalid pid", file=sys.stderr) return 1 if m['metadata'] != listener_metadata: print("invalid metadata", file=sys.stderr) return 1 state = m['state'] if state['status'] != 'creating': print("invalid status", file=sys.stderr) return 1 if state['id'] != cid: print("invalid container id", file=sys.stderr) return 1 return 0 finally: if cid is not None: run_crun_command(["delete", "-f", cid]) os.unlink(listener_path) return -1 all_tests = { "seccomp-listener" : test_seccomp_listener, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/test_time.py0000644000000000000000000000411514504567214014457 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import time import subprocess import os import os.path import threading import socket import json from tests_utils import * def test_time_namespace(): timens_offsets = "/proc/self/timens_offsets" if not os.path.exists(timens_offsets): return 77 if is_rootless(): return 77 time_offsets = { "monotonic": { "secs": 1, "nanosecs": 2 }, "boottime": { "secs": 3, "nanosecs": 4 } } conf = base_config() conf['process']['args'] = ['/init', 'cat', timens_offsets] conf['linux']['timeOffsets'] = time_offsets add_all_namespaces(conf,time=True) try: out, cid = run_and_get_output(conf, command='run') for line in out.split("\n"): parts = line.split() if len(parts) != 3: continue if parts[0] == "monotonic": if parts[1] != "1": return -1 if parts[2] != "2": return -1 if parts[0] == "boottime": if parts[1] != "3": return -1 if parts[2] != "4": return -1 return 0 except: return -1 return 0 all_tests = { "time-namespace": test_time_namespace, } if __name__ == "__main__": tests_main(all_tests) crun-1.16.1/tests/Makefile.tests0000664000000000000000000000051314011447015014676 0ustar0000000000000000TESTS := $(shell find . -name "test_*.py") INIT ?= init OCI_RUNTIME ?= /usr/bin/crun check: $(INIT) tap-driver.sh OCI_RUNTIME=${OCI_RUNTIME} INIT=${INIT} ./run_all_tests.sh tap-driver.sh: wget https://git.savannah.gnu.org/cgit/automake.git/plain/lib/tap-driver.sh chmod +x tap-driver.sh init: init.c $(CC) -static $< -o $@ crun-1.16.1/tests/run_all_tests.sh0000775000000000000000000000060713677104573015336 0ustar0000000000000000#!/bin/sh INIT=${INIT:-init} OCI_RUNTIME=${OCI_RUNTIME:-/usr/bin/crun} export INIT export OCI_RUNTIME rm -f *.trs COLOR= if [ -t 1 ]; then COLOR="--color-tests yes" fi for i in test_*.py do ./tap-driver.sh --test-name $i --log-file $i.log --trs-file $i.trs ${COLOR} --enable-hard-errors yes --expect-failure no -- /usr/bin/python $i done if grep FAIL *.trs; then exit 1 fi crun-1.16.1/tests/tests_utils.py0000755000000000000000000002311014614667631015051 0ustar0000000000000000#!/bin/env python3 # crun - OCI runtime written in C # # Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano # crun 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. # # crun 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 crun. If not, see . import json import shutil import sys import os import tempfile import subprocess default_umask = 0o22 base_conf = """ { "ociVersion": "1.0.0", "process": { "user": { "uid": 0, "gid": 0 }, "terminal": false, "args": [ "/init", "true" ], "env": [ "PATH=/bin", "TERM=xterm" ], "cwd": "/", "noNewPrivileges": true }, "root": { "path": "rootfs", "readonly": true }, "mounts": [ { "destination": "/proc", "type": "proc" }, { "destination": "/sys", "type": "sysfs", "source": "sysfs", "options": [ "nosuid", "noexec", "nodev", "ro" ] }, { "destination": "/sys/fs/cgroup", "type": "cgroup", "source": "cgroup", "options": [ "nosuid", "noexec", "nodev", "relatime", "rw" ] }, { "destination": "/dev", "type": "tmpfs", "source": "tmpfs", "options": [ "nosuid", "strictatime", "mode=755", "size=65536k" ] }, { "destination": "/dev/pts", "type": "devpts", "source": "devpts", "options": [ "nosuid", "noexec", "newinstance", "ptmxmode=0666", "mode=0620" ] }, { "destination": "/dev/shm", "type": "tmpfs", "source": "shm", "options": [ "nosuid", "noexec", "nodev", "mode=1777", "size=65536k" ] }, { "destination": "/dev/mqueue", "type": "mqueue", "source": "mqueue", "options": [ "nosuid", "noexec", "nodev" ] } ], "linux": { "rootfsPropagation": "rprivate", "namespaces": [ { "type": "mount" } ] } } """ def base_config(): return json.loads(base_conf) def parse_proc_status(content): r = {} for i in content.split("\n"): if ':\t' not in i: continue k, v = i.split(':\t', 1) r[k] = v.strip() return r def add_all_namespaces(conf, cgroupns=False, userns=False, netns=True, ipcns=True, utsns=True, pidns=True,time=False): has = {} for i in conf['linux']['namespaces']: has[i['type']] = i['type'] namespaces = [] if pidns: namespaces = namespaces + ['pid'] if utsns: namespaces = namespaces + ['uts'] if cgroupns: namespaces = namespaces + ["cgroup"] if ipcns: namespaces = namespaces + ["ipc"] if userns: namespaces = namespaces + ["user"] if netns: namespaces = namespaces + ["network"] if time: namespaces = namespaces + ["time"] for i in namespaces: if i not in has: conf['linux']['namespaces'].append({"type" : i}) def run_all_tests(all_tests, allowed_tests): tests = all_tests if allowed_tests is not None: allowed_tests = allowed_tests.split() tests = {k: v for k, v in tests.items() if k in allowed_tests} print("1..%d" % len(tests)) cur = 0 for k, v in tests.items(): cur = cur + 1 ret = -1 try: ret = v() if ret == 0: print("ok %d - %s" % (cur, k)) elif ret == 77: print("ok %d - %s #SKIP" % (cur, k)) else: print("not ok %d - %s" % (cur, k)) except Exception as e: if hasattr(e, 'output'): sys.stderr.write(str(e.output) + "\n") sys.stderr.write(str(e) + "\n") ret = -1 print("not ok %d - %s" % (cur, k)) def get_tests_root(): return '%s/.testsuite-run-%d' % (os.getcwd(), os.getpid()) def get_tests_root_status(): return os.path.join(get_tests_root(), "root") def get_init_path(): return os.path.abspath(os.getenv("INIT") or "tests/init") def get_crun_path(): cwd = os.getcwd() return os.getenv("OCI_RUNTIME") or os.path.join(cwd, "crun") def run_and_get_output(config, detach=False, preserve_fds=None, pid_file=None, keep=False, command='run', env=None, use_popen=False, hide_stderr=False, cgroup_manager='cgroupfs', all_dev_null=False, id_container=None, relative_config_path="config.json", chown_rootfs_to=None, callback_prepare_rootfs=None): # Some tests require that the container user, which might not be the # same user as the person running the tests, is able to resolve the full path # to its own tree if chown_rootfs_to is not None: temp_dir = tempfile.mkdtemp() else: temp_dir = tempfile.mkdtemp(dir=get_tests_root()) rootfs = os.path.join(temp_dir, "rootfs") os.makedirs(rootfs) for i in ["usr/bin", "etc", "var", "lib", "lib64", "usr/share/zoneinfo/Europe", "proc", "sys", "dev"]: os.makedirs(os.path.join(rootfs, i)) with open(os.path.join(rootfs, "var", "file"), "w+") as f: f.write("file") if id_container is None: id_container = 'test-%s' % os.path.basename(temp_dir) config_path = os.path.join(temp_dir, relative_config_path) config_dir = os.path.dirname(config_path) if not os.path.exists(config_dir): os.makedirs(config_dir) with open(config_path, "w") as config_file: conf = json.dumps(config) config_file.write(conf) init = get_init_path() crun = get_crun_path() os.makedirs(os.path.join(rootfs, "sbin")) shutil.copy2(init, os.path.join(rootfs, "init")) shutil.copy2(init, os.path.join(rootfs, "sbin", "init")) open(os.path.join(rootfs, "usr/share/zoneinfo/Europe/Rome"), "w").close() os.symlink("../usr/share/zoneinfo/Europe/Rome", os.path.join(rootfs, "etc/localtime")) os.symlink("../foo/bar/not/here", os.path.join(rootfs, "etc/not-existing")) # Populate /etc/passwd inside container rootfs with users root and test for various test-cases. passwd = open(os.path.join(rootfs, "usr/share/passwd"), "w") passwd.writelines(["root:x:0:0:root:/root:/bin/bash", "\ntest:x:1000:1000:test:/var/empty:/bin/bash"]) passwd.close() os.symlink("../usr/share/passwd", os.path.join(rootfs, "etc/passwd")) if chown_rootfs_to is not None: os.chown(temp_dir, chown_rootfs_to, chown_rootfs_to) for root, dirs, files in os.walk(temp_dir): for f in dirs + files: os.chown(os.path.join(root, f), chown_rootfs_to, chown_rootfs_to, follow_symlinks=False) if callback_prepare_rootfs is not None: callback_prepare_rootfs(rootfs) detach_arg = ['--detach'] if detach else [] keep_arg = ['--keep'] if keep else [] preserve_fds_arg = ['--preserve-fds', str(preserve_fds)] if preserve_fds else [] pid_file_arg = ['--pid-file', pid_file] if pid_file else [] relative_config_path = ['--config', relative_config_path] if relative_config_path else [] root = get_tests_root_status() args = [crun, "--cgroup-manager", cgroup_manager, "--root", root, command] + relative_config_path + preserve_fds_arg + detach_arg + keep_arg + pid_file_arg + [id_container] stderr = subprocess.STDOUT if hide_stderr: stderr = None stdin = None stdout = None # For the initial limited checkpoint/restore support everything # has to be redirect to /dev/null if all_dev_null: stdin = subprocess.DEVNULL stdout = subprocess.DEVNULL stderr = subprocess.DEVNULL if use_popen: if not stdout: stdout=subprocess.PIPE return subprocess.Popen(args, cwd=temp_dir, umask=default_umask, stdout=stdout, stderr=stderr, stdin=stdin, env=env, close_fds=False), id_container else: return subprocess.check_output(args, cwd=temp_dir, stderr=stderr, env=env, close_fds=False, umask=default_umask).decode(), id_container def run_crun_command(args): root = get_tests_root_status() crun = get_crun_path() args = [crun, "--root", root] + args return subprocess.check_output(args, close_fds=False).decode() # Similar as run_crun_command but does not performs decode of output and relays error message for further matching def run_crun_command_raw(args): root = get_tests_root_status() crun = get_crun_path() args = [crun, "--root", root] + args return subprocess.check_output(args, close_fds=False, stderr=subprocess.STDOUT) def running_on_systemd(): with open('/proc/1/comm') as f: return "systemd" in f.readline() def tests_main(all_tests): os.environ["LANG"] = "C" tests_root = get_tests_root() try: os.makedirs(tests_root) run_all_tests(all_tests, os.getenv("RUN_TESTS")) finally: shutil.rmtree(tests_root) def is_rootless(): if os.getuid() != 0: return True with open("/proc/self/uid_map") as f: if "4294967295" in f.readline(): return False return True def get_crun_feature_string(): for i in run_crun_command(['--version']).split('\n'): if i.startswith('+'): return i return '' crun-1.16.1/Makefile.am0000644000000000000000000002703014654642544013011 0ustar0000000000000000DIST_SUBDIRS = libocispec SUBDIRS = libocispec ACLOCAL_AMFLAGS = -I m4 WD := $(shell pwd) # outdir is needed by the make_srpm build type on Fedora copr # https://docs.pagure.org/copr.copr/user_documentation.html#make-srpm outdir ?= $(WD) RPM_OPTS ?= --define "_sourcedir $(WD)" --define "_specdir $(WD)" --define "_builddir $(WD)" --define "_srcrpmdir $(outdir)" --define "_rpmdir $(outdir)" --define "_buildrootdir $(WD)/.build" rpm/crun.spec # Clean any safe.directory values added to global gitconfig because of srpm and # rpm target runs clean-global-gitconfig: $(shell git config --global --unset-all safe.directory $(shell pwd)/libocispec) $(shell git config --global --unset-all safe.directory $(shell pwd)/rpm) $(shell git config --global --unset-all safe.directory /crun) srpm: echo $(VERSION) $(MAKE) -C rpm tarball-prep rpmbuild -bs $(RPM_OPTS) rpm/crun.spec $(MAKE) clean-global-gitconfig rpm: srpm rpmbuild -ba $(RPM_OPTS) rpm/crun.spec $(MAKE) clean-global-gitconfig if ENABLE_LIBCRUN lib_LTLIBRARIES = libcrun.la else noinst_LTLIBRARIES = libcrun.la endif check_LIBRARIES = libcrun_testing.a libcrun_SOURCES = src/libcrun/utils.c \ src/libcrun/blake3/blake3.c \ src/libcrun/blake3/blake3_portable.c \ src/libcrun/cgroup-cgroupfs.c \ src/libcrun/cgroup-resources.c \ src/libcrun/cgroup-setup.c \ src/libcrun/cgroup-systemd.c \ src/libcrun/cgroup-utils.c \ src/libcrun/cgroup.c \ src/libcrun/chroot_realpath.c \ src/libcrun/cloned_binary.c \ src/libcrun/container.c \ src/libcrun/criu.c \ src/libcrun/custom-handler.c \ src/libcrun/ebpf.c \ src/libcrun/error.c \ src/libcrun/handlers/handler-utils.c \ src/libcrun/handlers/krun.c \ src/libcrun/handlers/mono.c \ src/libcrun/handlers/spin.c \ src/libcrun/handlers/wasmedge.c \ src/libcrun/handlers/wasmer.c \ src/libcrun/handlers/wasmtime.c \ src/libcrun/intelrdt.c \ src/libcrun/io_priority.c \ src/libcrun/linux.c \ src/libcrun/mount_flags.c \ src/libcrun/scheduler.c \ src/libcrun/seccomp.c \ src/libcrun/seccomp_notify.c \ src/libcrun/signals.c \ src/libcrun/status.c \ src/libcrun/terminal.c if HAVE_EMBEDDED_YAJL maybe_libyajl.la = libocispec/yajl/libyajl.la else maybe_libyajl.la = endif libocispec/libocispec.la: $(MAKE) $(AM_MAKEFLAGS) -C libocispec libocispec.la libcrun_la_SOURCES = $(libcrun_SOURCES) libcrun_la_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -fvisibility=hidden libcrun_la_LIBADD = libocispec/libocispec.la $(FOUND_LIBS) $(maybe_libyajl.la) libcrun_la_LDFLAGS = -Wl,--version-script=$(abs_top_srcdir)/libcrun.lds # build a version with all the symbols visible for testing libcrun_testing_a_SOURCES = $(libcrun_SOURCES) libcrun_testing_a_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -fvisibility=default libcrun_testing_a_LIBADD = libocispec/libocispec.la $(maybe_libyajl.la) if PYTHON_BINDINGS pyexec_LTLIBRARIES = python_crun.la python_crun_la_SOURCES = python/crun_python.c python_crun_la_CFLAGS = -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/libocispec/src -I $(abs_top_builddir)/src $(PYTHON_CFLAGS) python_crun_la_LDFLAGS = -avoid-version -module $(PYTHON_LDFLAGS) python_crun_la_LIBADD = libcrun.la $(PYTHON_LIBS) $(FOUND_LIBS) $(maybe_libyajl.la) endif if LUA_BINDINGS luaexec_LTLIBRARIES = luacrun.la luacrun_la_SOURCES = lua/lua_crun.c luacrun_la_CFLAGS = -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/libocispec/src -I $(abs_top_builddir)/src $(LUA_INCLUDE) luacrun_la_LDFLAGS = -avoid-version -module luacrun_la_LIBADD = libcrun.la $(LUA_LIB) $(FOUND_LIBS) LUACRUN_CLEAN_VERSION = $(shell git describe --tags | sed 's/-g[0-9a-f]\{7,9\}//') LUACRUN_RELEASE_VERSION = $(shell git describe --tags | sed 's/-[0-9]*-g[0-9a-f]\{7,9\}//') LUACRUN_ROCKSPEC = luacrun-$(LUACRUN_CLEAN_VERSION).rockspec $(LUACRUN_ROCKSPEC): lua/luacrun.rockspec sed -e 's/@RELEASEVERSION/$(LUACRUN_RELEASE_VERSION)/g' < lua/luacrun.rockspec | \ sed -e 's/@CLEANVERSION/$(LUACRUN_CLEAN_VERSION)/g' > $@ LUACRUN_ROCK = luacrun-$(LUACRUN_CLEAN_VERSION).src.rock $(LUACRUN_ROCK): dist-gzip $(LUACRUN_ROCKSPEC) rm -f $(LUACRUN_ROCK) mv "$(distdir).tar.gz" "crun-$(LUACRUN_RELEASE_VERSION).tar.gz" tar -xzf "crun-$(LUACRUN_RELEASE_VERSION).tar.gz" --transform="s/crun-$(VERSION)\(.*\)$$/crun-$(LUACRUN_RELEASE_VERSION)\1/" tar -czf "crun-$(LUACRUN_RELEASE_VERSION).tar.gz" "crun-$(LUACRUN_RELEASE_VERSION)" rm -rf "crun-$(LUACRUN_RELEASE_VERSION)" zip -j $(LUACRUN_ROCK) $(LUACRUN_ROCKSPEC) "crun-$(LUACRUN_RELEASE_VERSION).tar.gz" rm -f "crun-$(LUACRUN_RELEASE_VERSION).tar.gz" dist-luarock: $(LUACRUN_ROCK) endif crun_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -D CRUN_LIBDIR="\"$(CRUN_LIBDIR)\"" crun_SOURCES = src/crun.c src/run.c src/delete.c src/kill.c src/pause.c src/unpause.c src/oci_features.c src/spec.c \ src/exec.c src/list.c src/create.c src/start.c src/state.c src/update.c src/ps.c \ src/checkpoint.c src/restore.c src/libcrun/cloned_binary.c if DYNLOAD_LIBCRUN crun_LDFLAGS = -Wl,--unresolved-symbols=ignore-all $(CRUN_LDFLAGS) else crun_LDADD = libcrun.la $(FOUND_LIBS) $(maybe_libyajl.la) crun_LDFLAGS = $(CRUN_LDFLAGS) endif EXTRA_DIST = COPYING COPYING.libcrun README.md NEWS SECURITY.md rpm/crun.spec autogen.sh \ src/libcrun/blake3/blake3_impl.h src/libcrun/blake3/blake3.h \ src/crun.h src/list.h src/run.h src/delete.h src/kill.h src/pause.h src/unpause.h \ src/create.h src/start.h src/state.h src/exec.h src/oci_features.h src/spec.h src/update.h src/ps.h \ src/checkpoint.h src/restore.h src/libcrun/seccomp_notify.h src/libcrun/seccomp_notify_plugin.h \ src/libcrun/container.h src/libcrun/seccomp.h src/libcrun/ebpf.h \ src/libcrun/cgroup.h src/libcrun/cgroup-cgroupfs.h \ src/libcrun/cgroup-internal.h \ src/libcrun/cgroup-resources.h src/libcrun/cgroup-setup.h \ src/libcrun/cgroup-systemd.h src/libcrun/cgroup-utils.h \ src/libcrun/custom-handler.h src/libcrun/io_priority.h \ src/libcrun/handlers/handler-utils.h \ src/libcrun/linux.h src/libcrun/utils.h src/libcrun/error.h src/libcrun/criu.h \ src/libcrun/scheduler.h src/libcrun/status.h src/libcrun/terminal.h \ src/libcrun/mount_flags.h src/libcrun/intelrdt.h \ crun.1.md crun.1 libcrun.lds \ krun.1.md krun.1 \ lua/luacrun.rockspec UNIT_TESTS = tests/tests_libcrun_utils tests/tests_libcrun_errors tests/tests_libcrun_intelrdt if ENABLE_CRUN bin_PROGRAMS = crun noinst_PROGRAMS = else noinst_PROGRAMS = crun endif noinst_PROGRAMS += tests/init $(UNIT_TESTS) tests/tests_libcrun_fuzzer TESTS_LDADD = libcrun_testing.a $(FOUND_LIBS) $(maybe_libyajl.la) tests_init_LDADD = tests_init_LDFLAGS = -static-libgcc -all-static tests_init_SOURCES = tests/init.c tests_tests_libcrun_utils_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src tests_tests_libcrun_utils_SOURCES = tests/tests_libcrun_utils.c tests_tests_libcrun_utils_LDADD = $(TESTS_LDADD) tests_tests_libcrun_utils_LDFLAGS = $(crun_LDFLAGS) tests_tests_libcrun_intelrdt_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src tests_tests_libcrun_intelrdt_SOURCES = tests/tests_libcrun_intelrdt.c tests_tests_libcrun_intelrdt_LDADD = $(TESTS_LDADD) tests_tests_libcrun_intelrdt_LDFLAGS = $(crun_LDFLAGS) tests_tests_libcrun_fuzzer_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src tests_tests_libcrun_fuzzer_SOURCES = tests/tests_libcrun_fuzzer.c tests_tests_libcrun_fuzzer_LDADD = $(TESTS_LDADD) libocispec/libocispec.la $(maybe_libyajl.la) tests_tests_libcrun_fuzzer_LDFLAGS = $(crun_LDFLAGS) tests_tests_libcrun_errors_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src tests_tests_libcrun_errors_SOURCES = tests/tests_libcrun_errors.c tests_tests_libcrun_errors_LDADD = $(TESTS_LDADD) tests_tests_libcrun_errors_LDFLAGS = $(crun_LDFLAGS) TEST_EXTENSIONS = .py PY_LOG_COMPILER = $(PYTHON) PY_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/build-aux/tap-driver.sh LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/build-aux/tap-driver.sh PYTHON_TESTS = tests/test_capabilities.py \ tests/test_cwd.py \ tests/test_checkpoint_restore.py \ tests/test_devices.py \ tests/test_hostname.py \ tests/test_limits.py \ tests/test_oci_features.py \ tests/test_mounts.py \ tests/test_paths.py \ tests/test_pid.py \ tests/test_pid_file.py \ tests/test_preserve_fds.py \ tests/test_uid_gid.py \ tests/test_rlimits.py \ tests/test_tty.py \ tests/test_hooks.py \ tests/test_update.py \ tests/test_detach.py \ tests/test_delete.py \ tests/test_resources.py \ tests/test_start.py \ tests/test_exec.py \ tests/test_seccomp.py \ tests/test_time.py TESTS = $(PYTHON_TESTS) $(UNIT_TESTS) .version: $(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@ git-version.h: @if test -e $(abs_top_srcdir)/.tarball-git-version.h; then \ cp $(abs_top_srcdir)/.tarball-git-version.h $@; \ elif test -e $(abs_top_srcdir)/.git; then \ version=`$(AM__GEN)git --git-dir=$(abs_top_srcdir)/.git rev-parse HEAD`; \ $(AM__GEN)printf "/* autogenerated. */\n#ifndef GIT_VERSION\n# define GIT_VERSION \"%s\"\n#endif\n" $$version > $@-t && mv $@-t $@; \ fi nixpkgs: @nix run -f channel:nixpkgs-unstable nix-prefetch-git -- \ --no-deepClone https://github.com/nixos/nixpkgs > nix/nixpkgs.json dist-hook: $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version $(AM__GEN)cp git-version.h $(distdir)/.tarball-git-version.h EXTRA_DIST += $(PYTHON_TESTS) tests/Makefile.tests tests/run_all_tests.sh tests/tests_utils.py build-aux/git-version-gen src/libcrun/signals.perf src/libcrun/mount_flags.perf BUILT_SOURCES = .version git-version.h CLEANFILES = crun.spec .version git-version.h $(LUACRUN_ROCKSPEC) man1_MANS = if ENABLE_CRUN man1_MANS += crun.1 endif if ENABLE_KRUN man1_MANS += krun.1 endif crun.1: $(abs_srcdir)/crun.1.md if HAVE_MD2MAN $(MD2MAN) -in $(abs_srcdir)/crun.1.md -out crun.1 endif HAVE_MD2MAN krun.1: $(abs_srcdir)/krun.1.md if HAVE_MD2MAN $(MD2MAN) -in $(abs_srcdir)/krun.1.md -out krun.1 endif HAVE_MD2MAN install-exec-hook: if ENABLE_KRUN $(LN_S) crun$(EXEEXT) $(DESTDIR)$(bindir)/krun$(EXEEXT) endif if ENABLE_WASM $(LN_S) crun$(EXEEXT) $(DESTDIR)$(bindir)/crun-wasm$(EXEEXT) endif uninstall-hook: if ENABLE_KRUN rm -f $(DESTDIR)$(bindir)/krun$(EXEEXT) endif if ENABLE_WASM rm -f $(DESTDIR)$(bindir)/crun-wasm$(EXEEXT) endif generate-man: crun.1 krun.1 sync: (cd libocispec; git pull https://github.com/containers/libocispec main) coverity: $(MAKE) $(AM_MAKEFLAGS) -C libocispec $(MAKE) $(AM_MAKEFLAGS) crun libcrun.rs: src/libcrun/container.h bindgen src/libcrun/container.h -- -I$(abs_builddir) -I$(abs_builddir)/libocispec/src > $@ generate-rust-bindings: libcrun.rs generate-signals.c: src/libcrun/signals.perf ${GPERF} --lookup-function-name libcrun_signal_in_word_set -m 100 --null-strings --pic -tCEG -S1 $< > src/libcrun/signals.c generate-mount_flags.c: src/libcrun/mount_flags.perf ${GPERF} --lookup-function-name libcrun_mount_flag_in_word_set -m 100 -tCEG -S1 $< > src/libcrun/mount_flags.c clang-format: # do not format files that were copied into the source directory. git ls-files src tests | grep -E "\\.[hc]" | grep -v "blake3\|chroot_realpath.c\|cloned_binary.c\|signals.c\|mount_flags.c" | xargs clang-format -style=file -i shellcheck: shellcheck tests/*/*.sh contrib/*.sh .PHONY: coverity sync generate-rust-bindings generate-signals.c generate-mount_flags.c clang-format shellcheck crun-1.16.1/configure0000755000000000000000000206256414656670155012702 0ustar0000000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for crun 1.16.1. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 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: giuseppe@scrivano.org about your system, including any $0: error possibly output before this message. Then install $0: a modern shell, or manually run the script under such a $0: shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='crun' PACKAGE_TARNAME='crun' PACKAGE_VERSION='1.16.1' PACKAGE_STRING='crun 1.16.1' PACKAGE_BUGREPORT='giuseppe@scrivano.org' PACKAGE_URL='' ac_unique_file="src/crun.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" enable_option_checking=no ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS subdirs SHARED_LIBCRUN_FALSE SHARED_LIBCRUN_TRUE CRIU_SUPPORT_FALSE CRIU_SUPPORT_TRUE LUA_BINDINGS_FALSE LUA_BINDINGS_TRUE PYTHON_BINDINGS_FALSE PYTHON_BINDINGS_TRUE GPERF GIT_COMMIT_ID RPM_VERSION CRUN_LIBDIR CRUN_LDFLAGS FOUND_LIBS CRIU_PRE_DUMP_LIBS CRIU_PRE_DUMP_CFLAGS CRIU_JOIN_NS_LIBS CRIU_JOIN_NS_CFLAGS CRIU_LIBS CRIU_CFLAGS LUA_LIB LUA_INCLUDE pkgluaexecdir luaexecdir pkgluadir luadir LUA_EXEC_PREFIX LUA_PREFIX LUA_PLATFORM LUA_SHORT_VERSION LUA_VERSION LUA PYTHON_LIBS PYTHON_CFLAGS DYNLOAD_LIBCRUN SHARED_LIBCRUN ENABLE_WASM_FALSE ENABLE_WASM_TRUE ENABLE_KRUN_FALSE ENABLE_KRUN_TRUE MONO_LIBS MONO_CFLAGS YAJL_LIBS YAJL_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG HAVE_EMBEDDED_YAJL_FALSE HAVE_EMBEDDED_YAJL_TRUE DYNLOAD_LIBCRUN_FALSE DYNLOAD_LIBCRUN_TRUE ENABLE_LIBCRUN_FALSE ENABLE_LIBCRUN_TRUE ENABLE_CRUN_FALSE ENABLE_CRUN_TRUE HAVE_MD2MAN_FALSE HAVE_MD2MAN_TRUE MD2MAN pkgpyexecdir pyexecdir pkgpythondir pythondir PYTHON_PLATFORM PYTHON_EXEC_PREFIX PYTHON_PREFIX PYTHON_VERSION PYTHON MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR am__untar am__tar AMTAR am__leading_dot SET_MAKE mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL AWK RANLIB STRIP ac_ct_AR AR DLLTOOL OBJDUMP NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL LN_S target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock enable_dependency_tracking enable_silent_rules enable_maintainer_mode enable_crun enable_libcrun enable_embedded_yajl enable_dynload_libcrun enable_caps enable_dl with_mono with_wasmer with_wasmtime with_wasmedge with_libkrun with_spin enable_seccomp enable_systemd enable_bpf with_python_bindings with_lua_bindings enable_lua_path_guessing enable_criu ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH CPP PYTHON PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR YAJL_CFLAGS YAJL_LIBS PYTHON_CFLAGS PYTHON_LIBS LUA LUA_INCLUDE LUA_LIB CRIU_CFLAGS CRIU_LIBS CRIU_JOIN_NS_CFLAGS CRIU_JOIN_NS_LIBS CRIU_PRE_DUMP_CFLAGS CRIU_PRE_DUMP_LIBS' ac_subdirs_all='libocispec' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures crun 1.16.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/crun] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of crun 1.16.1:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-shared[=PKGS] build shared libraries [default=no] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --disable-maintainer-mode disable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-crun Include crun executable in installation (default: yes) --enable-libcrun Include libcrun in installation (default: yes) --enable-embedded-yajl Statically link a modified yajl version --enable-dynload-libcrun Dynamically load libcrun --disable-caps Ignore libcap and disable support --disable-dl Disable dynamic libraries support --disable-seccomp Ignore libseccomp and disable support --disable-systemd Ignore systemd and disable support --disable-bpf Ignore eBPF and disable support --enable-lua-path-guessing guessing lua module path based on variables (default: yes), disable to use libdir as luaexecdir --disable-criu Disable CRIU based checkpoint/restore support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-mono build with mono support --with-wasmer build with wasmer support --with-wasmtime build with wasmtime support --with-wasmedge build with WasmEdge support --with-libkrun build with libkrun support --with-spin build with spin support --with-python-bindings build the Python bindings --with-lua-bindings build the Lua bindings 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 LT_SYS_LIBRARY_PATH User-defined run-time library search path. CPP C preprocessor PYTHON the Python interpreter 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 YAJL_CFLAGS C compiler flags for YAJL, overriding pkg-config YAJL_LIBS linker flags for YAJL, overriding pkg-config PYTHON_CFLAGS C compiler flags for PYTHON, overriding pkg-config PYTHON_LIBS linker flags for PYTHON, overriding pkg-config LUA The Lua interpreter, e.g. /usr/bin/lua5.1 LUA_INCLUDE The Lua includes, e.g. -I/usr/include/lua5.1 LUA_LIB The Lua library, e.g. -llua5.1 CRIU_CFLAGS C compiler flags for CRIU, overriding pkg-config CRIU_LIBS linker flags for CRIU, overriding pkg-config CRIU_JOIN_NS_CFLAGS C compiler flags for CRIU_JOIN_NS, overriding pkg-config CRIU_JOIN_NS_LIBS linker flags for CRIU_JOIN_NS, overriding pkg-config CRIU_PRE_DUMP_CFLAGS C compiler flags for CRIU_PRE_DUMP, overriding pkg-config CRIU_PRE_DUMP_LIBS linker flags for CRIU_PRE_DUMP, 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 crun configure 1.16.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_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_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_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------------ ## ## Report this to giuseppe@scrivano.org ## ## ------------------------------------ ##" ) | 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_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 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 crun $as_me 1.16.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in build-aux "$srcdir"/build-aux; 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 build-aux \"$srcdir\"/build-aux" "$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. ac_config_headers="$ac_config_headers config.h" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 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 fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac 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 # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=no fi enable_dlopen=no enable_win32_dll=no # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } { $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 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # 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 # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='crun' VERSION='1.16.1' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar plaintar pax cpio none' # The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether UID '$am_uid' is supported by ustar format" >&5 $as_echo_n "checking whether UID '$am_uid' is supported by ustar format... " >&6; } if test $am_uid -le $am_max_uid; 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; } _am_tools=none fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GID '$am_gid' is supported by ustar format" >&5 $as_echo_n "checking whether GID '$am_gid' is supported by ustar format... " >&6; } if test $am_gid -le $am_max_gid; 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; } _am_tools=none fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5 $as_echo_n "checking how to create a ustar tar archive... " >&6; } # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_ustar-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do { echo "$as_me:$LINENO: $_am_tar --version" >&5 ($_am_tar --version) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && break done am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"' am__tar_="$_am_tar --format=ustar -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 ustar -w "$$tardir"' am__tar_='pax -L -x ustar -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H ustar -L' am__tar_='find "$tardir" -print | cpio -o -H ustar -L' am__untar='cpio -i -H ustar -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_ustar}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5 (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -rf conftest.dir if test -s conftest.tar; then { echo "$as_me:$LINENO: $am__untar &5 ($am__untar &5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: cat conftest.dir/file" >&5 (cat conftest.dir/file) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } grep GrepMe conftest.dir/file >/dev/null 2>&1 && break fi done rm -rf conftest.dir if ${am_cv_prog_tar_ustar+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_prog_tar_ustar=$_am_tool fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5 $as_echo "$am_cv_prog_tar_ustar" >&6; } depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' 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 for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed 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 ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version is >= 3" >&5 $as_echo_n "checking whether $PYTHON version is >= 3... " >&6; } prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '3'.split('.'))) + [0, 0, 0] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] sys.exit(sys.hexversion < minverhex)" if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 ($PYTHON -c "$prog") >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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_fn_error $? "Python interpreter is too old" "$LINENO" 5 fi am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 3" >&5 $as_echo_n "checking for a Python interpreter with version >= 3... " >&6; } if ${am_cv_pathless_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else for am_cv_pathless_PYTHON in python python2 python3 python3.15 python3.14 python3.13 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do test "$am_cv_pathless_PYTHON" = none && break prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '3'.split('.'))) + [0, 0, 0] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] sys.exit(sys.hexversion < minverhex)" if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5 ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then : break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 $as_echo "$am_cv_pathless_PYTHON" >&6; } # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. set dummy $am_cv_pathless_PYTHON; 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_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # 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_PYTHON="$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 PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi am_display_PYTHON=$am_cv_pathless_PYTHON fi if test "$PYTHON" = :; then as_fn_error $? "no suitable Python interpreter found" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 $as_echo_n "checking for $am_display_PYTHON version... " >&6; } if ${am_cv_python_version+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_python_version=`$PYTHON -c "import sys; print('%u.%u' % sys.version_info[:2])"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 $as_echo "$am_cv_python_version" >&6; } PYTHON_VERSION=$am_cv_python_version PYTHON_PREFIX='${prefix}' PYTHON_EXEC_PREFIX='${exec_prefix}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 $as_echo_n "checking for $am_display_PYTHON platform... " >&6; } if ${am_cv_python_platform+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 $as_echo "$am_cv_python_platform" >&6; } PYTHON_PLATFORM=$am_cv_python_platform # Just factor out some code duplication. am_python_setup_sysconfig="\ import sys # Prefer sysconfig over distutils.sysconfig, for better compatibility # with python 3.x. See automake bug#10227. try: import sysconfig except ImportError: can_use_sysconfig = 0 else: can_use_sysconfig = 1 # Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: # try: from platform import python_implementation if python_implementation() == 'CPython' and sys.version[:3] == '2.7': can_use_sysconfig = 0 except ImportError: pass" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 $as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } if ${am_cv_python_pythondir+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$prefix" = xNONE then am_py_prefix=$ac_default_prefix else am_py_prefix=$prefix fi am_cv_python_pythondir=`$PYTHON -c " $am_python_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') sys.stdout.write(sitedir)"` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` ;; *) case $am_py_prefix in /usr|/System*) ;; *) am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 $as_echo "$am_cv_python_pythondir" >&6; } pythondir=$am_cv_python_pythondir pkgpythondir=\${pythondir}/$PACKAGE { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 $as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } if ${am_cv_python_pyexecdir+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$exec_prefix" = xNONE then am_py_exec_prefix=$am_py_prefix else am_py_exec_prefix=$exec_prefix fi am_cv_python_pyexecdir=`$PYTHON -c " $am_python_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') sys.stdout.write(sitedir)"` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` ;; *) case $am_py_exec_prefix in /usr|/System*) ;; *) am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 $as_echo "$am_cv_python_pyexecdir" >&6; } pyexecdir=$am_cv_python_pyexecdir pkgpyexecdir=\${pyexecdir}/$PACKAGE fi # Extract the first word of "go-md2man", so it can be a program name with args. set dummy go-md2man; 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_MD2MAN+:} false; then : $as_echo_n "(cached) " >&6 else case $MD2MAN in [\\/]* | ?:[\\/]*) ac_cv_path_MD2MAN="$MD2MAN" # 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_MD2MAN="$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 MD2MAN=$ac_cv_path_MD2MAN if test -n "$MD2MAN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MD2MAN" >&5 $as_echo "$MD2MAN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_cv_path_MD2MAN" != x; then HAVE_MD2MAN_TRUE= HAVE_MD2MAN_FALSE='#' else HAVE_MD2MAN_TRUE='#' HAVE_MD2MAN_FALSE= fi for ac_header in error.h linux/openat2.h stdatomic.h linux/ioprio.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_type "$LINENO" "atomic_int" "ac_cv_type_atomic_int" "#include " if test "x$ac_cv_type_atomic_int" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ATOMIC_INT 1 _ACEOF fi for ac_func in copy_file_range fgetxattr statx fgetpwent_r issetugid memfd_create do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --enable-crun was given. if test "${enable_crun+set}" = set; then : enableval=$enable_crun; case "${enableval}" in yes) enable_crun=true ;; no) enable_crun=false ;; *) as_fn_error $? "bad value $(enableval) for --disable-crun" "$LINENO" 5 ;; esac else enable_crun=true fi if test "x${enable_crun}" = xtrue; then ENABLE_CRUN_TRUE= ENABLE_CRUN_FALSE='#' else ENABLE_CRUN_TRUE='#' ENABLE_CRUN_FALSE= fi # Check whether --enable-libcrun was given. if test "${enable_libcrun+set}" = set; then : enableval=$enable_libcrun; case "${enableval}" in yes) enable_libcrun=true ;; no) enable_libcrun=false ;; *) as_fn_error $? "bad value ${enablevaal} for --enable-libcrun" "$LINENO" 5 ;; esac else enable_libcrun=true fi if test "x${enable_libcrun}" = xtrue; then ENABLE_LIBCRUN_TRUE= ENABLE_LIBCRUN_FALSE='#' else ENABLE_LIBCRUN_TRUE='#' ENABLE_LIBCRUN_FALSE= fi # Check whether --enable-embedded-yajl was given. if test "${enable_embedded_yajl+set}" = set; then : enableval=$enable_embedded_yajl; case "${enableval}" in yes) embedded_yajl=true ;; no) embedded_yajl=false ;; *) as_fn_error $? "bad value ${enableval} for --enable-embedded-yajl" "$LINENO" 5 ;; esac else embedded_yajl=false fi # Check whether --enable-dynload-libcrun was given. if test "${enable_dynload_libcrun+set}" = set; then : enableval=$enable_dynload_libcrun; case "${enableval}" in yes) dynload_libcrun=true ;; no) dynload_libcrun=false ;; *) as_fn_error $? "bad value ${enableval} for --enable-dynload-libcrun" "$LINENO" 5 ;; esac else dynload_libcrun=false fi if test x"$dynload_libcrun" = xtrue; then DYNLOAD_LIBCRUN_TRUE= DYNLOAD_LIBCRUN_FALSE='#' else DYNLOAD_LIBCRUN_TRUE='#' DYNLOAD_LIBCRUN_FALSE= fi if test x"$embedded_yajl" = xtrue; then HAVE_EMBEDDED_YAJL_TRUE= HAVE_EMBEDDED_YAJL_FALSE='#' else HAVE_EMBEDDED_YAJL_TRUE='#' HAVE_EMBEDDED_YAJL_FALSE= fi 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 if test -z "$HAVE_EMBEDDED_YAJL_TRUE"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yajl_tree_get" >&5 $as_echo_n "checking for library containing yajl_tree_get... " >&6; } if ${ac_cv_search_yajl_tree_get+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char yajl_tree_get (); int main () { return yajl_tree_get (); ; return 0; } _ACEOF for ac_lib in '' yajl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_yajl_tree_get=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_yajl_tree_get+:} false; then : break fi done if ${ac_cv_search_yajl_tree_get+:} false; then : else ac_cv_search_yajl_tree_get=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_yajl_tree_get" >&5 $as_echo "$ac_cv_search_yajl_tree_get" >&6; } ac_res=$ac_cv_search_yajl_tree_get if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_YAJL 1" >>confdefs.h else as_fn_error $? "*** libyajl headers not found" "$LINENO" 5 fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for YAJL" >&5 $as_echo_n "checking for YAJL... " >&6; } if test -n "$YAJL_CFLAGS"; then pkg_cv_YAJL_CFLAGS="$YAJL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yajl >= 2.0.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "yajl >= 2.0.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_YAJL_CFLAGS=`$PKG_CONFIG --cflags "yajl >= 2.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$YAJL_LIBS"; then pkg_cv_YAJL_LIBS="$YAJL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yajl >= 2.0.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "yajl >= 2.0.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_YAJL_LIBS=`$PKG_CONFIG --libs "yajl >= 2.0.0" 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 YAJL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "yajl >= 2.0.0" 2>&1` else YAJL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "yajl >= 2.0.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$YAJL_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (yajl >= 2.0.0) were not met: $YAJL_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables YAJL_CFLAGS and YAJL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "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. Alternatively, you may set the environment variables YAJL_CFLAGS and YAJL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else YAJL_CFLAGS=$pkg_cv_YAJL_CFLAGS YAJL_LIBS=$pkg_cv_YAJL_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi # Check whether --enable-caps was given. if test "${enable_caps+set}" = set; then : enableval=$enable_caps; fi if test "x$enable_caps" != "xno"; then : for ac_header in sys/capability.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/capability.h" "ac_cv_header_sys_capability_h" "$ac_includes_default" if test "x$ac_cv_header_sys_capability_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_CAPABILITY_H 1 _ACEOF else as_fn_error $? "*** POSIX caps headers not found" "$LINENO" 5 fi done if test "$ac_cv_header_sys_capability_h" = "yes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing cap_from_name" >&5 $as_echo_n "checking for library containing cap_from_name... " >&6; } if ${ac_cv_search_cap_from_name+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cap_from_name (); int main () { return cap_from_name (); ; return 0; } _ACEOF for ac_lib in '' cap; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_cap_from_name=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_cap_from_name+:} false; then : break fi done if ${ac_cv_search_cap_from_name+:} false; then : else ac_cv_search_cap_from_name=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_cap_from_name" >&5 $as_echo "$ac_cv_search_cap_from_name" >&6; } ac_res=$ac_cv_search_cap_from_name if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_CAP 1" >>confdefs.h else as_fn_error $? "*** libcap headers not found" "$LINENO" 5 fi fi fi # Check whether --enable-dl was given. if test "${enable_dl+set}" = set; then : enableval=$enable_dl; fi if test "x$enable_dl" != "xno"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 $as_echo_n "checking for library containing dlopen... " >&6; } if ${ac_cv_search_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF for ac_lib in '' dl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_dlopen=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_dlopen+:} false; then : break fi done if ${ac_cv_search_dlopen+:} false; then : else ac_cv_search_dlopen=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 $as_echo "$ac_cv_search_dlopen" >&6; } ac_res=$ac_cv_search_dlopen if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_DLOPEN 1" >>confdefs.h fi fi # Check whether --with-mono was given. if test "${with_mono+set}" = set; then : withval=$with_mono; fi if test "x$with_mono" = "xyes"; then : for ac_header in mono/metadata/environment.h do : ac_fn_c_check_header_mongrel "$LINENO" "mono/metadata/environment.h" "ac_cv_header_mono_metadata_environment_h" "$ac_includes_default" if test "x$ac_cv_header_mono_metadata_environment_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MONO_METADATA_ENVIRONMENT_H 1 _ACEOF else as_fn_error $? "*** Missing mono headers1" "$LINENO" 5 fi done if test "$ac_cv_header_mono_metadata_environment_h" = "yes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing mono_environment_exitcode_get" >&5 $as_echo_n "checking for library containing mono_environment_exitcode_get... " >&6; } if ${ac_cv_search_mono_environment_exitcode_get+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char mono_environment_exitcode_get (); int main () { return mono_environment_exitcode_get (); ; return 0; } _ACEOF for ac_lib in '' mono-2.0; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_mono_environment_exitcode_get=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_mono_environment_exitcode_get+:} false; then : break fi done if ${ac_cv_search_mono_environment_exitcode_get+:} false; then : else ac_cv_search_mono_environment_exitcode_get=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_mono_environment_exitcode_get" >&5 $as_echo "$ac_cv_search_mono_environment_exitcode_get" >&6; } ac_res=$ac_cv_search_mono_environment_exitcode_get if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_MONO 1" >>confdefs.h else as_fn_error $? "*** Missing mono headers2" "$LINENO" 5 fi MONO_CFLAGS=`pkg-config --cflags mono-2` MONO_LIBS=`pkg-config --libs mono-2` CFLAGS="$CFLAGS `pkg-config --cflags mono-2`" LIBS="$LIBS `pkg-config --libs mono-2`" fi fi # Check whether --with-wasmer was given. if test "${with_wasmer+set}" = set; then : withval=$with_wasmer; fi if test "x$with_wasmer" = "xyes"; then : for ac_header in wasmer.h do : ac_fn_c_check_header_mongrel "$LINENO" "wasmer.h" "ac_cv_header_wasmer_h" "$ac_includes_default" if test "x$ac_cv_header_wasmer_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_WASMER_H 1 _ACEOF $as_echo "#define HAVE_WASMER 1" >>confdefs.h else as_fn_error $? "*** Missing wasmer headers" "$LINENO" 5 fi done fi # Check whether --with-wasmtime was given. if test "${with_wasmtime+set}" = set; then : withval=$with_wasmtime; fi if test "x$with_wasmtime" = "xyes"; then : for ac_header in wasmtime.h do : ac_fn_c_check_header_mongrel "$LINENO" "wasmtime.h" "ac_cv_header_wasmtime_h" "$ac_includes_default" if test "x$ac_cv_header_wasmtime_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_WASMTIME_H 1 _ACEOF $as_echo "#define HAVE_WASMTIME 1" >>confdefs.h else as_fn_error $? "*** Missing wasmtime headers" "$LINENO" 5 fi done fi # Check whether --with-wasmedge was given. if test "${with_wasmedge+set}" = set; then : withval=$with_wasmedge; fi if test "x$with_wasmedge" = "xyes"; then : for ac_header in wasmedge/wasmedge.h do : ac_fn_c_check_header_mongrel "$LINENO" "wasmedge/wasmedge.h" "ac_cv_header_wasmedge_wasmedge_h" "$ac_includes_default" if test "x$ac_cv_header_wasmedge_wasmedge_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_WASMEDGE_WASMEDGE_H 1 _ACEOF $as_echo "#define HAVE_WASMEDGE 1" >>confdefs.h else as_fn_error $? "*** Missing wasmedge headers" "$LINENO" 5 fi done fi # Check whether --with-libkrun was given. if test "${with_libkrun+set}" = set; then : withval=$with_libkrun; fi if test "x$with_libkrun" = "xyes"; then : for ac_header in libkrun.h do : ac_fn_c_check_header_mongrel "$LINENO" "libkrun.h" "ac_cv_header_libkrun_h" "$ac_includes_default" if test "x$ac_cv_header_libkrun_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBKRUN_H 1 _ACEOF $as_echo "#define HAVE_LIBKRUN 1" >>confdefs.h else as_fn_error $? "*** Missing libkrun headers" "$LINENO" 5 fi done fi if test "x$with_libkrun" = xyes; then ENABLE_KRUN_TRUE= ENABLE_KRUN_FALSE='#' else ENABLE_KRUN_TRUE='#' ENABLE_KRUN_FALSE= fi if test "x$with_wasmer" = xyes && test "x$with_wasmedge" = xyes && test "x$with_wasmtime" = xyes; then ENABLE_WASM_TRUE= ENABLE_WASM_FALSE='#' else ENABLE_WASM_TRUE='#' ENABLE_WASM_FALSE= fi # Check whether --with-spin was given. if test "${with_spin+set}" = set; then : withval=$with_spin; fi if test "x$with_spin" = "xyes"; then : $as_echo "#define HAVE_SPIN 1" >>confdefs.h fi # Check whether --enable-seccomp was given. if test "${enable_seccomp+set}" = set; then : enableval=$enable_seccomp; fi if test "x$enable_seccomp" != "xno"; then : for ac_header in seccomp.h do : ac_fn_c_check_header_mongrel "$LINENO" "seccomp.h" "ac_cv_header_seccomp_h" "$ac_includes_default" if test "x$ac_cv_header_seccomp_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SECCOMP_H 1 _ACEOF else as_fn_error $? "*** Missing libseccomp headers" "$LINENO" 5 fi done if test "$ac_cv_header_seccomp_h" = "yes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing seccomp_rule_add" >&5 $as_echo_n "checking for library containing seccomp_rule_add... " >&6; } if ${ac_cv_search_seccomp_rule_add+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char seccomp_rule_add (); int main () { return seccomp_rule_add (); ; return 0; } _ACEOF for ac_lib in '' seccomp; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_seccomp_rule_add=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_seccomp_rule_add+:} false; then : break fi done if ${ac_cv_search_seccomp_rule_add+:} false; then : else ac_cv_search_seccomp_rule_add=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_seccomp_rule_add" >&5 $as_echo "$ac_cv_search_seccomp_rule_add" >&6; } ac_res=$ac_cv_search_seccomp_rule_add if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_SECCOMP 1" >>confdefs.h else as_fn_error $? "*** libseccomp headers not found" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing seccomp_arch_resolve_name" >&5 $as_echo_n "checking for library containing seccomp_arch_resolve_name... " >&6; } if ${ac_cv_search_seccomp_arch_resolve_name+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char seccomp_arch_resolve_name (); int main () { return seccomp_arch_resolve_name (); ; return 0; } _ACEOF for ac_lib in '' seccomp; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_seccomp_arch_resolve_name=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_seccomp_arch_resolve_name+:} false; then : break fi done if ${ac_cv_search_seccomp_arch_resolve_name+:} false; then : else ac_cv_search_seccomp_arch_resolve_name=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_seccomp_arch_resolve_name" >&5 $as_echo "$ac_cv_search_seccomp_arch_resolve_name" >&6; } ac_res=$ac_cv_search_seccomp_arch_resolve_name if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define SECCOMP_ARCH_RESOLVE_NAME 1" >>confdefs.h fi fi fi # Check whether --enable-systemd was given. if test "${enable_systemd+set}" = set; then : enableval=$enable_systemd; fi if test "x$enable_systemd" != "xno"; then : for ac_header in systemd/sd-bus.h do : ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-bus.h" "ac_cv_header_systemd_sd_bus_h" "$ac_includes_default" if test "x$ac_cv_header_systemd_sd_bus_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYSTEMD_SD_BUS_H 1 _ACEOF else as_fn_error $? "*** Missing libsystemd headers" "$LINENO" 5 fi done if test "$ac_cv_header_systemd_sd_bus_h" = "yes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sd_bus_match_signal_async" >&5 $as_echo_n "checking for library containing sd_bus_match_signal_async... " >&6; } if ${ac_cv_search_sd_bus_match_signal_async+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char sd_bus_match_signal_async (); int main () { return sd_bus_match_signal_async (); ; return 0; } _ACEOF for ac_lib in '' systemd; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_sd_bus_match_signal_async=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_sd_bus_match_signal_async+:} false; then : break fi done if ${ac_cv_search_sd_bus_match_signal_async+:} false; then : else ac_cv_search_sd_bus_match_signal_async=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sd_bus_match_signal_async" >&5 $as_echo "$ac_cv_search_sd_bus_match_signal_async" >&6; } ac_res=$ac_cv_search_sd_bus_match_signal_async if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_SYSTEMD 1" >>confdefs.h else as_fn_error $? "*** Failed to find libsystemd" "$LINENO" 5 fi for ac_func in sd_notify_barrier do : ac_fn_c_check_func "$LINENO" "sd_notify_barrier" "ac_cv_func_sd_notify_barrier" if test "x$ac_cv_func_sd_notify_barrier" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SD_NOTIFY_BARRIER 1 _ACEOF fi done fi fi # Check whether --enable-bpf was given. if test "${enable_bpf+set}" = set; then : enableval=$enable_bpf; fi if test "x$enable_bpf" != "xno"; then : for ac_header in linux/bpf.h do : ac_fn_c_check_header_mongrel "$LINENO" "linux/bpf.h" "ac_cv_header_linux_bpf_h" "$ac_includes_default" if test "x$ac_cv_header_linux_bpf_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_BPF_H 1 _ACEOF fi done if test "$ac_cv_header_linux_bpf_h" = "yes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking compilation for eBPF" >&5 $as_echo_n "checking compilation for eBPF... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include void foo() { uint64_t val = 0x123456789; __attribute__ ((unused)) union bpf_attr attr; attr.insns = val; } int program = BPF_PROG_TYPE_CGROUP_DEVICE; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_EBPF 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi fi use_fPIC=no libcrun_public='__attribute__((visibility("default"))) extern' if test "x$enable_shared" = "xyes"; then $as_echo "#define SHARED_LIBCRUN 1" >>confdefs.h use_fPIC=yes if test "x$dynload_libcrun" = "xyes"; then libcrun_public='__attribute__((visibility("default"))) __attribute__((weak)) extern' $as_echo "#define DYNLOAD_LIBCRUN 1" >>confdefs.h else libcrun_public='__attribute__((visibility("default"))) extern' fi fi cat >>confdefs.h <<_ACEOF #define LIBCRUN_PUBLIC $libcrun_public _ACEOF # Check whether --with-python-bindings was given. if test "${with_python_bindings+set}" = set; then : withval=$with_python_bindings; fi if test "x$with_python_bindings" = "xyes"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYTHON" >&5 $as_echo_n "checking for PYTHON... " >&6; } if test -n "$PYTHON_CFLAGS"; then pkg_cv_PYTHON_CFLAGS="$PYTHON_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python3\""; } >&5 ($PKG_CONFIG --exists --print-errors "python3") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PYTHON_CFLAGS=`$PKG_CONFIG --cflags "python3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$PYTHON_LIBS"; then pkg_cv_PYTHON_LIBS="$PYTHON_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python3\""; } >&5 ($PKG_CONFIG --exists --print-errors "python3") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PYTHON_LIBS=`$PKG_CONFIG --libs "python3" 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 PYTHON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python3" 2>&1` else PYTHON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python3" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PYTHON_PKG_ERRORS" >&5 as_fn_error $? "*** python headers not found" "$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 $? "*** python headers not found" "$LINENO" 5 else PYTHON_CFLAGS=$pkg_cv_PYTHON_CFLAGS PYTHON_LIBS=$pkg_cv_PYTHON_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi use_fPIC=yes fi # Check whether --with-lua-bindings was given. if test "${with_lua_bindings+set}" = set; then : withval=$with_lua_bindings; fi # Check whether --enable-lua-path-guessing was given. if test "${enable_lua_path_guessing+set}" = set; then : enableval=$enable_lua_path_guessing; case "${enableval}" in yes) enable_lua_path_guessing=true ;; no) enable_lua_path_guessing=false ;; *) as_fn_error $? "bad value ${enablevaal} for --enable-lua-path-guessing" "$LINENO" 5 ;; esac else enable_lua_path_guessing=true fi if test "x$with_lua_bindings" = "xyes"; then : if test "x$LUA" != 'x'; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $LUA is a Lua interpreter" >&5 $as_echo_n "checking if $LUA is a Lua interpreter... " >&6; } _ax_lua_factorial=`$LUA 2>/dev/null -e ' -- a simple factorial function fact (n) if n == 0 then return 1 else return n * fact(n-1) end end print("fact(5) is " .. fact(5))'` if test "$_ax_lua_factorial" = 'fact(5) is 120'; 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_fn_error $? "not a Lua interpreter" "$LINENO" 5 fi _ax_check_text="whether $LUA version >= 5.4, < 5.5" { $as_echo "$as_me:${as_lineno-$LINENO}: checking $_ax_check_text" >&5 $as_echo_n "checking $_ax_check_text... " >&6; } _ax_lua_good_version=`$LUA -e ' -- a script to compare versions function verstr2num(verstr) local _, _, majorver, minorver = string.find(verstr, "^(%d+)%.(%d+)") if majorver and minorver then return tonumber(majorver) * 100 + tonumber(minorver) end end local minver = verstr2num("5.4") local _, _, trimver = string.find(_VERSION, "^Lua (.*)") local ver = verstr2num(trimver) local maxver = verstr2num("5.5") or 1e9 if minver <= ver and ver < maxver then print("yes") else print("no") end'` if test "x$_ax_lua_good_version" = "xyes"; 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_fn_error $? "version is out of range for specified LUA" "$LINENO" 5 fi ax_display_LUA=$LUA else _ax_check_text="for a Lua interpreter with version >= 5.4, < 5.5" { $as_echo "$as_me:${as_lineno-$LINENO}: checking $_ax_check_text" >&5 $as_echo_n "checking $_ax_check_text... " >&6; } if ${ax_cv_pathless_LUA+:} false; then : $as_echo_n "(cached) " >&6 else for ax_cv_pathless_LUA in lua lua5.4 lua54 lua5.3 lua53 lua5.2 lua52 lua5.1 lua51 lua50 none; do test "x$ax_cv_pathless_LUA" = 'xnone' && break _ax_lua_factorial=`$ax_cv_pathless_LUA 2>/dev/null -e ' -- a simple factorial function fact (n) if n == 0 then return 1 else return n * fact(n-1) end end print("fact(5) is " .. fact(5))'` if test "$_ax_lua_factorial" = 'fact(5) is 120'; then : else continue fi _ax_lua_good_version=`$ax_cv_pathless_LUA -e ' -- a script to compare versions function verstr2num(verstr) local _, _, majorver, minorver = string.find(verstr, "^(%d+)%.(%d+)") if majorver and minorver then return tonumber(majorver) * 100 + tonumber(minorver) end end local minver = verstr2num("5.4") local _, _, trimver = string.find(_VERSION, "^Lua (.*)") local ver = verstr2num(trimver) local maxver = verstr2num("5.5") or 1e9 if minver <= ver and ver < maxver then print("yes") else print("no") end'` if test "x$_ax_lua_good_version" = "xyes"; then : break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_pathless_LUA" >&5 $as_echo "$ax_cv_pathless_LUA" >&6; } if test "x$ax_cv_pathless_LUA" = 'xnone'; then : LUA=':' else # Extract the first word of "$ax_cv_pathless_LUA", so it can be a program name with args. set dummy $ax_cv_pathless_LUA; 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_LUA+:} false; then : $as_echo_n "(cached) " >&6 else case $LUA in [\\/]* | ?:[\\/]*) ac_cv_path_LUA="$LUA" # 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_LUA="$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 LUA=$ac_cv_path_LUA if test -n "$LUA"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LUA" >&5 $as_echo "$LUA" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi ax_display_LUA=$ax_cv_pathless_LUA fi if test "x$LUA" = 'x:'; then : as_fn_error $? "*** lua interpreter not found" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ax_display_LUA version" >&5 $as_echo_n "checking for $ax_display_LUA version... " >&6; } if ${ax_cv_lua_version+:} false; then : $as_echo_n "(cached) " >&6 else ax_cv_lua_version=`$LUA -e ' -- return a version number in X.Y format local _, _, ver = string.find(_VERSION, "^Lua (%d+%.%d+)") print(ver)'` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lua_version" >&5 $as_echo "$ax_cv_lua_version" >&6; } if test "x$ax_cv_lua_version" = 'x'; then : as_fn_error $? "invalid Lua version number" "$LINENO" 5 fi LUA_VERSION=$ax_cv_lua_version LUA_SHORT_VERSION=`echo "$LUA_VERSION" | $SED 's|\.||'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ax_display_LUA platform" >&5 $as_echo_n "checking for $ax_display_LUA platform... " >&6; } if ${ax_cv_lua_platform+:} false; then : $as_echo_n "(cached) " >&6 else ax_cv_lua_platform=`$LUA -e 'print("unknown")'` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lua_platform" >&5 $as_echo "$ax_cv_lua_platform" >&6; } LUA_PLATFORM=$ax_cv_lua_platform LUA_PREFIX='${prefix}' LUA_EXEC_PREFIX='${exec_prefix}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ax_display_LUA script directory" >&5 $as_echo_n "checking for $ax_display_LUA script directory... " >&6; } if ${ax_cv_lua_luadir+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$prefix" = 'xNONE'; then : ax_lua_prefix=$ac_default_prefix else ax_lua_prefix=$prefix fi ax_cv_lua_luadir="$LUA_PREFIX/share/lua/$LUA_VERSION" ax_lua_prefixed_path=`$LUA -e ' -- get the path based on search type local searchtype = "script" local paths = "" if searchtype == "script" then paths = (package and package.path) or LUA_PATH elseif searchtype == "module" then paths = (package and package.cpath) or LUA_CPATH end -- search for the prefix local prefix = "'$ax_lua_prefix'" local minpath = "" local mindepth = 1e9 string.gsub(paths, "([^;]+)", function (path) path = string.gsub(path, "%?.*$", "") path = string.gsub(path, "/[^/]*$", "") if string.find(path, prefix) then local depth = string.len(string.gsub(path, "[^/]", "")) if depth < mindepth then minpath = path mindepth = depth end end end) print(minpath)'` if test "x$ax_lua_prefixed_path" != 'x'; then : _ax_strip_prefix=`echo "$ax_lua_prefix" | $SED 's|.|.|g'` ax_cv_lua_luadir=`echo "$ax_lua_prefixed_path" | \ $SED "s|^$_ax_strip_prefix|$LUA_PREFIX|"` fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lua_luadir" >&5 $as_echo "$ax_cv_lua_luadir" >&6; } luadir=$ax_cv_lua_luadir pkgluadir=\${luadir}/$PACKAGE { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ax_display_LUA module directory" >&5 $as_echo_n "checking for $ax_display_LUA module directory... " >&6; } if ${ax_cv_lua_luaexecdir+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$exec_prefix" = 'xNONE'; then : ax_lua_exec_prefix=$ax_lua_prefix else ax_lua_exec_prefix=$exec_prefix fi ax_cv_lua_luaexecdir="$LUA_EXEC_PREFIX/lib/lua/$LUA_VERSION" ax_lua_prefixed_path=`$LUA -e ' -- get the path based on search type local searchtype = "module" local paths = "" if searchtype == "script" then paths = (package and package.path) or LUA_PATH elseif searchtype == "module" then paths = (package and package.cpath) or LUA_CPATH end -- search for the prefix local prefix = "'$ax_lua_exec_prefix'" local minpath = "" local mindepth = 1e9 string.gsub(paths, "([^;]+)", function (path) path = string.gsub(path, "%?.*$", "") path = string.gsub(path, "/[^/]*$", "") if string.find(path, prefix) then local depth = string.len(string.gsub(path, "[^/]", "")) if depth < mindepth then minpath = path mindepth = depth end end end) print(minpath)'` if test "x$ax_lua_prefixed_path" != 'x'; then : _ax_strip_prefix=`echo "$ax_lua_exec_prefix" | $SED 's|.|.|g'` ax_cv_lua_luaexecdir=`echo "$ax_lua_prefixed_path" | \ $SED "s|^$_ax_strip_prefix|$LUA_EXEC_PREFIX|"` fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lua_luaexecdir" >&5 $as_echo "$ax_cv_lua_luaexecdir" >&6; } luaexecdir=$ax_cv_lua_luaexecdir pkgluaexecdir=\${luaexecdir}/$PACKAGE fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if LUA_VERSION is defined" >&5 $as_echo_n "checking if LUA_VERSION is defined... " >&6; } if test "x$LUA_VERSION" != 'x'; 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_fn_error $? "cannot check Lua headers without knowing LUA_VERSION" "$LINENO" 5 fi LUA_SHORT_VERSION=`echo "$LUA_VERSION" | $SED 's|\.||'` _ax_lua_saved_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $LUA_INCLUDE" for ac_header in lua.h lualib.h lauxlib.h luaconf.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done CPPFLAGS=$_ax_lua_saved_cppflags if test "x$LUA_INCLUDE" = 'x' && test "x$ac_cv_header_lua_h" != 'xyes'; then : for _ax_include_path in /usr/include/lua$LUA_VERSION \ /usr/include/lua-$LUA_VERSION \ /usr/include/lua/$LUA_VERSION \ /usr/include/lua$LUA_SHORT_VERSION \ /usr/local/include/lua$LUA_VERSION \ /usr/local/include/lua-$LUA_VERSION \ /usr/local/include/lua/$LUA_VERSION \ /usr/local/include/lua$LUA_SHORT_VERSION \ ; do test ! -d "$_ax_include_path" && continue { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua headers in" >&5 $as_echo_n "checking for Lua headers in... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_ax_include_path" >&5 $as_echo "$_ax_include_path" >&6; } { ac_cv_header_lua_h=; unset ac_cv_header_lua_h;} { ac_cv_header_lualib_h=; unset ac_cv_header_lualib_h;} { ac_cv_header_lauxlib_h=; unset ac_cv_header_lauxlib_h;} { ac_cv_header_luaconf_h=; unset ac_cv_header_luaconf_h;} _ax_lua_saved_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$_ax_include_path" for ac_header in lua.h lualib.h lauxlib.h luaconf.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done CPPFLAGS=$_ax_lua_saved_cppflags if test "x$ac_cv_header_lua_h" = 'xyes'; then : LUA_INCLUDE="-I$_ax_include_path" break fi done fi if test "x$ac_cv_header_lua_h" = 'xyes'; then : if test "x$cross_compiling" != 'xyes'; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua header version" >&5 $as_echo_n "checking for Lua header version... " >&6; } if ${ax_cv_lua_header_version+:} false; then : $as_echo_n "(cached) " >&6 else _ax_lua_saved_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $LUA_INCLUDE" if ac_fn_c_compute_int "$LINENO" "LUA_VERSION_NUM/100" "ax_cv_lua_header_version_major" "$ac_includes_default #include "; then : else ax_cv_lua_header_version_major=unknown fi if ac_fn_c_compute_int "$LINENO" "LUA_VERSION_NUM%100" "ax_cv_lua_header_version_minor" "$ac_includes_default #include "; then : else ax_cv_lua_header_version_minor=unknown fi if test "x$ax_cv_lua_header_version_major" = xunknown || test "x$ax_cv_lua_header_version_minor" = xunknown; then : ax_cv_lua_header_version=unknown else ax_cv_lua_header_version="$ax_cv_lua_header_version_major.$ax_cv_lua_header_version_minor" fi CPPFLAGS=$_ax_lua_saved_cppflags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lua_header_version" >&5 $as_echo "$ax_cv_lua_header_version" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Lua header version matches $LUA_VERSION" >&5 $as_echo_n "checking if Lua header version matches $LUA_VERSION... " >&6; } if test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } ax_header_version_match='yes' else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ax_header_version_match='no' fi else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling so assuming header version number matches" >&5 $as_echo "$as_me: WARNING: cross compiling so assuming header version number matches" >&2;} ax_header_version_match='yes' fi fi if test "x$ax_header_version_match" != 'xyes' && test "x$LUA_INCLUDE" != 'x'; then : as_fn_error $? "cannot find headers for specified LUA_INCLUDE" "$LINENO" 5 fi if test "x$ax_header_version_match" = 'xyes'; then : else as_fn_error $? "*** lua headers not found" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if LUA_VERSION is defined" >&5 $as_echo_n "checking if LUA_VERSION is defined... " >&6; } if test "x$LUA_VERSION" != 'x'; 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_fn_error $? "cannot check Lua libs without knowing LUA_VERSION" "$LINENO" 5 fi if test "x$LUA_LIB" != 'x'; then : _ax_lua_saved_libs=$LIBS LIBS="$LIBS $LUA_LIB" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing lua_load" >&5 $as_echo_n "checking for library containing lua_load... " >&6; } if ${ac_cv_search_lua_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char lua_load (); int main () { return lua_load (); ; return 0; } _ACEOF for ac_lib in '' ; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_lua_load=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_lua_load+:} false; then : break fi done if ${ac_cv_search_lua_load+:} false; then : else ac_cv_search_lua_load=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_lua_load" >&5 $as_echo "$ac_cv_search_lua_load" >&6; } ac_res=$ac_cv_search_lua_load if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" _ax_found_lua_libs='yes' else _ax_found_lua_libs='no' fi LIBS=$_ax_lua_saved_libs if test "x$_ax_found_lua_libs" != 'xyes'; then : as_fn_error $? "cannot find libs for specified LUA_LIB" "$LINENO" 5 fi else _ax_lua_extra_libs='' _ax_lua_saved_libs=$LIBS LIBS="$LIBS $LUA_LIB" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing exp" >&5 $as_echo_n "checking for library containing exp... " >&6; } if ${ac_cv_search_exp+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char exp (); int main () { return exp (); ; return 0; } _ACEOF for ac_lib in '' m; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_exp=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_exp+:} false; then : break fi done if ${ac_cv_search_exp+:} false; then : else ac_cv_search_exp=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_exp" >&5 $as_echo "$ac_cv_search_exp" >&6; } ac_res=$ac_cv_search_exp if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 $as_echo_n "checking for library containing dlopen... " >&6; } if ${ac_cv_search_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF for ac_lib in '' dl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_dlopen=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_dlopen+:} false; then : break fi done if ${ac_cv_search_dlopen+:} false; then : else ac_cv_search_dlopen=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 $as_echo "$ac_cv_search_dlopen" >&6; } ac_res=$ac_cv_search_dlopen if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi LIBS=$_ax_lua_saved_libs if test "x$ac_cv_search_exp" != 'xno' && test "x$ac_cv_search_exp" != 'xnone required'; then : _ax_lua_extra_libs="$_ax_lua_extra_libs $ac_cv_search_exp" fi if test "x$ac_cv_search_dlopen" != 'xno' && test "x$ac_cv_search_dlopen" != 'xnone required'; then : _ax_lua_extra_libs="$_ax_lua_extra_libs $ac_cv_search_dlopen" fi _ax_lua_saved_libs=$LIBS LIBS="$LIBS $LUA_LIB" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing lua_load" >&5 $as_echo_n "checking for library containing lua_load... " >&6; } if ${ac_cv_search_lua_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char lua_load (); int main () { return lua_load (); ; return 0; } _ACEOF for ac_lib in '' lua$LUA_VERSION \ lua$LUA_SHORT_VERSION \ lua-$LUA_VERSION \ lua-$LUA_SHORT_VERSION \ lua \ ; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $_ax_lua_extra_libs $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_lua_load=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_lua_load+:} false; then : break fi done if ${ac_cv_search_lua_load+:} false; then : else ac_cv_search_lua_load=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_lua_load" >&5 $as_echo "$ac_cv_search_lua_load" >&6; } ac_res=$ac_cv_search_lua_load if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" _ax_found_lua_libs='yes' else _ax_found_lua_libs='no' fi LIBS=$_ax_lua_saved_libs if test "x$ac_cv_search_lua_load" != 'xno' && test "x$ac_cv_search_lua_load" != 'xnone required'; then : LUA_LIB="$ac_cv_search_lua_load $_ax_lua_extra_libs" fi fi if test "x$_ax_found_lua_libs" = 'xyes'; then : else as_fn_error $? "*** lua libs not found" "$LINENO" 5 fi if test "x$enable_lua_path_guessing" = "xfalse"; then : luaexecdir=$libdir fi use_fPIC=yes fi if test "x$use_fPIC" = "xyes"; then : # configure should not touch CFLAGS/LDFLAGS but we need it to propagate it # to libocispec. export CFLAGS="$CFLAGS -fPIC" export LDFLAGS="$LDFLAGS -fPIC" fi # Check whether --enable-criu was given. if test "${enable_criu+set}" = set; then : enableval=$enable_criu; fi if test "x$enable_criu" != "xno"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRIU" >&5 $as_echo_n "checking for CRIU... " >&6; } if test -n "$CRIU_CFLAGS"; then pkg_cv_CRIU_CFLAGS="$CRIU_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"criu >= 3.15\""; } >&5 ($PKG_CONFIG --exists --print-errors "criu >= 3.15") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CRIU_CFLAGS=`$PKG_CONFIG --cflags "criu >= 3.15" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$CRIU_LIBS"; then pkg_cv_CRIU_LIBS="$CRIU_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"criu >= 3.15\""; } >&5 ($PKG_CONFIG --exists --print-errors "criu >= 3.15") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CRIU_LIBS=`$PKG_CONFIG --libs "criu >= 3.15" 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 CRIU_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "criu >= 3.15" 2>&1` else CRIU_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "criu >= 3.15" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CRIU_PKG_ERRORS" >&5 have_criu="no" { $as_echo "$as_me:${as_lineno-$LINENO}: CRIU headers not found, building without CRIU support" >&5 $as_echo "$as_me: CRIU headers not found, building without CRIU support" >&6;} elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } have_criu="no" { $as_echo "$as_me:${as_lineno-$LINENO}: CRIU headers not found, building without CRIU support" >&5 $as_echo "$as_me: CRIU headers not found, building without CRIU support" >&6;} else CRIU_CFLAGS=$pkg_cv_CRIU_CFLAGS CRIU_LIBS=$pkg_cv_CRIU_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } have_criu="yes" fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRIU_JOIN_NS" >&5 $as_echo_n "checking for CRIU_JOIN_NS... " >&6; } if test -n "$CRIU_JOIN_NS_CFLAGS"; then pkg_cv_CRIU_JOIN_NS_CFLAGS="$CRIU_JOIN_NS_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"criu > 3.16\""; } >&5 ($PKG_CONFIG --exists --print-errors "criu > 3.16") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CRIU_JOIN_NS_CFLAGS=`$PKG_CONFIG --cflags "criu > 3.16" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$CRIU_JOIN_NS_LIBS"; then pkg_cv_CRIU_JOIN_NS_LIBS="$CRIU_JOIN_NS_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"criu > 3.16\""; } >&5 ($PKG_CONFIG --exists --print-errors "criu > 3.16") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CRIU_JOIN_NS_LIBS=`$PKG_CONFIG --libs "criu > 3.16" 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 CRIU_JOIN_NS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "criu > 3.16" 2>&1` else CRIU_JOIN_NS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "criu > 3.16" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CRIU_JOIN_NS_PKG_ERRORS" >&5 have_criu_join_ns="no" { $as_echo "$as_me:${as_lineno-$LINENO}: CRIU version doesn't support join-ns API" >&5 $as_echo "$as_me: CRIU version doesn't support join-ns API" >&6;} elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } have_criu_join_ns="no" { $as_echo "$as_me:${as_lineno-$LINENO}: CRIU version doesn't support join-ns API" >&5 $as_echo "$as_me: CRIU version doesn't support join-ns API" >&6;} else CRIU_JOIN_NS_CFLAGS=$pkg_cv_CRIU_JOIN_NS_CFLAGS CRIU_JOIN_NS_LIBS=$pkg_cv_CRIU_JOIN_NS_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } have_criu_join_ns="yes" fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRIU_PRE_DUMP" >&5 $as_echo_n "checking for CRIU_PRE_DUMP... " >&6; } if test -n "$CRIU_PRE_DUMP_CFLAGS"; then pkg_cv_CRIU_PRE_DUMP_CFLAGS="$CRIU_PRE_DUMP_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"criu > 3.16.1\""; } >&5 ($PKG_CONFIG --exists --print-errors "criu > 3.16.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CRIU_PRE_DUMP_CFLAGS=`$PKG_CONFIG --cflags "criu > 3.16.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$CRIU_PRE_DUMP_LIBS"; then pkg_cv_CRIU_PRE_DUMP_LIBS="$CRIU_PRE_DUMP_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"criu > 3.16.1\""; } >&5 ($PKG_CONFIG --exists --print-errors "criu > 3.16.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CRIU_PRE_DUMP_LIBS=`$PKG_CONFIG --libs "criu > 3.16.1" 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 CRIU_PRE_DUMP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "criu > 3.16.1" 2>&1` else CRIU_PRE_DUMP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "criu > 3.16.1" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CRIU_PRE_DUMP_PKG_ERRORS" >&5 have_criu_pre_dump="no" { $as_echo "$as_me:${as_lineno-$LINENO}: CRIU version doesn't support for pre-dumping" >&5 $as_echo "$as_me: CRIU version doesn't support for pre-dumping" >&6;} elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } have_criu_pre_dump="no" { $as_echo "$as_me:${as_lineno-$LINENO}: CRIU version doesn't support for pre-dumping" >&5 $as_echo "$as_me: CRIU version doesn't support for pre-dumping" >&6;} else CRIU_PRE_DUMP_CFLAGS=$pkg_cv_CRIU_PRE_DUMP_CFLAGS CRIU_PRE_DUMP_LIBS=$pkg_cv_CRIU_PRE_DUMP_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } have_criu_pre_dump="yes" fi if test "$have_criu" = "yes"; then : $as_echo "#define HAVE_CRIU 1" >>confdefs.h fi if test "$have_criu_join_ns" = "yes"; then : $as_echo "#define CRIU_JOIN_NS_SUPPORT 1" >>confdefs.h fi if test "$have_criu_pre_dump" = "yes"; then : $as_echo "#define CRIU_PRE_DUMP_SUPPORT 1" >>confdefs.h fi else { $as_echo "$as_me:${as_lineno-$LINENO}: CRIU support disabled per user request" >&5 $as_echo "$as_me: CRIU support disabled per user request" >&6;} fi FOUND_LIBS=$LIBS LIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for new mount API (fsconfig)" >&5 $as_echo_n "checking for new mount API (fsconfig)... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int cmd = FSCONFIG_CMD_CREATE; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_FSCONFIG_CMD_CREATE_SYS_MOUNT_H 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* also make sure it doesn't conflict with since it is always used. */ #include #include int cmd = FSCONFIG_CMD_CREATE; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_FSCONFIG_CMD_CREATE_LINUX_MOUNT_H 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for seccomp notify API" >&5 $as_echo_n "checking for seccomp notify API... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int cmd = SECCOMP_GET_NOTIF_SIZES; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_SECCOMP_GET_NOTIF_SIZES 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CRUN_LIBDIR=$libdir/crun RPM_VERSION=$(echo $VERSION | sed -e's,^\([^-]*\).*$,\1,g') GIT_COMMIT_ID=$(git rev-parse --short HEAD) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gperf", so it can be a program name with args. set dummy ${ac_tool_prefix}gperf; 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_GPERF+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$GPERF"; then ac_cv_prog_GPERF="$GPERF" # 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_GPERF="${ac_tool_prefix}gperf" $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 GPERF=$ac_cv_prog_GPERF if test -n "$GPERF"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPERF" >&5 $as_echo "$GPERF" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_GPERF"; then ac_ct_GPERF=$GPERF # Extract the first word of "gperf", so it can be a program name with args. set dummy gperf; 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_GPERF+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_GPERF"; then ac_cv_prog_ac_ct_GPERF="$ac_ct_GPERF" # 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_GPERF="gperf" $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_GPERF=$ac_cv_prog_ac_ct_GPERF if test -n "$ac_ct_GPERF"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_GPERF" >&5 $as_echo "$ac_ct_GPERF" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_GPERF" = x; then GPERF="" 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 GPERF=$ac_ct_GPERF fi else GPERF="$ac_cv_prog_GPERF" fi if test -z "$GPERF"; then { $as_echo "$as_me:${as_lineno-$LINENO}: gperf not found - cannot rebuild signal parser code" >&5 $as_echo "$as_me: gperf not found - cannot rebuild signal parser code" >&6;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing argp_parse" >&5 $as_echo_n "checking for library containing argp_parse... " >&6; } if ${ac_cv_search_argp_parse+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char argp_parse (); int main () { return argp_parse (); ; return 0; } _ACEOF for ac_lib in '' argp; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_argp_parse=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_argp_parse+:} false; then : break fi done if ${ac_cv_search_argp_parse+:} false; then : else ac_cv_search_argp_parse=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_argp_parse" >&5 $as_echo "$ac_cv_search_argp_parse" >&6; } ac_res=$ac_cv_search_argp_parse if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else as_fn_error $? "*** argp functions not found - install libargp or argp_standalone" "$LINENO" 5 fi if test "x$with_python_bindings" = "xyes"; then PYTHON_BINDINGS_TRUE= PYTHON_BINDINGS_FALSE='#' else PYTHON_BINDINGS_TRUE='#' PYTHON_BINDINGS_FALSE= fi if test "x$with_lua_bindings" = "xyes"; then LUA_BINDINGS_TRUE= LUA_BINDINGS_FALSE='#' else LUA_BINDINGS_TRUE='#' LUA_BINDINGS_FALSE= fi if test "x$have_criu" = "xyes"; then CRIU_SUPPORT_TRUE= CRIU_SUPPORT_FALSE='#' else CRIU_SUPPORT_TRUE='#' CRIU_SUPPORT_FALSE= fi if test "x$enable_shared" = "xyes"; then SHARED_LIBCRUN_TRUE= SHARED_LIBCRUN_FALSE='#' else SHARED_LIBCRUN_TRUE='#' SHARED_LIBCRUN_FALSE= fi ac_config_files="$ac_config_files Makefile" subdirs="$subdirs libocispec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -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 -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_MD2MAN_TRUE}" && test -z "${HAVE_MD2MAN_FALSE}"; then as_fn_error $? "conditional \"HAVE_MD2MAN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_CRUN_TRUE}" && test -z "${ENABLE_CRUN_FALSE}"; then as_fn_error $? "conditional \"ENABLE_CRUN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_LIBCRUN_TRUE}" && test -z "${ENABLE_LIBCRUN_FALSE}"; then as_fn_error $? "conditional \"ENABLE_LIBCRUN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DYNLOAD_LIBCRUN_TRUE}" && test -z "${DYNLOAD_LIBCRUN_FALSE}"; then as_fn_error $? "conditional \"DYNLOAD_LIBCRUN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_EMBEDDED_YAJL_TRUE}" && test -z "${HAVE_EMBEDDED_YAJL_FALSE}"; then as_fn_error $? "conditional \"HAVE_EMBEDDED_YAJL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_KRUN_TRUE}" && test -z "${ENABLE_KRUN_FALSE}"; then as_fn_error $? "conditional \"ENABLE_KRUN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_WASM_TRUE}" && test -z "${ENABLE_WASM_FALSE}"; then as_fn_error $? "conditional \"ENABLE_WASM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PYTHON_BINDINGS_TRUE}" && test -z "${PYTHON_BINDINGS_FALSE}"; then as_fn_error $? "conditional \"PYTHON_BINDINGS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LUA_BINDINGS_TRUE}" && test -z "${LUA_BINDINGS_FALSE}"; then as_fn_error $? "conditional \"LUA_BINDINGS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${CRIU_SUPPORT_TRUE}" && test -z "${CRIU_SUPPORT_FALSE}"; then as_fn_error $? "conditional \"CRIU_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SHARED_LIBCRUN_TRUE}" && test -z "${SHARED_LIBCRUN_FALSE}"; then as_fn_error $? "conditional \"SHARED_LIBCRUN\" 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 crun $as_me 1.16.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ crun config.status 1.16.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" _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" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES 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 "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; 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 # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file, --srcdir, and --disable-option-checking arguments # so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" shift for ac_arg do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ | --c=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; --disable-option-checking) ;; *) case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" # Pass --silent if test "$silent" = yes; then ac_sub_configure_args="--silent $ac_sub_configure_args" fi # Always prepend --disable-option-checking to silence warnings, since # different subdirs can have different --enable and --with options. ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 $as_echo "$ac_msg" >&6 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 cd "$ac_dir" # Check for guested configure; otherwise get Cygnus style configure. if test -f "$ac_srcdir/configure.gnu"; then ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then ac_sub_configure=$ac_srcdir/configure elif test -f "$ac_srcdir/configure.in"; then # This should be Cygnus configure. ac_sub_configure=$ac_aux_dir/configure else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative name. ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 fi cd "$ac_popdir" done 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 crun-1.16.1/configure.ac0000644000000000000000000003034014654642544013241 0ustar0000000000000000AC_PREREQ([2.69]) AC_INIT([crun], m4_esyscmd([build-aux/git-version-gen --prefix "" .tarball-version]), [giuseppe@scrivano.org]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) AC_REQUIRE_AUX_FILE([tap-driver.sh]) AC_CONFIG_SRCDIR([src/crun.c]) AC_PROG_LN_S LT_INIT([disable-shared]) AM_INIT_AUTOMAKE([1.11.2 -Wno-portability foreign tar-ustar no-dist-gzip dist-xz subdir-objects]) AM_MAINTAINER_MODE([enable]) AM_SILENT_RULES([yes]) AC_PROG_AWK AC_PROG_SED AC_PROG_CC AM_PATH_PYTHON(3) AC_PATH_PROG(MD2MAN, go-md2man) AM_CONDITIONAL([HAVE_MD2MAN], [test "x$ac_cv_path_MD2MAN" != x]) AC_CHECK_HEADERS([error.h linux/openat2.h stdatomic.h linux/ioprio.h]) AC_CHECK_TYPES([atomic_int], [], [], [[#include ]]) AC_CHECK_FUNCS(copy_file_range fgetxattr statx fgetpwent_r issetugid memfd_create) AC_ARG_ENABLE(crun, AS_HELP_STRING([--enable-crun], [Include crun executable in installation (default: yes)]), [ case "${enableval}" in yes) enable_crun=true ;; no) enable_crun=false ;; *) AC_MSG_ERROR(bad value $(enableval) for --disable-crun) ;; esac], [enable_crun=true]) AM_CONDITIONAL([ENABLE_CRUN], [test "x${enable_crun}" = xtrue]) AC_ARG_ENABLE(libcrun, AS_HELP_STRING([--enable-libcrun], [Include libcrun in installation (default: yes)]), [ case "${enableval}" in yes) enable_libcrun=true ;; no) enable_libcrun=false ;; *) AC_MSG_ERROR(bad value ${enablevaal} for --enable-libcrun) ;; esac ], [enable_libcrun=true]) AM_CONDITIONAL([ENABLE_LIBCRUN], [test "x${enable_libcrun}" = xtrue]) dnl embedded yajl AC_ARG_ENABLE(embedded-yajl, AS_HELP_STRING([--enable-embedded-yajl], [Statically link a modified yajl version]), [ case "${enableval}" in yes) embedded_yajl=true ;; no) embedded_yajl=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-embedded-yajl) ;; esac],[embedded_yajl=false]) AC_ARG_ENABLE(dynload-libcrun, AS_HELP_STRING([--enable-dynload-libcrun], [Dynamically load libcrun]), [ case "${enableval}" in yes) dynload_libcrun=true ;; no) dynload_libcrun=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-dynload-libcrun) ;; esac],[dynload_libcrun=false]) AM_CONDITIONAL([DYNLOAD_LIBCRUN], [test x"$dynload_libcrun" = xtrue]) AM_CONDITIONAL([HAVE_EMBEDDED_YAJL], [test x"$embedded_yajl" = xtrue]) AM_COND_IF([HAVE_EMBEDDED_YAJL], [], [ AC_SEARCH_LIBS(yajl_tree_get, [yajl], [AC_DEFINE([HAVE_YAJL], 1, [Define if libyajl is available])], [AC_MSG_ERROR([*** libyajl headers not found])]) PKG_CHECK_MODULES([YAJL], [yajl >= 2.0.0]) ]) dnl libcap AC_ARG_ENABLE([caps], AS_HELP_STRING([--disable-caps], [Ignore libcap and disable support])) AS_IF([test "x$enable_caps" != "xno"], [ AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])]) AS_IF([test "$ac_cv_header_sys_capability_h" = "yes"], [ AC_SEARCH_LIBS(cap_from_name, [cap], [AC_DEFINE([HAVE_CAP], 1, [Define if libcap is available])], [AC_MSG_ERROR([*** libcap headers not found])]) ]) ]) dnl dl AC_ARG_ENABLE([dl], AS_HELP_STRING([--disable-dl], [Disable dynamic libraries support])) AS_IF([test "x$enable_dl" != "xno"], [ AC_SEARCH_LIBS([dlopen], [dl], [AC_DEFINE([HAVE_DLOPEN], 1, [Define if DLOPEN is available])], []) ]) AC_SUBST(MONO_CFLAGS) AC_SUBST(MONO_LIBS) dnl include support for mono (EXPERIMENTAL) AC_ARG_WITH([mono], AS_HELP_STRING([--with-mono], [build with mono support])) AS_IF([test "x$with_mono" = "xyes"], [ AC_CHECK_HEADERS([mono/metadata/environment.h], [], [AC_MSG_ERROR([*** Missing mono headers1])]) AS_IF([test "$ac_cv_header_mono_metadata_environment_h" = "yes"], [ AC_SEARCH_LIBS(mono_environment_exitcode_get, [mono-2.0], [AC_DEFINE([HAVE_MONO], 1, [Define if mono is available])], [AC_MSG_ERROR([*** Missing mono headers2])]) MONO_CFLAGS=`pkg-config --cflags mono-2` MONO_LIBS=`pkg-config --libs mono-2` CFLAGS="$CFLAGS `pkg-config --cflags mono-2`" LIBS="$LIBS `pkg-config --libs mono-2`" ]) ]) dnl include support for wasmer (EXPERIMENTAL) AC_ARG_WITH([wasmer], AS_HELP_STRING([--with-wasmer], [build with wasmer support])) AS_IF([test "x$with_wasmer" = "xyes"], AC_CHECK_HEADERS([wasmer.h], AC_DEFINE([HAVE_WASMER], 1, [Define if wasmer is available]), [AC_MSG_ERROR([*** Missing wasmer headers])])) dnl include support for wasmtime (EXPERIMENTAL) AC_ARG_WITH([wasmtime], AS_HELP_STRING([--with-wasmtime], [build with wasmtime support])) AS_IF([test "x$with_wasmtime" = "xyes"], AC_CHECK_HEADERS([wasmtime.h], AC_DEFINE([HAVE_WASMTIME], 1, [Define if wasmtime is available]), [AC_MSG_ERROR([*** Missing wasmtime headers])])) dnl include support for wasmedge (EXPERIMENTAL) AC_ARG_WITH([wasmedge], AS_HELP_STRING([--with-wasmedge], [build with WasmEdge support])) AS_IF([test "x$with_wasmedge" = "xyes"], AC_CHECK_HEADERS([wasmedge/wasmedge.h], AC_DEFINE([HAVE_WASMEDGE], 1, [Define if WasmEdge is available]), [AC_MSG_ERROR([*** Missing wasmedge headers])])) dnl include support for libkrun (EXPERIMENTAL) AC_ARG_WITH([libkrun], AS_HELP_STRING([--with-libkrun], [build with libkrun support])) AS_IF([test "x$with_libkrun" = "xyes"], AC_CHECK_HEADERS([libkrun.h], AC_DEFINE([HAVE_LIBKRUN], 1, [Define if libkrun is available]), [AC_MSG_ERROR([*** Missing libkrun headers])])) AM_CONDITIONAL([ENABLE_KRUN], [test "x$with_libkrun" = xyes]) AM_CONDITIONAL([ENABLE_WASM], [test "x$with_wasmer" = xyes && test "x$with_wasmedge" = xyes && test "x$with_wasmtime" = xyes]) dnl include support for spin (EXPERIMENTAL) AC_ARG_WITH([spin], AS_HELP_STRING([--with-spin], [build with spin support])) AS_IF([test "x$with_spin" = "xyes"], AC_DEFINE([HAVE_SPIN], 1, [Define if spin is available])) dnl libseccomp AC_ARG_ENABLE([seccomp], AS_HELP_STRING([--disable-seccomp], [Ignore libseccomp and disable support])) AS_IF([test "x$enable_seccomp" != "xno"], [ AC_CHECK_HEADERS([seccomp.h], [], [AC_MSG_ERROR([*** Missing libseccomp headers])]) AS_IF([test "$ac_cv_header_seccomp_h" = "yes"], [ AC_SEARCH_LIBS(seccomp_rule_add, [seccomp], [AC_DEFINE([HAVE_SECCOMP], 1, [Define if seccomp is available])], [AC_MSG_ERROR([*** libseccomp headers not found])]) AC_SEARCH_LIBS(seccomp_arch_resolve_name, [seccomp], [AC_DEFINE([SECCOMP_ARCH_RESOLVE_NAME], 1, [Define if seccomp_arch_resolve_name is available])], [ ]) ]) ]) dnl libsystemd AC_ARG_ENABLE([systemd], AS_HELP_STRING([--disable-systemd], [Ignore systemd and disable support])) AS_IF([test "x$enable_systemd" != "xno"], [ AC_CHECK_HEADERS([systemd/sd-bus.h], [], [AC_MSG_ERROR([*** Missing libsystemd headers])]) AS_IF([test "$ac_cv_header_systemd_sd_bus_h" = "yes"], [ AC_SEARCH_LIBS(sd_bus_match_signal_async, [systemd], [AC_DEFINE([HAVE_SYSTEMD], 1, [Define if libsystemd is available])], [AC_MSG_ERROR([*** Failed to find libsystemd])]) AC_CHECK_FUNCS(sd_notify_barrier) ]) ]) dnl ebpf AC_ARG_ENABLE([bpf], AS_HELP_STRING([--disable-bpf], [Ignore eBPF and disable support])) AS_IF([test "x$enable_bpf" != "xno"], [ AC_CHECK_HEADERS([linux/bpf.h]) AS_IF([test "$ac_cv_header_linux_bpf_h" = "yes"], [ AC_MSG_CHECKING(compilation for eBPF) AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[ #include #include #include void foo() { uint64_t val = 0x123456789; __attribute__ ((unused)) union bpf_attr attr; attr.insns = val; } int program = BPF_PROG_TYPE_CGROUP_DEVICE; ]])], [AC_MSG_RESULT(yes) AC_DEFINE([HAVE_EBPF], 1, [Define if eBPF is available])], [AC_MSG_RESULT(no)]) ]) ]) use_fPIC=no libcrun_public='__attribute__((visibility("default"))) extern' if test "x$enable_shared" = "xyes"; then AC_DEFINE([SHARED_LIBCRUN], 1, [Define if shared libraries are enabled]) AC_SUBST([SHARED_LIBCRUN]) use_fPIC=yes if test "x$dynload_libcrun" = "xyes"; then libcrun_public='__attribute__((visibility("default"))) __attribute__((weak)) extern' AC_DEFINE([DYNLOAD_LIBCRUN], 1, [Define if shared libraries are enabled]) AC_SUBST([DYNLOAD_LIBCRUN]) else libcrun_public='__attribute__((visibility("default"))) extern' fi fi AC_DEFINE_UNQUOTED([LIBCRUN_PUBLIC], [$libcrun_public], [LIBCRUN_PUBLIC]) AC_ARG_WITH([python-bindings], AS_HELP_STRING([--with-python-bindings], [build the Python bindings])) AS_IF([test "x$with_python_bindings" = "xyes"], [ PKG_CHECK_MODULES([PYTHON], [python3], [], [AC_MSG_ERROR([*** python headers not found])]) use_fPIC=yes ]) AC_ARG_WITH([lua-bindings], AS_HELP_STRING([--with-lua-bindings], [build the Lua bindings])) AC_ARG_ENABLE( [lua-path-guessing], AS_HELP_STRING([--enable-lua-path-guessing], [guessing lua module path based on variables (default: yes), disable to use libdir as luaexecdir]), [ case "${enableval}" in yes) enable_lua_path_guessing=true ;; no) enable_lua_path_guessing=false ;; *) AC_MSG_ERROR(bad value ${enablevaal} for --enable-lua-path-guessing) ;; esac ], [enable_lua_path_guessing=true] ) AS_IF([test "x$with_lua_bindings" = "xyes"], [ AX_PROG_LUA([5.4], [5.5], [], [AC_MSG_ERROR([*** lua interpreter not found])]) AX_LUA_HEADERS([], [AC_MSG_ERROR([*** lua headers not found])]) AX_LUA_LIBS([], [AC_MSG_ERROR([*** lua libs not found])]) AS_IF([test "x$enable_lua_path_guessing" = "xfalse"], [ AC_SUBST([luaexecdir], [$libdir]) ]) use_fPIC=yes ]) AS_IF([test "x$use_fPIC" = "xyes"], [ # configure should not touch CFLAGS/LDFLAGS but we need it to propagate it # to libocispec. export CFLAGS="$CFLAGS -fPIC" export LDFLAGS="$LDFLAGS -fPIC" ]) dnl criu AC_ARG_ENABLE([criu], AS_HELP_STRING([--disable-criu], [Disable CRIU based checkpoint/restore support])) AS_IF([test "x$enable_criu" != "xno"], [ PKG_CHECK_MODULES([CRIU], [criu >= 3.15], [have_criu="yes"], [have_criu="no" AC_MSG_NOTICE([CRIU headers not found, building without CRIU support])]) PKG_CHECK_MODULES([CRIU_JOIN_NS], [criu > 3.16], [have_criu_join_ns="yes"], [have_criu_join_ns="no" AC_MSG_NOTICE([CRIU version doesn't support join-ns API])]) PKG_CHECK_MODULES([CRIU_PRE_DUMP], [criu > 3.16.1], [have_criu_pre_dump="yes"], [have_criu_pre_dump="no" AC_MSG_NOTICE([CRIU version doesn't support for pre-dumping])]) AS_IF([test "$have_criu" = "yes"], [ AC_DEFINE([HAVE_CRIU], 1, [Define if CRIU is available]) ]) AS_IF([test "$have_criu_join_ns" = "yes"], [ AC_DEFINE([CRIU_JOIN_NS_SUPPORT], 1, [Define if CRIU join NS support is available]) ]) AS_IF([test "$have_criu_pre_dump" = "yes"], [ AC_DEFINE([CRIU_PRE_DUMP_SUPPORT], 1, [Define if CRIU pre-dump support is available]) ]) ], [AC_MSG_NOTICE([CRIU support disabled per user request])]) FOUND_LIBS=$LIBS LIBS="" AC_MSG_CHECKING([for new mount API (fsconfig)]) AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[ #include int cmd = FSCONFIG_CMD_CREATE; ]])], [AC_MSG_RESULT(yes) AC_DEFINE([HAVE_FSCONFIG_CMD_CREATE_SYS_MOUNT_H], 1, [Define if FSCONFIG_CMD_CREATE is available in sys/mount.h])], [AC_MSG_RESULT(no)]) AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[ /* also make sure it doesn't conflict with since it is always used. */ #include #include int cmd = FSCONFIG_CMD_CREATE; ]])], [AC_MSG_RESULT(yes) AC_DEFINE([HAVE_FSCONFIG_CMD_CREATE_LINUX_MOUNT_H], 1, [Define if FSCONFIG_CMD_CREATE is available in linux/mount.h])], [AC_MSG_RESULT(no)]) AC_MSG_CHECKING([for seccomp notify API]) AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[ #include int cmd = SECCOMP_GET_NOTIF_SIZES; ]])], [AC_MSG_RESULT(yes) AC_DEFINE([HAVE_SECCOMP_GET_NOTIF_SIZES], 1, [Define if SECCOMP_GET_NOTIF_SIZES is available])], [AC_MSG_RESULT(no)]) AC_SUBST([FOUND_LIBS]) AC_SUBST([CRUN_LDFLAGS]) AC_SUBST([CRUN_LIBDIR], [$libdir/crun]) [RPM_VERSION=$(echo $VERSION | sed -e's,^\([^-]*\).*$,\1,g')] [GIT_COMMIT_ID=$(git rev-parse --short HEAD)] AC_SUBST([RPM_VERSION]) AC_SUBST([GIT_COMMIT_ID]) AC_CHECK_TOOL(GPERF, gperf) if test -z "$GPERF"; then AC_MSG_NOTICE(gperf not found - cannot rebuild signal parser code) fi AC_SEARCH_LIBS([argp_parse], [argp], [], [AC_MSG_ERROR([*** argp functions not found - install libargp or argp_standalone])]) AM_CONDITIONAL([PYTHON_BINDINGS], [test "x$with_python_bindings" = "xyes"]) AM_CONDITIONAL([LUA_BINDINGS], [test "x$with_lua_bindings" = "xyes"]) AM_CONDITIONAL([CRIU_SUPPORT], [test "x$have_criu" = "xyes"]) AM_CONDITIONAL([SHARED_LIBCRUN], [test "x$enable_shared" = "xyes"]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_SUBDIRS([libocispec]) AC_OUTPUT crun-1.16.1/aclocal.m40000644000000000000000000020232114656670154012613 0ustar0000000000000000# generated automatically by aclocal 1.16.2 -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 11 (pkg-config-0.29.1) dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a dnl configuration script generated by Autoconf, you may include it under dnl the same distribution terms that you use for the rest of that dnl program. dnl PKG_PREREQ(MIN-VERSION) dnl ----------------------- dnl Since: 0.29 dnl dnl Verify that the version of the pkg-config macros are at least dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's dnl installed version of pkg-config, this checks the developer's version dnl of pkg.m4 when generating configure. dnl dnl To ensure that this macro is defined, also add: dnl m4_ifndef([PKG_PREREQ], dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], [m4_define([PKG_MACROS_VERSION], [0.29.1]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) dnl ---------------------------------- dnl Since: 0.16 dnl dnl Search for the pkg-config tool and set the PKG_CONFIG variable to dnl first found in the path. Checks that the version of pkg-config found dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is dnl used since that's the first version where most current features of dnl pkg-config existed. 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 ])dnl PKG_PROG_PKG_CONFIG dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------------------------------- dnl Since: 0.18 dnl dnl Check to see whether a particular set of modules exists. Similar to dnl PKG_CHECK_MODULES(), but does not set variables or print errors. dnl dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) dnl only at the first occurence in configure.ac, so if the first place dnl it's called might be skipped (such as if it is within an "if", you dnl 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]) dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) dnl --------------------------------------------- dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting dnl pkg_failed based on the result. 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 ])dnl _PKG_CONFIG dnl _PKG_SHORT_ERRORS_SUPPORTED dnl --------------------------- dnl Internal check to see if pkg-config supports short errors. 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 ])dnl _PKG_SHORT_ERRORS_SUPPORTED dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl -------------------------------------------------------------- dnl Since: 0.4.0 dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES might not happen, you should be sure to include an dnl 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 ])dnl PKG_CHECK_MODULES dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl --------------------------------------------------------------------- dnl Since: 0.29 dnl dnl Checks for existence of MODULES and gathers its build flags with dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags dnl and VARIABLE-PREFIX_LIBS from --libs. dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to dnl include an explicit call to PKG_PROG_PKG_CONFIG in your dnl configure.ac. AC_DEFUN([PKG_CHECK_MODULES_STATIC], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl _save_PKG_CONFIG=$PKG_CONFIG PKG_CONFIG="$PKG_CONFIG --static" PKG_CHECK_MODULES($@) PKG_CONFIG=$_save_PKG_CONFIG[]dnl ])dnl PKG_CHECK_MODULES_STATIC dnl PKG_INSTALLDIR([DIRECTORY]) dnl ------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable pkgconfigdir as the location where a module dnl should install pkg-config .pc files. By default the directory is dnl $libdir/pkgconfig, but the default can be changed by passing dnl DIRECTORY. The user can override through the --with-pkgconfigdir dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_INSTALLDIR dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) dnl -------------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable noarch_pkgconfigdir as the location where a dnl module should install arch-independent pkg-config .pc files. By dnl default the directory is $datadir/pkgconfig, but the default can be dnl changed by passing DIRECTORY. The user can override through the dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_NOARCH_INSTALLDIR dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------- dnl Since: 0.28 dnl dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], dnl [DESCRIPTION], [DEFAULT]) dnl ------------------------------------------ dnl dnl Prepare a "--with-" configure option using the lowercase dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and dnl PKG_CHECK_MODULES in a single macro. AC_DEFUN([PKG_WITH_MODULES], [ m4_pushdef([with_arg], m4_tolower([$1])) m4_pushdef([description], [m4_default([$5], [build with ]with_arg[ support])]) m4_pushdef([def_arg], [m4_default([$6], [auto])]) m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) m4_case(def_arg, [yes],[m4_pushdef([with_without], [--without-]with_arg)], [m4_pushdef([with_without],[--with-]with_arg)]) AC_ARG_WITH(with_arg, AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, [AS_TR_SH([with_]with_arg)=def_arg]) AS_CASE([$AS_TR_SH([with_]with_arg)], [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], [auto],[PKG_CHECK_MODULES([$1],[$2], [m4_n([def_action_if_found]) $3], [m4_n([def_action_if_not_found]) $4])]) m4_popdef([with_arg]) m4_popdef([description]) m4_popdef([def_arg]) ])dnl PKG_WITH_MODULES dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [DESCRIPTION], [DEFAULT]) dnl ----------------------------------------------- dnl dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES dnl check._[VARIABLE-PREFIX] is exported as make variable. AC_DEFUN([PKG_HAVE_WITH_MODULES], [ PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) AM_CONDITIONAL([HAVE_][$1], [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) ])dnl PKG_HAVE_WITH_MODULES dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [DESCRIPTION], [DEFAULT]) dnl ------------------------------------------------------ dnl dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make dnl and preprocessor variable. AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], [ PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) ])dnl PKG_HAVE_DEFINE_WITH_MODULES # Copyright (C) 2002-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' 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.16.2], [], [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.16.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_COND_IF -*- Autoconf -*- # Copyright (C) 2008-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_COND_IF # _AM_COND_ELSE # _AM_COND_ENDIF # -------------- # These macros are only used for tracing. m4_define([_AM_COND_IF]) m4_define([_AM_COND_ELSE]) m4_define([_AM_COND_ENDIF]) # AM_COND_IF(COND, [IF-TRUE], [IF-FALSE]) # --------------------------------------- # If the shell condition COND is true, execute IF-TRUE, otherwise execute # IF-FALSE. Allow automake to learn about conditional instantiating macros # (the AC_CONFIG_FOOS). AC_DEFUN([AM_COND_IF], [m4_ifndef([_AM_COND_VALUE_$1], [m4_fatal([$0: no such condition "$1"])])dnl _AM_COND_IF([$1])dnl if test -z "$$1_TRUE"; then : m4_n([$2])[]dnl m4_ifval([$3], [_AM_COND_ELSE([$1])dnl else $3 ])dnl _AM_COND_ENDIF([$1])dnl fi[]dnl ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _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. # This creates each '.Po' and '.Plo' makefile fragment that we'll 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" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # --------------------------------------------------------------------------- # Adds support for distributing Python modules and packages. To # install modules, copy them to $(pythondir), using the python_PYTHON # automake variable. To install a package with the same name as the # automake package, install to $(pkgpythondir), or use the # pkgpython_PYTHON automake variable. # # The variables $(pyexecdir) and $(pkgpyexecdir) are provided as # locations to install python extension modules (shared libraries). # Another macro is required to find the appropriate flags to compile # extension modules. # # If your package is configured with a different prefix to python, # users will have to add the install directory to the PYTHONPATH # environment variable, or create a .pth file (see the python # documentation for details). # # If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will # cause an error if the version of python installed on the system # doesn't meet the requirement. MINIMUM-VERSION should consist of # numbers and dots only. AC_DEFUN([AM_PATH_PYTHON], [ dnl Find a Python interpreter. Python versions prior to 2.0 are not dnl supported. (2.0 was released on October 16, 2000). m4_define_default([_AM_PYTHON_INTERPRETER_LIST], [python python2 python3 dnl python3.15 python3.14 python3.13 python3.12 python3.11 python3.10 dnl python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl python3.2 python3.1 python3.0 dnl python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl python2.0]) AC_ARG_VAR([PYTHON], [the Python interpreter]) m4_if([$1],[],[ dnl No version check is needed. # Find any Python interpreter. if test -z "$PYTHON"; then AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) fi am_display_PYTHON=python ], [ dnl A version check is needed. if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. AC_MSG_CHECKING([whether $PYTHON version is >= $1]) AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) AC_MSG_ERROR([Python interpreter is too old])]) am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. AC_CACHE_CHECK([for a Python interpreter with version >= $1], [am_cv_pathless_PYTHON],[ for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do test "$am_cv_pathless_PYTHON" = none && break AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) done]) # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) fi am_display_PYTHON=$am_cv_pathless_PYTHON fi ]) if test "$PYTHON" = :; then dnl Run any user-specified action, or abort. m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) else dnl Query Python for its version number. Although site.py simply uses dnl sys.version[:3], printing that failed with Python 3.10, since the dnl trailing zero was eliminated. So now we output just the major dnl and minor version numbers, as numbers. Apparently the tertiary dnl version is not of interest. AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], [am_cv_python_version=`$PYTHON -c "import sys; print('%u.%u' % sys.version_info[[:2]])"`]) AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) dnl Use the values of $prefix and $exec_prefix for the corresponding dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made dnl distinct variables so they can be overridden if need be. However, dnl general consensus is that you shouldn't need this ability. AC_SUBST([PYTHON_PREFIX], ['${prefix}']) AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) dnl At times (like when building shared libraries) you may want dnl to know which OS platform Python thinks this is. AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) # Just factor out some code duplication. am_python_setup_sysconfig="\ import sys # Prefer sysconfig over distutils.sysconfig, for better compatibility # with python 3.x. See automake bug#10227. try: import sysconfig except ImportError: can_use_sysconfig = 0 else: can_use_sysconfig = 1 # Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: # try: from platform import python_implementation if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': can_use_sysconfig = 0 except ImportError: pass" dnl Set up 4 directories: dnl pythondir -- where to install python scripts. This is the dnl site-packages directory, not the python standard library dnl directory like in previous automake betas. This behavior dnl is more consistent with lispdir.m4 for example. dnl Query distutils for this directory. AC_CACHE_CHECK([for $am_display_PYTHON script directory], [am_cv_python_pythondir], [if test "x$prefix" = xNONE then am_py_prefix=$ac_default_prefix else am_py_prefix=$prefix fi am_cv_python_pythondir=`$PYTHON -c " $am_python_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') sys.stdout.write(sitedir)"` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` ;; *) case $am_py_prefix in /usr|/System*) ;; *) am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac ]) AC_SUBST([pythondir], [$am_cv_python_pythondir]) dnl pkgpythondir -- $PACKAGE directory under pythondir. Was dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is dnl more consistent with the rest of automake. AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) dnl pyexecdir -- directory for installing python extension modules dnl (shared libraries) dnl Query distutils for this directory. AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], [am_cv_python_pyexecdir], [if test "x$exec_prefix" = xNONE then am_py_exec_prefix=$am_py_prefix else am_py_exec_prefix=$exec_prefix fi am_cv_python_pyexecdir=`$PYTHON -c " $am_python_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') sys.stdout.write(sitedir)"` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` ;; *) case $am_py_exec_prefix in /usr|/System*) ;; *) am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac ]) AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) dnl Run any user-specified action. $2 fi ]) # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) # --------------------------------------------------------------------------- # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. # Run ACTION-IF-FALSE otherwise. # This test uses sys.hexversion instead of the string equivalent (first # word of sys.version), in order to cope with versions such as 2.2c1. # This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). AC_DEFUN([AM_PYTHON_CHECK_VERSION], [prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] sys.exit(sys.hexversion < minverhex)" AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/ax_lua.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) crun-1.16.1/Makefile.in0000644000000000000000000105660714656670156013041 0ustar0000000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_CRUN_TRUE@bin_PROGRAMS = crun$(EXEEXT) @ENABLE_CRUN_FALSE@noinst_PROGRAMS = crun$(EXEEXT) tests/init$(EXEEXT) \ @ENABLE_CRUN_FALSE@ $(am__EXEEXT_1) \ @ENABLE_CRUN_FALSE@ tests/tests_libcrun_fuzzer$(EXEEXT) @ENABLE_CRUN_TRUE@noinst_PROGRAMS = tests/init$(EXEEXT) \ @ENABLE_CRUN_TRUE@ $(am__EXEEXT_1) \ @ENABLE_CRUN_TRUE@ tests/tests_libcrun_fuzzer$(EXEEXT) TESTS = $(PYTHON_TESTS) $(am__EXEEXT_1) @ENABLE_CRUN_TRUE@am__append_1 = crun.1 @ENABLE_KRUN_TRUE@am__append_2 = krun.1 subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lua.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \ "$(DESTDIR)$(luaexecdir)" "$(DESTDIR)$(pyexecdir)" \ "$(DESTDIR)$(man1dir)" am__EXEEXT_1 = tests/tests_libcrun_utils$(EXEEXT) \ tests/tests_libcrun_errors$(EXEEXT) \ tests/tests_libcrun_intelrdt$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) 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; }; \ } LTLIBRARIES = $(lib_LTLIBRARIES) $(luaexec_LTLIBRARIES) \ $(noinst_LTLIBRARIES) $(pyexec_LTLIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libcrun_testing_a_AR = $(AR) $(ARFLAGS) @HAVE_EMBEDDED_YAJL_TRUE@am__DEPENDENCIES_1 = \ @HAVE_EMBEDDED_YAJL_TRUE@ libocispec/yajl/libyajl.la libcrun_testing_a_DEPENDENCIES = libocispec/libocispec.la \ $(am__DEPENDENCIES_1) am__dirstamp = $(am__leading_dot)dirstamp am__objects_1 = src/libcrun/libcrun_testing_a-utils.$(OBJEXT) \ src/libcrun/blake3/libcrun_testing_a-blake3.$(OBJEXT) \ src/libcrun/blake3/libcrun_testing_a-blake3_portable.$(OBJEXT) \ src/libcrun/libcrun_testing_a-cgroup-cgroupfs.$(OBJEXT) \ src/libcrun/libcrun_testing_a-cgroup-resources.$(OBJEXT) \ src/libcrun/libcrun_testing_a-cgroup-setup.$(OBJEXT) \ src/libcrun/libcrun_testing_a-cgroup-systemd.$(OBJEXT) \ src/libcrun/libcrun_testing_a-cgroup-utils.$(OBJEXT) \ src/libcrun/libcrun_testing_a-cgroup.$(OBJEXT) \ src/libcrun/libcrun_testing_a-chroot_realpath.$(OBJEXT) \ src/libcrun/libcrun_testing_a-cloned_binary.$(OBJEXT) \ src/libcrun/libcrun_testing_a-container.$(OBJEXT) \ src/libcrun/libcrun_testing_a-criu.$(OBJEXT) \ src/libcrun/libcrun_testing_a-custom-handler.$(OBJEXT) \ src/libcrun/libcrun_testing_a-ebpf.$(OBJEXT) \ src/libcrun/libcrun_testing_a-error.$(OBJEXT) \ src/libcrun/handlers/libcrun_testing_a-handler-utils.$(OBJEXT) \ src/libcrun/handlers/libcrun_testing_a-krun.$(OBJEXT) \ src/libcrun/handlers/libcrun_testing_a-mono.$(OBJEXT) \ src/libcrun/handlers/libcrun_testing_a-spin.$(OBJEXT) \ src/libcrun/handlers/libcrun_testing_a-wasmedge.$(OBJEXT) \ src/libcrun/handlers/libcrun_testing_a-wasmer.$(OBJEXT) \ src/libcrun/handlers/libcrun_testing_a-wasmtime.$(OBJEXT) \ src/libcrun/libcrun_testing_a-intelrdt.$(OBJEXT) \ src/libcrun/libcrun_testing_a-io_priority.$(OBJEXT) \ src/libcrun/libcrun_testing_a-linux.$(OBJEXT) \ src/libcrun/libcrun_testing_a-mount_flags.$(OBJEXT) \ src/libcrun/libcrun_testing_a-scheduler.$(OBJEXT) \ src/libcrun/libcrun_testing_a-seccomp.$(OBJEXT) \ src/libcrun/libcrun_testing_a-seccomp_notify.$(OBJEXT) \ src/libcrun/libcrun_testing_a-signals.$(OBJEXT) \ src/libcrun/libcrun_testing_a-status.$(OBJEXT) \ src/libcrun/libcrun_testing_a-terminal.$(OBJEXT) am_libcrun_testing_a_OBJECTS = $(am__objects_1) libcrun_testing_a_OBJECTS = $(am_libcrun_testing_a_OBJECTS) am__DEPENDENCIES_2 = libcrun_la_DEPENDENCIES = libocispec/libocispec.la \ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) am__objects_2 = src/libcrun/libcrun_la-utils.lo \ src/libcrun/blake3/libcrun_la-blake3.lo \ src/libcrun/blake3/libcrun_la-blake3_portable.lo \ src/libcrun/libcrun_la-cgroup-cgroupfs.lo \ src/libcrun/libcrun_la-cgroup-resources.lo \ src/libcrun/libcrun_la-cgroup-setup.lo \ src/libcrun/libcrun_la-cgroup-systemd.lo \ src/libcrun/libcrun_la-cgroup-utils.lo \ src/libcrun/libcrun_la-cgroup.lo \ src/libcrun/libcrun_la-chroot_realpath.lo \ src/libcrun/libcrun_la-cloned_binary.lo \ src/libcrun/libcrun_la-container.lo \ src/libcrun/libcrun_la-criu.lo \ src/libcrun/libcrun_la-custom-handler.lo \ src/libcrun/libcrun_la-ebpf.lo src/libcrun/libcrun_la-error.lo \ src/libcrun/handlers/libcrun_la-handler-utils.lo \ src/libcrun/handlers/libcrun_la-krun.lo \ src/libcrun/handlers/libcrun_la-mono.lo \ src/libcrun/handlers/libcrun_la-spin.lo \ src/libcrun/handlers/libcrun_la-wasmedge.lo \ src/libcrun/handlers/libcrun_la-wasmer.lo \ src/libcrun/handlers/libcrun_la-wasmtime.lo \ src/libcrun/libcrun_la-intelrdt.lo \ src/libcrun/libcrun_la-io_priority.lo \ src/libcrun/libcrun_la-linux.lo \ src/libcrun/libcrun_la-mount_flags.lo \ src/libcrun/libcrun_la-scheduler.lo \ src/libcrun/libcrun_la-seccomp.lo \ src/libcrun/libcrun_la-seccomp_notify.lo \ src/libcrun/libcrun_la-signals.lo \ src/libcrun/libcrun_la-status.lo \ src/libcrun/libcrun_la-terminal.lo am_libcrun_la_OBJECTS = $(am__objects_2) libcrun_la_OBJECTS = $(am_libcrun_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libcrun_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libcrun_la_CFLAGS) \ $(CFLAGS) $(libcrun_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_LIBCRUN_FALSE@am_libcrun_la_rpath = @ENABLE_LIBCRUN_TRUE@am_libcrun_la_rpath = -rpath $(libdir) @LUA_BINDINGS_TRUE@luacrun_la_DEPENDENCIES = libcrun.la \ @LUA_BINDINGS_TRUE@ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2) am__luacrun_la_SOURCES_DIST = lua/lua_crun.c @LUA_BINDINGS_TRUE@am_luacrun_la_OBJECTS = lua/luacrun_la-lua_crun.lo luacrun_la_OBJECTS = $(am_luacrun_la_OBJECTS) luacrun_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(luacrun_la_CFLAGS) \ $(CFLAGS) $(luacrun_la_LDFLAGS) $(LDFLAGS) -o $@ @LUA_BINDINGS_TRUE@am_luacrun_la_rpath = -rpath $(luaexecdir) @PYTHON_BINDINGS_TRUE@python_crun_la_DEPENDENCIES = libcrun.la \ @PYTHON_BINDINGS_TRUE@ $(am__DEPENDENCIES_2) \ @PYTHON_BINDINGS_TRUE@ $(am__DEPENDENCIES_2) \ @PYTHON_BINDINGS_TRUE@ $(am__DEPENDENCIES_1) am__python_crun_la_SOURCES_DIST = python/crun_python.c @PYTHON_BINDINGS_TRUE@am_python_crun_la_OBJECTS = \ @PYTHON_BINDINGS_TRUE@ python/crun_la-crun_python.lo python_crun_la_OBJECTS = $(am_python_crun_la_OBJECTS) python_crun_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(python_crun_la_CFLAGS) $(CFLAGS) $(python_crun_la_LDFLAGS) \ $(LDFLAGS) -o $@ @PYTHON_BINDINGS_TRUE@am_python_crun_la_rpath = -rpath $(pyexecdir) am_crun_OBJECTS = src/crun-crun.$(OBJEXT) src/crun-run.$(OBJEXT) \ src/crun-delete.$(OBJEXT) src/crun-kill.$(OBJEXT) \ src/crun-pause.$(OBJEXT) src/crun-unpause.$(OBJEXT) \ src/crun-oci_features.$(OBJEXT) src/crun-spec.$(OBJEXT) \ src/crun-exec.$(OBJEXT) src/crun-list.$(OBJEXT) \ src/crun-create.$(OBJEXT) src/crun-start.$(OBJEXT) \ src/crun-state.$(OBJEXT) src/crun-update.$(OBJEXT) \ src/crun-ps.$(OBJEXT) src/crun-checkpoint.$(OBJEXT) \ src/crun-restore.$(OBJEXT) \ src/libcrun/crun-cloned_binary.$(OBJEXT) crun_OBJECTS = $(am_crun_OBJECTS) @DYNLOAD_LIBCRUN_FALSE@crun_DEPENDENCIES = libcrun.la \ @DYNLOAD_LIBCRUN_FALSE@ $(am__DEPENDENCIES_2) \ @DYNLOAD_LIBCRUN_FALSE@ $(am__DEPENDENCIES_1) crun_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(crun_CFLAGS) $(CFLAGS) \ $(crun_LDFLAGS) $(LDFLAGS) -o $@ am_tests_init_OBJECTS = tests/init.$(OBJEXT) tests_init_OBJECTS = $(am_tests_init_OBJECTS) tests_init_DEPENDENCIES = tests_init_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(tests_init_LDFLAGS) $(LDFLAGS) -o $@ am_tests_tests_libcrun_errors_OBJECTS = \ tests/tests_libcrun_errors-tests_libcrun_errors.$(OBJEXT) tests_tests_libcrun_errors_OBJECTS = \ $(am_tests_tests_libcrun_errors_OBJECTS) am__DEPENDENCIES_3 = libcrun_testing.a $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) tests_tests_libcrun_errors_DEPENDENCIES = $(am__DEPENDENCIES_3) tests_tests_libcrun_errors_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_tests_libcrun_errors_CFLAGS) $(CFLAGS) \ $(tests_tests_libcrun_errors_LDFLAGS) $(LDFLAGS) -o $@ am_tests_tests_libcrun_fuzzer_OBJECTS = \ tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.$(OBJEXT) tests_tests_libcrun_fuzzer_OBJECTS = \ $(am_tests_tests_libcrun_fuzzer_OBJECTS) tests_tests_libcrun_fuzzer_DEPENDENCIES = $(am__DEPENDENCIES_3) \ libocispec/libocispec.la $(am__DEPENDENCIES_1) tests_tests_libcrun_fuzzer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_tests_libcrun_fuzzer_CFLAGS) $(CFLAGS) \ $(tests_tests_libcrun_fuzzer_LDFLAGS) $(LDFLAGS) -o $@ am_tests_tests_libcrun_intelrdt_OBJECTS = \ tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.$(OBJEXT) tests_tests_libcrun_intelrdt_OBJECTS = \ $(am_tests_tests_libcrun_intelrdt_OBJECTS) tests_tests_libcrun_intelrdt_DEPENDENCIES = $(am__DEPENDENCIES_3) tests_tests_libcrun_intelrdt_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_tests_libcrun_intelrdt_CFLAGS) $(CFLAGS) \ $(tests_tests_libcrun_intelrdt_LDFLAGS) $(LDFLAGS) -o $@ am_tests_tests_libcrun_utils_OBJECTS = \ tests/tests_libcrun_utils-tests_libcrun_utils.$(OBJEXT) tests_tests_libcrun_utils_OBJECTS = \ $(am_tests_tests_libcrun_utils_OBJECTS) tests_tests_libcrun_utils_DEPENDENCIES = $(am__DEPENDENCIES_3) tests_tests_libcrun_utils_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(tests_tests_libcrun_utils_CFLAGS) $(CFLAGS) \ $(tests_tests_libcrun_utils_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = lua/$(DEPDIR)/luacrun_la-lua_crun.Plo \ python/$(DEPDIR)/crun_la-crun_python.Plo \ src/$(DEPDIR)/crun-checkpoint.Po src/$(DEPDIR)/crun-create.Po \ src/$(DEPDIR)/crun-crun.Po src/$(DEPDIR)/crun-delete.Po \ src/$(DEPDIR)/crun-exec.Po src/$(DEPDIR)/crun-kill.Po \ src/$(DEPDIR)/crun-list.Po src/$(DEPDIR)/crun-oci_features.Po \ src/$(DEPDIR)/crun-pause.Po src/$(DEPDIR)/crun-ps.Po \ src/$(DEPDIR)/crun-restore.Po src/$(DEPDIR)/crun-run.Po \ src/$(DEPDIR)/crun-spec.Po src/$(DEPDIR)/crun-start.Po \ src/$(DEPDIR)/crun-state.Po src/$(DEPDIR)/crun-unpause.Po \ src/$(DEPDIR)/crun-update.Po \ src/libcrun/$(DEPDIR)/crun-cloned_binary.Po \ src/libcrun/$(DEPDIR)/libcrun_la-cgroup-cgroupfs.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-cgroup-resources.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-cgroup-setup.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-cgroup-systemd.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-cgroup-utils.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-cgroup.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-chroot_realpath.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-cloned_binary.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-container.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-criu.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-custom-handler.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-ebpf.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-error.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-intelrdt.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-io_priority.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-linux.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-mount_flags.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-scheduler.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-seccomp.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-seccomp_notify.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-signals.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-status.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-terminal.Plo \ src/libcrun/$(DEPDIR)/libcrun_la-utils.Plo \ src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-cgroupfs.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-resources.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-setup.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-systemd.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-utils.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-chroot_realpath.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-cloned_binary.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-container.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-criu.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-custom-handler.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-ebpf.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-error.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-intelrdt.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-io_priority.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-linux.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-mount_flags.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-scheduler.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp_notify.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-signals.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-status.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-terminal.Po \ src/libcrun/$(DEPDIR)/libcrun_testing_a-utils.Po \ src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3.Plo \ src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3_portable.Plo \ src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3.Po \ src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3_portable.Po \ src/libcrun/handlers/$(DEPDIR)/libcrun_la-handler-utils.Plo \ src/libcrun/handlers/$(DEPDIR)/libcrun_la-krun.Plo \ src/libcrun/handlers/$(DEPDIR)/libcrun_la-mono.Plo \ src/libcrun/handlers/$(DEPDIR)/libcrun_la-spin.Plo \ src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmedge.Plo \ src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmer.Plo \ src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmtime.Plo \ src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-handler-utils.Po \ src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-krun.Po \ src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-mono.Po \ src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-spin.Po \ src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmedge.Po \ src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmer.Po \ src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmtime.Po \ tests/$(DEPDIR)/init.Po \ tests/$(DEPDIR)/tests_libcrun_errors-tests_libcrun_errors.Po \ tests/$(DEPDIR)/tests_libcrun_fuzzer-tests_libcrun_fuzzer.Po \ tests/$(DEPDIR)/tests_libcrun_intelrdt-tests_libcrun_intelrdt.Po \ tests/$(DEPDIR)/tests_libcrun_utils-tests_libcrun_utils.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcrun_testing_a_SOURCES) $(libcrun_la_SOURCES) \ $(luacrun_la_SOURCES) $(python_crun_la_SOURCES) \ $(crun_SOURCES) $(tests_init_SOURCES) \ $(tests_tests_libcrun_errors_SOURCES) \ $(tests_tests_libcrun_fuzzer_SOURCES) \ $(tests_tests_libcrun_intelrdt_SOURCES) \ $(tests_tests_libcrun_utils_SOURCES) DIST_SOURCES = $(libcrun_testing_a_SOURCES) $(libcrun_la_SOURCES) \ $(am__luacrun_la_SOURCES_DIST) \ $(am__python_crun_la_SOURCES_DIST) $(crun_SOURCES) \ $(tests_init_SOURCES) $(tests_tests_libcrun_errors_SOURCES) \ $(tests_tests_libcrun_fuzzer_SOURCES) \ $(tests_tests_libcrun_intelrdt_SOURCES) \ $(tests_tests_libcrun_utils_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man1_MANS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope check recheck distdir distdir-am dist dist-all \ distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # 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 # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # 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. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(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='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) TEST_SUITE_LOG = test-suite.log LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.py.log=.log) PY_LOG_COMPILE = $(PY_LOG_COMPILER) $(AM_PY_LOG_FLAGS) $(PY_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/build-aux/compile \ $(top_srcdir)/build-aux/config.guess \ $(top_srcdir)/build-aux/config.sub \ $(top_srcdir)/build-aux/depcomp \ $(top_srcdir)/build-aux/install-sh \ $(top_srcdir)/build-aux/ltmain.sh \ $(top_srcdir)/build-aux/missing \ $(top_srcdir)/build-aux/tap-driver.sh COPYING NEWS \ build-aux/compile build-aux/config.guess build-aux/config.sub \ build-aux/depcomp build-aux/install-sh build-aux/ltmain.sh \ build-aux/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" GZIP_ENV = --best DIST_ARCHIVES = $(distdir).tar.xz DIST_TARGETS = dist-xz distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CRIU_CFLAGS = @CRIU_CFLAGS@ CRIU_JOIN_NS_CFLAGS = @CRIU_JOIN_NS_CFLAGS@ CRIU_JOIN_NS_LIBS = @CRIU_JOIN_NS_LIBS@ CRIU_LIBS = @CRIU_LIBS@ CRIU_PRE_DUMP_CFLAGS = @CRIU_PRE_DUMP_CFLAGS@ CRIU_PRE_DUMP_LIBS = @CRIU_PRE_DUMP_LIBS@ CRUN_LDFLAGS = @CRUN_LDFLAGS@ CRUN_LIBDIR = @CRUN_LIBDIR@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNLOAD_LIBCRUN = @DYNLOAD_LIBCRUN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FOUND_LIBS = @FOUND_LIBS@ GIT_COMMIT_ID = @GIT_COMMIT_ID@ GPERF = @GPERF@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ LUA = @LUA@ LUA_EXEC_PREFIX = @LUA_EXEC_PREFIX@ LUA_INCLUDE = @LUA_INCLUDE@ LUA_LIB = @LUA_LIB@ LUA_PLATFORM = @LUA_PLATFORM@ LUA_PREFIX = @LUA_PREFIX@ LUA_SHORT_VERSION = @LUA_SHORT_VERSION@ LUA_VERSION = @LUA_VERSION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MD2MAN = @MD2MAN@ MKDIR_P = @MKDIR_P@ MONO_CFLAGS = @MONO_CFLAGS@ MONO_LIBS = @MONO_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RPM_VERSION = @RPM_VERSION@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHARED_LIBCRUN = @SHARED_LIBCRUN@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YAJL_CFLAGS = @YAJL_CFLAGS@ YAJL_LIBS = @YAJL_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ luadir = @luadir@ luaexecdir = @luaexecdir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgluadir = @pkgluadir@ pkgluaexecdir = @pkgluaexecdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DIST_SUBDIRS = libocispec SUBDIRS = libocispec ACLOCAL_AMFLAGS = -I m4 WD := $(shell pwd) @ENABLE_LIBCRUN_TRUE@lib_LTLIBRARIES = libcrun.la @ENABLE_LIBCRUN_FALSE@noinst_LTLIBRARIES = libcrun.la check_LIBRARIES = libcrun_testing.a libcrun_SOURCES = src/libcrun/utils.c \ src/libcrun/blake3/blake3.c \ src/libcrun/blake3/blake3_portable.c \ src/libcrun/cgroup-cgroupfs.c \ src/libcrun/cgroup-resources.c \ src/libcrun/cgroup-setup.c \ src/libcrun/cgroup-systemd.c \ src/libcrun/cgroup-utils.c \ src/libcrun/cgroup.c \ src/libcrun/chroot_realpath.c \ src/libcrun/cloned_binary.c \ src/libcrun/container.c \ src/libcrun/criu.c \ src/libcrun/custom-handler.c \ src/libcrun/ebpf.c \ src/libcrun/error.c \ src/libcrun/handlers/handler-utils.c \ src/libcrun/handlers/krun.c \ src/libcrun/handlers/mono.c \ src/libcrun/handlers/spin.c \ src/libcrun/handlers/wasmedge.c \ src/libcrun/handlers/wasmer.c \ src/libcrun/handlers/wasmtime.c \ src/libcrun/intelrdt.c \ src/libcrun/io_priority.c \ src/libcrun/linux.c \ src/libcrun/mount_flags.c \ src/libcrun/scheduler.c \ src/libcrun/seccomp.c \ src/libcrun/seccomp_notify.c \ src/libcrun/signals.c \ src/libcrun/status.c \ src/libcrun/terminal.c @HAVE_EMBEDDED_YAJL_FALSE@maybe_libyajl.la = @HAVE_EMBEDDED_YAJL_TRUE@maybe_libyajl.la = libocispec/yajl/libyajl.la libcrun_la_SOURCES = $(libcrun_SOURCES) libcrun_la_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -fvisibility=hidden libcrun_la_LIBADD = libocispec/libocispec.la $(FOUND_LIBS) $(maybe_libyajl.la) libcrun_la_LDFLAGS = -Wl,--version-script=$(abs_top_srcdir)/libcrun.lds # build a version with all the symbols visible for testing libcrun_testing_a_SOURCES = $(libcrun_SOURCES) libcrun_testing_a_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -fvisibility=default libcrun_testing_a_LIBADD = libocispec/libocispec.la $(maybe_libyajl.la) @PYTHON_BINDINGS_TRUE@pyexec_LTLIBRARIES = python_crun.la @PYTHON_BINDINGS_TRUE@python_crun_la_SOURCES = python/crun_python.c @PYTHON_BINDINGS_TRUE@python_crun_la_CFLAGS = -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/libocispec/src -I $(abs_top_builddir)/src $(PYTHON_CFLAGS) @PYTHON_BINDINGS_TRUE@python_crun_la_LDFLAGS = -avoid-version -module $(PYTHON_LDFLAGS) @PYTHON_BINDINGS_TRUE@python_crun_la_LIBADD = libcrun.la $(PYTHON_LIBS) $(FOUND_LIBS) $(maybe_libyajl.la) @LUA_BINDINGS_TRUE@luaexec_LTLIBRARIES = luacrun.la @LUA_BINDINGS_TRUE@luacrun_la_SOURCES = lua/lua_crun.c @LUA_BINDINGS_TRUE@luacrun_la_CFLAGS = -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/libocispec/src -I $(abs_top_builddir)/src $(LUA_INCLUDE) @LUA_BINDINGS_TRUE@luacrun_la_LDFLAGS = -avoid-version -module @LUA_BINDINGS_TRUE@luacrun_la_LIBADD = libcrun.la $(LUA_LIB) $(FOUND_LIBS) @LUA_BINDINGS_TRUE@LUACRUN_CLEAN_VERSION = $(shell git describe --tags | sed 's/-g[0-9a-f]\{7,9\}//') @LUA_BINDINGS_TRUE@LUACRUN_RELEASE_VERSION = $(shell git describe --tags | sed 's/-[0-9]*-g[0-9a-f]\{7,9\}//') @LUA_BINDINGS_TRUE@LUACRUN_ROCKSPEC = luacrun-$(LUACRUN_CLEAN_VERSION).rockspec @LUA_BINDINGS_TRUE@LUACRUN_ROCK = luacrun-$(LUACRUN_CLEAN_VERSION).src.rock crun_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -D CRUN_LIBDIR="\"$(CRUN_LIBDIR)\"" crun_SOURCES = src/crun.c src/run.c src/delete.c src/kill.c src/pause.c src/unpause.c src/oci_features.c src/spec.c \ src/exec.c src/list.c src/create.c src/start.c src/state.c src/update.c src/ps.c \ src/checkpoint.c src/restore.c src/libcrun/cloned_binary.c @DYNLOAD_LIBCRUN_FALSE@crun_LDFLAGS = $(CRUN_LDFLAGS) @DYNLOAD_LIBCRUN_TRUE@crun_LDFLAGS = -Wl,--unresolved-symbols=ignore-all $(CRUN_LDFLAGS) @DYNLOAD_LIBCRUN_FALSE@crun_LDADD = libcrun.la $(FOUND_LIBS) $(maybe_libyajl.la) EXTRA_DIST = COPYING COPYING.libcrun README.md NEWS SECURITY.md \ rpm/crun.spec autogen.sh src/libcrun/blake3/blake3_impl.h \ src/libcrun/blake3/blake3.h src/crun.h src/list.h src/run.h \ src/delete.h src/kill.h src/pause.h src/unpause.h src/create.h \ src/start.h src/state.h src/exec.h src/oci_features.h \ src/spec.h src/update.h src/ps.h src/checkpoint.h \ src/restore.h src/libcrun/seccomp_notify.h \ src/libcrun/seccomp_notify_plugin.h src/libcrun/container.h \ src/libcrun/seccomp.h src/libcrun/ebpf.h src/libcrun/cgroup.h \ src/libcrun/cgroup-cgroupfs.h src/libcrun/cgroup-internal.h \ src/libcrun/cgroup-resources.h src/libcrun/cgroup-setup.h \ src/libcrun/cgroup-systemd.h src/libcrun/cgroup-utils.h \ src/libcrun/custom-handler.h src/libcrun/io_priority.h \ src/libcrun/handlers/handler-utils.h src/libcrun/linux.h \ src/libcrun/utils.h src/libcrun/error.h src/libcrun/criu.h \ src/libcrun/scheduler.h src/libcrun/status.h \ src/libcrun/terminal.h src/libcrun/mount_flags.h \ src/libcrun/intelrdt.h crun.1.md crun.1 libcrun.lds krun.1.md \ krun.1 lua/luacrun.rockspec $(PYTHON_TESTS) \ tests/Makefile.tests tests/run_all_tests.sh \ tests/tests_utils.py build-aux/git-version-gen \ src/libcrun/signals.perf src/libcrun/mount_flags.perf UNIT_TESTS = tests/tests_libcrun_utils tests/tests_libcrun_errors tests/tests_libcrun_intelrdt TESTS_LDADD = libcrun_testing.a $(FOUND_LIBS) $(maybe_libyajl.la) tests_init_LDADD = tests_init_LDFLAGS = -static-libgcc -all-static tests_init_SOURCES = tests/init.c tests_tests_libcrun_utils_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src tests_tests_libcrun_utils_SOURCES = tests/tests_libcrun_utils.c tests_tests_libcrun_utils_LDADD = $(TESTS_LDADD) tests_tests_libcrun_utils_LDFLAGS = $(crun_LDFLAGS) tests_tests_libcrun_intelrdt_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src tests_tests_libcrun_intelrdt_SOURCES = tests/tests_libcrun_intelrdt.c tests_tests_libcrun_intelrdt_LDADD = $(TESTS_LDADD) tests_tests_libcrun_intelrdt_LDFLAGS = $(crun_LDFLAGS) tests_tests_libcrun_fuzzer_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src tests_tests_libcrun_fuzzer_SOURCES = tests/tests_libcrun_fuzzer.c tests_tests_libcrun_fuzzer_LDADD = $(TESTS_LDADD) libocispec/libocispec.la $(maybe_libyajl.la) tests_tests_libcrun_fuzzer_LDFLAGS = $(crun_LDFLAGS) tests_tests_libcrun_errors_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src tests_tests_libcrun_errors_SOURCES = tests/tests_libcrun_errors.c tests_tests_libcrun_errors_LDADD = $(TESTS_LDADD) tests_tests_libcrun_errors_LDFLAGS = $(crun_LDFLAGS) TEST_EXTENSIONS = .py PY_LOG_COMPILER = $(PYTHON) PY_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/build-aux/tap-driver.sh LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/build-aux/tap-driver.sh PYTHON_TESTS = tests/test_capabilities.py \ tests/test_cwd.py \ tests/test_checkpoint_restore.py \ tests/test_devices.py \ tests/test_hostname.py \ tests/test_limits.py \ tests/test_oci_features.py \ tests/test_mounts.py \ tests/test_paths.py \ tests/test_pid.py \ tests/test_pid_file.py \ tests/test_preserve_fds.py \ tests/test_uid_gid.py \ tests/test_rlimits.py \ tests/test_tty.py \ tests/test_hooks.py \ tests/test_update.py \ tests/test_detach.py \ tests/test_delete.py \ tests/test_resources.py \ tests/test_start.py \ tests/test_exec.py \ tests/test_seccomp.py \ tests/test_time.py BUILT_SOURCES = .version git-version.h CLEANFILES = crun.spec .version git-version.h $(LUACRUN_ROCKSPEC) man1_MANS = $(am__append_1) $(am__append_2) all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .py .py$(EXEEXT) .trs am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-checkLIBRARIES: -test -z "$(check_LIBRARIES)" || rm -f $(check_LIBRARIES) install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } install-luaexecLTLIBRARIES: $(luaexec_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(luaexec_LTLIBRARIES)'; test -n "$(luaexecdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(luaexecdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(luaexecdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(luaexecdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(luaexecdir)"; \ } uninstall-luaexecLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(luaexec_LTLIBRARIES)'; test -n "$(luaexecdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(luaexecdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(luaexecdir)/$$f"; \ done clean-luaexecLTLIBRARIES: -test -z "$(luaexec_LTLIBRARIES)" || rm -f $(luaexec_LTLIBRARIES) @list='$(luaexec_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } install-pyexecLTLIBRARIES: $(pyexec_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(pyexecdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pyexecdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pyexecdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pyexecdir)"; \ } uninstall-pyexecLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pyexecdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pyexecdir)/$$f"; \ done clean-pyexecLTLIBRARIES: -test -z "$(pyexec_LTLIBRARIES)" || rm -f $(pyexec_LTLIBRARIES) @list='$(pyexec_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } src/libcrun/$(am__dirstamp): @$(MKDIR_P) src/libcrun @: > src/libcrun/$(am__dirstamp) src/libcrun/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/libcrun/$(DEPDIR) @: > src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-utils.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/blake3/$(am__dirstamp): @$(MKDIR_P) src/libcrun/blake3 @: > src/libcrun/blake3/$(am__dirstamp) src/libcrun/blake3/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/libcrun/blake3/$(DEPDIR) @: > src/libcrun/blake3/$(DEPDIR)/$(am__dirstamp) src/libcrun/blake3/libcrun_testing_a-blake3.$(OBJEXT): \ src/libcrun/blake3/$(am__dirstamp) \ src/libcrun/blake3/$(DEPDIR)/$(am__dirstamp) src/libcrun/blake3/libcrun_testing_a-blake3_portable.$(OBJEXT): \ src/libcrun/blake3/$(am__dirstamp) \ src/libcrun/blake3/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-cgroup-cgroupfs.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-cgroup-resources.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-cgroup-setup.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-cgroup-systemd.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-cgroup-utils.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-cgroup.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-chroot_realpath.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-cloned_binary.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-container.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-criu.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-custom-handler.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-ebpf.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-error.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/$(am__dirstamp): @$(MKDIR_P) src/libcrun/handlers @: > src/libcrun/handlers/$(am__dirstamp) src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/libcrun/handlers/$(DEPDIR) @: > src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_testing_a-handler-utils.$(OBJEXT): \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_testing_a-krun.$(OBJEXT): \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_testing_a-mono.$(OBJEXT): \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_testing_a-spin.$(OBJEXT): \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_testing_a-wasmedge.$(OBJEXT): \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_testing_a-wasmer.$(OBJEXT): \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_testing_a-wasmtime.$(OBJEXT): \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-intelrdt.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-io_priority.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-linux.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-mount_flags.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-scheduler.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-seccomp.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-seccomp_notify.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-signals.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-status.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_testing_a-terminal.$(OBJEXT): \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) libcrun_testing.a: $(libcrun_testing_a_OBJECTS) $(libcrun_testing_a_DEPENDENCIES) $(EXTRA_libcrun_testing_a_DEPENDENCIES) $(AM_V_at)-rm -f libcrun_testing.a $(AM_V_AR)$(libcrun_testing_a_AR) libcrun_testing.a $(libcrun_testing_a_OBJECTS) $(libcrun_testing_a_LIBADD) $(AM_V_at)$(RANLIB) libcrun_testing.a src/libcrun/libcrun_la-utils.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/blake3/libcrun_la-blake3.lo: \ src/libcrun/blake3/$(am__dirstamp) \ src/libcrun/blake3/$(DEPDIR)/$(am__dirstamp) src/libcrun/blake3/libcrun_la-blake3_portable.lo: \ src/libcrun/blake3/$(am__dirstamp) \ src/libcrun/blake3/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-cgroup-cgroupfs.lo: \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-cgroup-resources.lo: \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-cgroup-setup.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-cgroup-systemd.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-cgroup-utils.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-cgroup.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-chroot_realpath.lo: \ src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-cloned_binary.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-container.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-criu.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-custom-handler.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-ebpf.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-error.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_la-handler-utils.lo: \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_la-krun.lo: \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_la-mono.lo: \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_la-spin.lo: \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_la-wasmedge.lo: \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_la-wasmer.lo: \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/handlers/libcrun_la-wasmtime.lo: \ src/libcrun/handlers/$(am__dirstamp) \ src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-intelrdt.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-io_priority.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-linux.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-mount_flags.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-scheduler.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-seccomp.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-seccomp_notify.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-signals.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-status.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) src/libcrun/libcrun_la-terminal.lo: src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) libcrun.la: $(libcrun_la_OBJECTS) $(libcrun_la_DEPENDENCIES) $(EXTRA_libcrun_la_DEPENDENCIES) $(AM_V_CCLD)$(libcrun_la_LINK) $(am_libcrun_la_rpath) $(libcrun_la_OBJECTS) $(libcrun_la_LIBADD) $(LIBS) lua/$(am__dirstamp): @$(MKDIR_P) lua @: > lua/$(am__dirstamp) lua/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) lua/$(DEPDIR) @: > lua/$(DEPDIR)/$(am__dirstamp) lua/luacrun_la-lua_crun.lo: lua/$(am__dirstamp) \ lua/$(DEPDIR)/$(am__dirstamp) luacrun.la: $(luacrun_la_OBJECTS) $(luacrun_la_DEPENDENCIES) $(EXTRA_luacrun_la_DEPENDENCIES) $(AM_V_CCLD)$(luacrun_la_LINK) $(am_luacrun_la_rpath) $(luacrun_la_OBJECTS) $(luacrun_la_LIBADD) $(LIBS) python/$(am__dirstamp): @$(MKDIR_P) python @: > python/$(am__dirstamp) python/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) python/$(DEPDIR) @: > python/$(DEPDIR)/$(am__dirstamp) python/crun_la-crun_python.lo: python/$(am__dirstamp) \ python/$(DEPDIR)/$(am__dirstamp) python_crun.la: $(python_crun_la_OBJECTS) $(python_crun_la_DEPENDENCIES) $(EXTRA_python_crun_la_DEPENDENCIES) $(AM_V_CCLD)$(python_crun_la_LINK) $(am_python_crun_la_rpath) $(python_crun_la_OBJECTS) $(python_crun_la_LIBADD) $(LIBS) src/$(am__dirstamp): @$(MKDIR_P) src @: > src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/$(DEPDIR) @: > src/$(DEPDIR)/$(am__dirstamp) src/crun-crun.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-run.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-delete.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-kill.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-pause.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-unpause.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-oci_features.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-spec.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-exec.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-list.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-create.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-start.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-state.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-update.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-ps.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-checkpoint.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/crun-restore.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/libcrun/crun-cloned_binary.$(OBJEXT): src/libcrun/$(am__dirstamp) \ src/libcrun/$(DEPDIR)/$(am__dirstamp) crun$(EXEEXT): $(crun_OBJECTS) $(crun_DEPENDENCIES) $(EXTRA_crun_DEPENDENCIES) @rm -f crun$(EXEEXT) $(AM_V_CCLD)$(crun_LINK) $(crun_OBJECTS) $(crun_LDADD) $(LIBS) tests/$(am__dirstamp): @$(MKDIR_P) tests @: > tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) tests/$(DEPDIR) @: > tests/$(DEPDIR)/$(am__dirstamp) tests/init.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/init$(EXEEXT): $(tests_init_OBJECTS) $(tests_init_DEPENDENCIES) $(EXTRA_tests_init_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/init$(EXEEXT) $(AM_V_CCLD)$(tests_init_LINK) $(tests_init_OBJECTS) $(tests_init_LDADD) $(LIBS) tests/tests_libcrun_errors-tests_libcrun_errors.$(OBJEXT): \ tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp) tests/tests_libcrun_errors$(EXEEXT): $(tests_tests_libcrun_errors_OBJECTS) $(tests_tests_libcrun_errors_DEPENDENCIES) $(EXTRA_tests_tests_libcrun_errors_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/tests_libcrun_errors$(EXEEXT) $(AM_V_CCLD)$(tests_tests_libcrun_errors_LINK) $(tests_tests_libcrun_errors_OBJECTS) $(tests_tests_libcrun_errors_LDADD) $(LIBS) tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.$(OBJEXT): \ tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp) tests/tests_libcrun_fuzzer$(EXEEXT): $(tests_tests_libcrun_fuzzer_OBJECTS) $(tests_tests_libcrun_fuzzer_DEPENDENCIES) $(EXTRA_tests_tests_libcrun_fuzzer_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/tests_libcrun_fuzzer$(EXEEXT) $(AM_V_CCLD)$(tests_tests_libcrun_fuzzer_LINK) $(tests_tests_libcrun_fuzzer_OBJECTS) $(tests_tests_libcrun_fuzzer_LDADD) $(LIBS) tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.$(OBJEXT): \ tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp) tests/tests_libcrun_intelrdt$(EXEEXT): $(tests_tests_libcrun_intelrdt_OBJECTS) $(tests_tests_libcrun_intelrdt_DEPENDENCIES) $(EXTRA_tests_tests_libcrun_intelrdt_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/tests_libcrun_intelrdt$(EXEEXT) $(AM_V_CCLD)$(tests_tests_libcrun_intelrdt_LINK) $(tests_tests_libcrun_intelrdt_OBJECTS) $(tests_tests_libcrun_intelrdt_LDADD) $(LIBS) tests/tests_libcrun_utils-tests_libcrun_utils.$(OBJEXT): \ tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp) tests/tests_libcrun_utils$(EXEEXT): $(tests_tests_libcrun_utils_OBJECTS) $(tests_tests_libcrun_utils_DEPENDENCIES) $(EXTRA_tests_tests_libcrun_utils_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/tests_libcrun_utils$(EXEEXT) $(AM_V_CCLD)$(tests_tests_libcrun_utils_LINK) $(tests_tests_libcrun_utils_OBJECTS) $(tests_tests_libcrun_utils_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f lua/*.$(OBJEXT) -rm -f lua/*.lo -rm -f python/*.$(OBJEXT) -rm -f python/*.lo -rm -f src/*.$(OBJEXT) -rm -f src/libcrun/*.$(OBJEXT) -rm -f src/libcrun/*.lo -rm -f src/libcrun/blake3/*.$(OBJEXT) -rm -f src/libcrun/blake3/*.lo -rm -f src/libcrun/handlers/*.$(OBJEXT) -rm -f src/libcrun/handlers/*.lo -rm -f tests/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@lua/$(DEPDIR)/luacrun_la-lua_crun.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@python/$(DEPDIR)/crun_la-crun_python.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-checkpoint.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-create.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-crun.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-delete.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-exec.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-kill.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-list.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-oci_features.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-pause.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-ps.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-restore.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-run.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-spec.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-start.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-state.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-unpause.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/crun-update.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/crun-cloned_binary.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-cgroup-cgroupfs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-cgroup-resources.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-cgroup-setup.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-cgroup-systemd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-cgroup-utils.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-cgroup.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-chroot_realpath.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-cloned_binary.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-container.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-criu.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-custom-handler.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-ebpf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-error.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-intelrdt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-io_priority.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-linux.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-mount_flags.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-scheduler.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-seccomp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-seccomp_notify.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-signals.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-status.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-terminal.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_la-utils.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-cgroupfs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-resources.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-setup.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-systemd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-utils.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-chroot_realpath.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-cloned_binary.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-container.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-criu.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-custom-handler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-ebpf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-error.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-intelrdt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-io_priority.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-linux.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-mount_flags.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-scheduler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp_notify.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-signals.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-status.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-terminal.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/$(DEPDIR)/libcrun_testing_a-utils.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3_portable.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3_portable.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_la-handler-utils.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_la-krun.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_la-mono.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_la-spin.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmedge.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmer.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmtime.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-handler-utils.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-krun.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-mono.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-spin.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmedge.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmtime.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/init.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_libcrun_errors-tests_libcrun_errors.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_libcrun_fuzzer-tests_libcrun_fuzzer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_libcrun_intelrdt-tests_libcrun_intelrdt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_libcrun_utils-tests_libcrun_utils.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< src/libcrun/libcrun_testing_a-utils.o: src/libcrun/utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-utils.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-utils.Tpo -c -o src/libcrun/libcrun_testing_a-utils.o `test -f 'src/libcrun/utils.c' || echo '$(srcdir)/'`src/libcrun/utils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-utils.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/utils.c' object='src/libcrun/libcrun_testing_a-utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-utils.o `test -f 'src/libcrun/utils.c' || echo '$(srcdir)/'`src/libcrun/utils.c src/libcrun/libcrun_testing_a-utils.obj: src/libcrun/utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-utils.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-utils.Tpo -c -o src/libcrun/libcrun_testing_a-utils.obj `if test -f 'src/libcrun/utils.c'; then $(CYGPATH_W) 'src/libcrun/utils.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/utils.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-utils.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/utils.c' object='src/libcrun/libcrun_testing_a-utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-utils.obj `if test -f 'src/libcrun/utils.c'; then $(CYGPATH_W) 'src/libcrun/utils.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/utils.c'; fi` src/libcrun/blake3/libcrun_testing_a-blake3.o: src/libcrun/blake3/blake3.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/blake3/libcrun_testing_a-blake3.o -MD -MP -MF src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3.Tpo -c -o src/libcrun/blake3/libcrun_testing_a-blake3.o `test -f 'src/libcrun/blake3/blake3.c' || echo '$(srcdir)/'`src/libcrun/blake3/blake3.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3.Tpo src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/blake3/blake3.c' object='src/libcrun/blake3/libcrun_testing_a-blake3.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/blake3/libcrun_testing_a-blake3.o `test -f 'src/libcrun/blake3/blake3.c' || echo '$(srcdir)/'`src/libcrun/blake3/blake3.c src/libcrun/blake3/libcrun_testing_a-blake3.obj: src/libcrun/blake3/blake3.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/blake3/libcrun_testing_a-blake3.obj -MD -MP -MF src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3.Tpo -c -o src/libcrun/blake3/libcrun_testing_a-blake3.obj `if test -f 'src/libcrun/blake3/blake3.c'; then $(CYGPATH_W) 'src/libcrun/blake3/blake3.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/blake3/blake3.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3.Tpo src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/blake3/blake3.c' object='src/libcrun/blake3/libcrun_testing_a-blake3.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/blake3/libcrun_testing_a-blake3.obj `if test -f 'src/libcrun/blake3/blake3.c'; then $(CYGPATH_W) 'src/libcrun/blake3/blake3.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/blake3/blake3.c'; fi` src/libcrun/blake3/libcrun_testing_a-blake3_portable.o: src/libcrun/blake3/blake3_portable.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/blake3/libcrun_testing_a-blake3_portable.o -MD -MP -MF src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3_portable.Tpo -c -o src/libcrun/blake3/libcrun_testing_a-blake3_portable.o `test -f 'src/libcrun/blake3/blake3_portable.c' || echo '$(srcdir)/'`src/libcrun/blake3/blake3_portable.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3_portable.Tpo src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3_portable.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/blake3/blake3_portable.c' object='src/libcrun/blake3/libcrun_testing_a-blake3_portable.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/blake3/libcrun_testing_a-blake3_portable.o `test -f 'src/libcrun/blake3/blake3_portable.c' || echo '$(srcdir)/'`src/libcrun/blake3/blake3_portable.c src/libcrun/blake3/libcrun_testing_a-blake3_portable.obj: src/libcrun/blake3/blake3_portable.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/blake3/libcrun_testing_a-blake3_portable.obj -MD -MP -MF src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3_portable.Tpo -c -o src/libcrun/blake3/libcrun_testing_a-blake3_portable.obj `if test -f 'src/libcrun/blake3/blake3_portable.c'; then $(CYGPATH_W) 'src/libcrun/blake3/blake3_portable.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/blake3/blake3_portable.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3_portable.Tpo src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3_portable.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/blake3/blake3_portable.c' object='src/libcrun/blake3/libcrun_testing_a-blake3_portable.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/blake3/libcrun_testing_a-blake3_portable.obj `if test -f 'src/libcrun/blake3/blake3_portable.c'; then $(CYGPATH_W) 'src/libcrun/blake3/blake3_portable.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/blake3/blake3_portable.c'; fi` src/libcrun/libcrun_testing_a-cgroup-cgroupfs.o: src/libcrun/cgroup-cgroupfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup-cgroupfs.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-cgroupfs.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup-cgroupfs.o `test -f 'src/libcrun/cgroup-cgroupfs.c' || echo '$(srcdir)/'`src/libcrun/cgroup-cgroupfs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-cgroupfs.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-cgroupfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-cgroupfs.c' object='src/libcrun/libcrun_testing_a-cgroup-cgroupfs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup-cgroupfs.o `test -f 'src/libcrun/cgroup-cgroupfs.c' || echo '$(srcdir)/'`src/libcrun/cgroup-cgroupfs.c src/libcrun/libcrun_testing_a-cgroup-cgroupfs.obj: src/libcrun/cgroup-cgroupfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup-cgroupfs.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-cgroupfs.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup-cgroupfs.obj `if test -f 'src/libcrun/cgroup-cgroupfs.c'; then $(CYGPATH_W) 'src/libcrun/cgroup-cgroupfs.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup-cgroupfs.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-cgroupfs.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-cgroupfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-cgroupfs.c' object='src/libcrun/libcrun_testing_a-cgroup-cgroupfs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup-cgroupfs.obj `if test -f 'src/libcrun/cgroup-cgroupfs.c'; then $(CYGPATH_W) 'src/libcrun/cgroup-cgroupfs.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup-cgroupfs.c'; fi` src/libcrun/libcrun_testing_a-cgroup-resources.o: src/libcrun/cgroup-resources.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup-resources.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-resources.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup-resources.o `test -f 'src/libcrun/cgroup-resources.c' || echo '$(srcdir)/'`src/libcrun/cgroup-resources.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-resources.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-resources.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-resources.c' object='src/libcrun/libcrun_testing_a-cgroup-resources.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup-resources.o `test -f 'src/libcrun/cgroup-resources.c' || echo '$(srcdir)/'`src/libcrun/cgroup-resources.c src/libcrun/libcrun_testing_a-cgroup-resources.obj: src/libcrun/cgroup-resources.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup-resources.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-resources.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup-resources.obj `if test -f 'src/libcrun/cgroup-resources.c'; then $(CYGPATH_W) 'src/libcrun/cgroup-resources.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup-resources.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-resources.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-resources.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-resources.c' object='src/libcrun/libcrun_testing_a-cgroup-resources.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup-resources.obj `if test -f 'src/libcrun/cgroup-resources.c'; then $(CYGPATH_W) 'src/libcrun/cgroup-resources.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup-resources.c'; fi` src/libcrun/libcrun_testing_a-cgroup-setup.o: src/libcrun/cgroup-setup.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup-setup.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-setup.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup-setup.o `test -f 'src/libcrun/cgroup-setup.c' || echo '$(srcdir)/'`src/libcrun/cgroup-setup.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-setup.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-setup.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-setup.c' object='src/libcrun/libcrun_testing_a-cgroup-setup.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup-setup.o `test -f 'src/libcrun/cgroup-setup.c' || echo '$(srcdir)/'`src/libcrun/cgroup-setup.c src/libcrun/libcrun_testing_a-cgroup-setup.obj: src/libcrun/cgroup-setup.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup-setup.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-setup.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup-setup.obj `if test -f 'src/libcrun/cgroup-setup.c'; then $(CYGPATH_W) 'src/libcrun/cgroup-setup.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup-setup.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-setup.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-setup.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-setup.c' object='src/libcrun/libcrun_testing_a-cgroup-setup.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup-setup.obj `if test -f 'src/libcrun/cgroup-setup.c'; then $(CYGPATH_W) 'src/libcrun/cgroup-setup.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup-setup.c'; fi` src/libcrun/libcrun_testing_a-cgroup-systemd.o: src/libcrun/cgroup-systemd.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup-systemd.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-systemd.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup-systemd.o `test -f 'src/libcrun/cgroup-systemd.c' || echo '$(srcdir)/'`src/libcrun/cgroup-systemd.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-systemd.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-systemd.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-systemd.c' object='src/libcrun/libcrun_testing_a-cgroup-systemd.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup-systemd.o `test -f 'src/libcrun/cgroup-systemd.c' || echo '$(srcdir)/'`src/libcrun/cgroup-systemd.c src/libcrun/libcrun_testing_a-cgroup-systemd.obj: src/libcrun/cgroup-systemd.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup-systemd.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-systemd.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup-systemd.obj `if test -f 'src/libcrun/cgroup-systemd.c'; then $(CYGPATH_W) 'src/libcrun/cgroup-systemd.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup-systemd.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-systemd.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-systemd.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-systemd.c' object='src/libcrun/libcrun_testing_a-cgroup-systemd.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup-systemd.obj `if test -f 'src/libcrun/cgroup-systemd.c'; then $(CYGPATH_W) 'src/libcrun/cgroup-systemd.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup-systemd.c'; fi` src/libcrun/libcrun_testing_a-cgroup-utils.o: src/libcrun/cgroup-utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup-utils.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-utils.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup-utils.o `test -f 'src/libcrun/cgroup-utils.c' || echo '$(srcdir)/'`src/libcrun/cgroup-utils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-utils.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-utils.c' object='src/libcrun/libcrun_testing_a-cgroup-utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup-utils.o `test -f 'src/libcrun/cgroup-utils.c' || echo '$(srcdir)/'`src/libcrun/cgroup-utils.c src/libcrun/libcrun_testing_a-cgroup-utils.obj: src/libcrun/cgroup-utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup-utils.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-utils.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup-utils.obj `if test -f 'src/libcrun/cgroup-utils.c'; then $(CYGPATH_W) 'src/libcrun/cgroup-utils.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup-utils.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-utils.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-utils.c' object='src/libcrun/libcrun_testing_a-cgroup-utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup-utils.obj `if test -f 'src/libcrun/cgroup-utils.c'; then $(CYGPATH_W) 'src/libcrun/cgroup-utils.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup-utils.c'; fi` src/libcrun/libcrun_testing_a-cgroup.o: src/libcrun/cgroup.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup.o `test -f 'src/libcrun/cgroup.c' || echo '$(srcdir)/'`src/libcrun/cgroup.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup.c' object='src/libcrun/libcrun_testing_a-cgroup.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup.o `test -f 'src/libcrun/cgroup.c' || echo '$(srcdir)/'`src/libcrun/cgroup.c src/libcrun/libcrun_testing_a-cgroup.obj: src/libcrun/cgroup.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cgroup.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup.Tpo -c -o src/libcrun/libcrun_testing_a-cgroup.obj `if test -f 'src/libcrun/cgroup.c'; then $(CYGPATH_W) 'src/libcrun/cgroup.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup.c' object='src/libcrun/libcrun_testing_a-cgroup.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cgroup.obj `if test -f 'src/libcrun/cgroup.c'; then $(CYGPATH_W) 'src/libcrun/cgroup.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cgroup.c'; fi` src/libcrun/libcrun_testing_a-chroot_realpath.o: src/libcrun/chroot_realpath.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-chroot_realpath.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-chroot_realpath.Tpo -c -o src/libcrun/libcrun_testing_a-chroot_realpath.o `test -f 'src/libcrun/chroot_realpath.c' || echo '$(srcdir)/'`src/libcrun/chroot_realpath.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-chroot_realpath.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-chroot_realpath.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/chroot_realpath.c' object='src/libcrun/libcrun_testing_a-chroot_realpath.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-chroot_realpath.o `test -f 'src/libcrun/chroot_realpath.c' || echo '$(srcdir)/'`src/libcrun/chroot_realpath.c src/libcrun/libcrun_testing_a-chroot_realpath.obj: src/libcrun/chroot_realpath.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-chroot_realpath.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-chroot_realpath.Tpo -c -o src/libcrun/libcrun_testing_a-chroot_realpath.obj `if test -f 'src/libcrun/chroot_realpath.c'; then $(CYGPATH_W) 'src/libcrun/chroot_realpath.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/chroot_realpath.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-chroot_realpath.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-chroot_realpath.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/chroot_realpath.c' object='src/libcrun/libcrun_testing_a-chroot_realpath.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-chroot_realpath.obj `if test -f 'src/libcrun/chroot_realpath.c'; then $(CYGPATH_W) 'src/libcrun/chroot_realpath.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/chroot_realpath.c'; fi` src/libcrun/libcrun_testing_a-cloned_binary.o: src/libcrun/cloned_binary.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cloned_binary.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cloned_binary.Tpo -c -o src/libcrun/libcrun_testing_a-cloned_binary.o `test -f 'src/libcrun/cloned_binary.c' || echo '$(srcdir)/'`src/libcrun/cloned_binary.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cloned_binary.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cloned_binary.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cloned_binary.c' object='src/libcrun/libcrun_testing_a-cloned_binary.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cloned_binary.o `test -f 'src/libcrun/cloned_binary.c' || echo '$(srcdir)/'`src/libcrun/cloned_binary.c src/libcrun/libcrun_testing_a-cloned_binary.obj: src/libcrun/cloned_binary.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-cloned_binary.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-cloned_binary.Tpo -c -o src/libcrun/libcrun_testing_a-cloned_binary.obj `if test -f 'src/libcrun/cloned_binary.c'; then $(CYGPATH_W) 'src/libcrun/cloned_binary.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cloned_binary.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-cloned_binary.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-cloned_binary.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cloned_binary.c' object='src/libcrun/libcrun_testing_a-cloned_binary.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-cloned_binary.obj `if test -f 'src/libcrun/cloned_binary.c'; then $(CYGPATH_W) 'src/libcrun/cloned_binary.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cloned_binary.c'; fi` src/libcrun/libcrun_testing_a-container.o: src/libcrun/container.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-container.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-container.Tpo -c -o src/libcrun/libcrun_testing_a-container.o `test -f 'src/libcrun/container.c' || echo '$(srcdir)/'`src/libcrun/container.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-container.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-container.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/container.c' object='src/libcrun/libcrun_testing_a-container.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-container.o `test -f 'src/libcrun/container.c' || echo '$(srcdir)/'`src/libcrun/container.c src/libcrun/libcrun_testing_a-container.obj: src/libcrun/container.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-container.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-container.Tpo -c -o src/libcrun/libcrun_testing_a-container.obj `if test -f 'src/libcrun/container.c'; then $(CYGPATH_W) 'src/libcrun/container.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/container.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-container.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-container.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/container.c' object='src/libcrun/libcrun_testing_a-container.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-container.obj `if test -f 'src/libcrun/container.c'; then $(CYGPATH_W) 'src/libcrun/container.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/container.c'; fi` src/libcrun/libcrun_testing_a-criu.o: src/libcrun/criu.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-criu.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-criu.Tpo -c -o src/libcrun/libcrun_testing_a-criu.o `test -f 'src/libcrun/criu.c' || echo '$(srcdir)/'`src/libcrun/criu.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-criu.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-criu.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/criu.c' object='src/libcrun/libcrun_testing_a-criu.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-criu.o `test -f 'src/libcrun/criu.c' || echo '$(srcdir)/'`src/libcrun/criu.c src/libcrun/libcrun_testing_a-criu.obj: src/libcrun/criu.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-criu.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-criu.Tpo -c -o src/libcrun/libcrun_testing_a-criu.obj `if test -f 'src/libcrun/criu.c'; then $(CYGPATH_W) 'src/libcrun/criu.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/criu.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-criu.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-criu.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/criu.c' object='src/libcrun/libcrun_testing_a-criu.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-criu.obj `if test -f 'src/libcrun/criu.c'; then $(CYGPATH_W) 'src/libcrun/criu.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/criu.c'; fi` src/libcrun/libcrun_testing_a-custom-handler.o: src/libcrun/custom-handler.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-custom-handler.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-custom-handler.Tpo -c -o src/libcrun/libcrun_testing_a-custom-handler.o `test -f 'src/libcrun/custom-handler.c' || echo '$(srcdir)/'`src/libcrun/custom-handler.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-custom-handler.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-custom-handler.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/custom-handler.c' object='src/libcrun/libcrun_testing_a-custom-handler.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-custom-handler.o `test -f 'src/libcrun/custom-handler.c' || echo '$(srcdir)/'`src/libcrun/custom-handler.c src/libcrun/libcrun_testing_a-custom-handler.obj: src/libcrun/custom-handler.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-custom-handler.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-custom-handler.Tpo -c -o src/libcrun/libcrun_testing_a-custom-handler.obj `if test -f 'src/libcrun/custom-handler.c'; then $(CYGPATH_W) 'src/libcrun/custom-handler.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/custom-handler.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-custom-handler.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-custom-handler.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/custom-handler.c' object='src/libcrun/libcrun_testing_a-custom-handler.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-custom-handler.obj `if test -f 'src/libcrun/custom-handler.c'; then $(CYGPATH_W) 'src/libcrun/custom-handler.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/custom-handler.c'; fi` src/libcrun/libcrun_testing_a-ebpf.o: src/libcrun/ebpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-ebpf.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-ebpf.Tpo -c -o src/libcrun/libcrun_testing_a-ebpf.o `test -f 'src/libcrun/ebpf.c' || echo '$(srcdir)/'`src/libcrun/ebpf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-ebpf.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-ebpf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/ebpf.c' object='src/libcrun/libcrun_testing_a-ebpf.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-ebpf.o `test -f 'src/libcrun/ebpf.c' || echo '$(srcdir)/'`src/libcrun/ebpf.c src/libcrun/libcrun_testing_a-ebpf.obj: src/libcrun/ebpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-ebpf.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-ebpf.Tpo -c -o src/libcrun/libcrun_testing_a-ebpf.obj `if test -f 'src/libcrun/ebpf.c'; then $(CYGPATH_W) 'src/libcrun/ebpf.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/ebpf.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-ebpf.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-ebpf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/ebpf.c' object='src/libcrun/libcrun_testing_a-ebpf.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-ebpf.obj `if test -f 'src/libcrun/ebpf.c'; then $(CYGPATH_W) 'src/libcrun/ebpf.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/ebpf.c'; fi` src/libcrun/libcrun_testing_a-error.o: src/libcrun/error.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-error.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-error.Tpo -c -o src/libcrun/libcrun_testing_a-error.o `test -f 'src/libcrun/error.c' || echo '$(srcdir)/'`src/libcrun/error.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-error.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-error.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/error.c' object='src/libcrun/libcrun_testing_a-error.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-error.o `test -f 'src/libcrun/error.c' || echo '$(srcdir)/'`src/libcrun/error.c src/libcrun/libcrun_testing_a-error.obj: src/libcrun/error.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-error.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-error.Tpo -c -o src/libcrun/libcrun_testing_a-error.obj `if test -f 'src/libcrun/error.c'; then $(CYGPATH_W) 'src/libcrun/error.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/error.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-error.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-error.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/error.c' object='src/libcrun/libcrun_testing_a-error.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-error.obj `if test -f 'src/libcrun/error.c'; then $(CYGPATH_W) 'src/libcrun/error.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/error.c'; fi` src/libcrun/handlers/libcrun_testing_a-handler-utils.o: src/libcrun/handlers/handler-utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-handler-utils.o -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-handler-utils.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-handler-utils.o `test -f 'src/libcrun/handlers/handler-utils.c' || echo '$(srcdir)/'`src/libcrun/handlers/handler-utils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-handler-utils.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-handler-utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/handler-utils.c' object='src/libcrun/handlers/libcrun_testing_a-handler-utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-handler-utils.o `test -f 'src/libcrun/handlers/handler-utils.c' || echo '$(srcdir)/'`src/libcrun/handlers/handler-utils.c src/libcrun/handlers/libcrun_testing_a-handler-utils.obj: src/libcrun/handlers/handler-utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-handler-utils.obj -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-handler-utils.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-handler-utils.obj `if test -f 'src/libcrun/handlers/handler-utils.c'; then $(CYGPATH_W) 'src/libcrun/handlers/handler-utils.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/handler-utils.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-handler-utils.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-handler-utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/handler-utils.c' object='src/libcrun/handlers/libcrun_testing_a-handler-utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-handler-utils.obj `if test -f 'src/libcrun/handlers/handler-utils.c'; then $(CYGPATH_W) 'src/libcrun/handlers/handler-utils.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/handler-utils.c'; fi` src/libcrun/handlers/libcrun_testing_a-krun.o: src/libcrun/handlers/krun.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-krun.o -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-krun.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-krun.o `test -f 'src/libcrun/handlers/krun.c' || echo '$(srcdir)/'`src/libcrun/handlers/krun.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-krun.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-krun.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/krun.c' object='src/libcrun/handlers/libcrun_testing_a-krun.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-krun.o `test -f 'src/libcrun/handlers/krun.c' || echo '$(srcdir)/'`src/libcrun/handlers/krun.c src/libcrun/handlers/libcrun_testing_a-krun.obj: src/libcrun/handlers/krun.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-krun.obj -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-krun.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-krun.obj `if test -f 'src/libcrun/handlers/krun.c'; then $(CYGPATH_W) 'src/libcrun/handlers/krun.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/krun.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-krun.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-krun.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/krun.c' object='src/libcrun/handlers/libcrun_testing_a-krun.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-krun.obj `if test -f 'src/libcrun/handlers/krun.c'; then $(CYGPATH_W) 'src/libcrun/handlers/krun.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/krun.c'; fi` src/libcrun/handlers/libcrun_testing_a-mono.o: src/libcrun/handlers/mono.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-mono.o -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-mono.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-mono.o `test -f 'src/libcrun/handlers/mono.c' || echo '$(srcdir)/'`src/libcrun/handlers/mono.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-mono.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-mono.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/mono.c' object='src/libcrun/handlers/libcrun_testing_a-mono.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-mono.o `test -f 'src/libcrun/handlers/mono.c' || echo '$(srcdir)/'`src/libcrun/handlers/mono.c src/libcrun/handlers/libcrun_testing_a-mono.obj: src/libcrun/handlers/mono.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-mono.obj -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-mono.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-mono.obj `if test -f 'src/libcrun/handlers/mono.c'; then $(CYGPATH_W) 'src/libcrun/handlers/mono.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/mono.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-mono.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-mono.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/mono.c' object='src/libcrun/handlers/libcrun_testing_a-mono.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-mono.obj `if test -f 'src/libcrun/handlers/mono.c'; then $(CYGPATH_W) 'src/libcrun/handlers/mono.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/mono.c'; fi` src/libcrun/handlers/libcrun_testing_a-spin.o: src/libcrun/handlers/spin.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-spin.o -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-spin.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-spin.o `test -f 'src/libcrun/handlers/spin.c' || echo '$(srcdir)/'`src/libcrun/handlers/spin.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-spin.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-spin.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/spin.c' object='src/libcrun/handlers/libcrun_testing_a-spin.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-spin.o `test -f 'src/libcrun/handlers/spin.c' || echo '$(srcdir)/'`src/libcrun/handlers/spin.c src/libcrun/handlers/libcrun_testing_a-spin.obj: src/libcrun/handlers/spin.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-spin.obj -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-spin.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-spin.obj `if test -f 'src/libcrun/handlers/spin.c'; then $(CYGPATH_W) 'src/libcrun/handlers/spin.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/spin.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-spin.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-spin.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/spin.c' object='src/libcrun/handlers/libcrun_testing_a-spin.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-spin.obj `if test -f 'src/libcrun/handlers/spin.c'; then $(CYGPATH_W) 'src/libcrun/handlers/spin.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/spin.c'; fi` src/libcrun/handlers/libcrun_testing_a-wasmedge.o: src/libcrun/handlers/wasmedge.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-wasmedge.o -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmedge.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-wasmedge.o `test -f 'src/libcrun/handlers/wasmedge.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmedge.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmedge.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmedge.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/wasmedge.c' object='src/libcrun/handlers/libcrun_testing_a-wasmedge.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-wasmedge.o `test -f 'src/libcrun/handlers/wasmedge.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmedge.c src/libcrun/handlers/libcrun_testing_a-wasmedge.obj: src/libcrun/handlers/wasmedge.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-wasmedge.obj -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmedge.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-wasmedge.obj `if test -f 'src/libcrun/handlers/wasmedge.c'; then $(CYGPATH_W) 'src/libcrun/handlers/wasmedge.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/wasmedge.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmedge.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmedge.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/wasmedge.c' object='src/libcrun/handlers/libcrun_testing_a-wasmedge.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-wasmedge.obj `if test -f 'src/libcrun/handlers/wasmedge.c'; then $(CYGPATH_W) 'src/libcrun/handlers/wasmedge.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/wasmedge.c'; fi` src/libcrun/handlers/libcrun_testing_a-wasmer.o: src/libcrun/handlers/wasmer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-wasmer.o -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmer.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-wasmer.o `test -f 'src/libcrun/handlers/wasmer.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmer.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmer.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/wasmer.c' object='src/libcrun/handlers/libcrun_testing_a-wasmer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-wasmer.o `test -f 'src/libcrun/handlers/wasmer.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmer.c src/libcrun/handlers/libcrun_testing_a-wasmer.obj: src/libcrun/handlers/wasmer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-wasmer.obj -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmer.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-wasmer.obj `if test -f 'src/libcrun/handlers/wasmer.c'; then $(CYGPATH_W) 'src/libcrun/handlers/wasmer.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/wasmer.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmer.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/wasmer.c' object='src/libcrun/handlers/libcrun_testing_a-wasmer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-wasmer.obj `if test -f 'src/libcrun/handlers/wasmer.c'; then $(CYGPATH_W) 'src/libcrun/handlers/wasmer.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/wasmer.c'; fi` src/libcrun/handlers/libcrun_testing_a-wasmtime.o: src/libcrun/handlers/wasmtime.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-wasmtime.o -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmtime.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-wasmtime.o `test -f 'src/libcrun/handlers/wasmtime.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmtime.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmtime.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmtime.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/wasmtime.c' object='src/libcrun/handlers/libcrun_testing_a-wasmtime.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-wasmtime.o `test -f 'src/libcrun/handlers/wasmtime.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmtime.c src/libcrun/handlers/libcrun_testing_a-wasmtime.obj: src/libcrun/handlers/wasmtime.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_testing_a-wasmtime.obj -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmtime.Tpo -c -o src/libcrun/handlers/libcrun_testing_a-wasmtime.obj `if test -f 'src/libcrun/handlers/wasmtime.c'; then $(CYGPATH_W) 'src/libcrun/handlers/wasmtime.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/wasmtime.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmtime.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmtime.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/wasmtime.c' object='src/libcrun/handlers/libcrun_testing_a-wasmtime.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_testing_a-wasmtime.obj `if test -f 'src/libcrun/handlers/wasmtime.c'; then $(CYGPATH_W) 'src/libcrun/handlers/wasmtime.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/handlers/wasmtime.c'; fi` src/libcrun/libcrun_testing_a-intelrdt.o: src/libcrun/intelrdt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-intelrdt.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-intelrdt.Tpo -c -o src/libcrun/libcrun_testing_a-intelrdt.o `test -f 'src/libcrun/intelrdt.c' || echo '$(srcdir)/'`src/libcrun/intelrdt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-intelrdt.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-intelrdt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/intelrdt.c' object='src/libcrun/libcrun_testing_a-intelrdt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-intelrdt.o `test -f 'src/libcrun/intelrdt.c' || echo '$(srcdir)/'`src/libcrun/intelrdt.c src/libcrun/libcrun_testing_a-intelrdt.obj: src/libcrun/intelrdt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-intelrdt.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-intelrdt.Tpo -c -o src/libcrun/libcrun_testing_a-intelrdt.obj `if test -f 'src/libcrun/intelrdt.c'; then $(CYGPATH_W) 'src/libcrun/intelrdt.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/intelrdt.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-intelrdt.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-intelrdt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/intelrdt.c' object='src/libcrun/libcrun_testing_a-intelrdt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-intelrdt.obj `if test -f 'src/libcrun/intelrdt.c'; then $(CYGPATH_W) 'src/libcrun/intelrdt.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/intelrdt.c'; fi` src/libcrun/libcrun_testing_a-io_priority.o: src/libcrun/io_priority.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-io_priority.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-io_priority.Tpo -c -o src/libcrun/libcrun_testing_a-io_priority.o `test -f 'src/libcrun/io_priority.c' || echo '$(srcdir)/'`src/libcrun/io_priority.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-io_priority.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-io_priority.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/io_priority.c' object='src/libcrun/libcrun_testing_a-io_priority.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-io_priority.o `test -f 'src/libcrun/io_priority.c' || echo '$(srcdir)/'`src/libcrun/io_priority.c src/libcrun/libcrun_testing_a-io_priority.obj: src/libcrun/io_priority.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-io_priority.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-io_priority.Tpo -c -o src/libcrun/libcrun_testing_a-io_priority.obj `if test -f 'src/libcrun/io_priority.c'; then $(CYGPATH_W) 'src/libcrun/io_priority.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/io_priority.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-io_priority.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-io_priority.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/io_priority.c' object='src/libcrun/libcrun_testing_a-io_priority.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-io_priority.obj `if test -f 'src/libcrun/io_priority.c'; then $(CYGPATH_W) 'src/libcrun/io_priority.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/io_priority.c'; fi` src/libcrun/libcrun_testing_a-linux.o: src/libcrun/linux.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-linux.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-linux.Tpo -c -o src/libcrun/libcrun_testing_a-linux.o `test -f 'src/libcrun/linux.c' || echo '$(srcdir)/'`src/libcrun/linux.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-linux.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-linux.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/linux.c' object='src/libcrun/libcrun_testing_a-linux.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-linux.o `test -f 'src/libcrun/linux.c' || echo '$(srcdir)/'`src/libcrun/linux.c src/libcrun/libcrun_testing_a-linux.obj: src/libcrun/linux.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-linux.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-linux.Tpo -c -o src/libcrun/libcrun_testing_a-linux.obj `if test -f 'src/libcrun/linux.c'; then $(CYGPATH_W) 'src/libcrun/linux.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/linux.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-linux.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-linux.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/linux.c' object='src/libcrun/libcrun_testing_a-linux.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-linux.obj `if test -f 'src/libcrun/linux.c'; then $(CYGPATH_W) 'src/libcrun/linux.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/linux.c'; fi` src/libcrun/libcrun_testing_a-mount_flags.o: src/libcrun/mount_flags.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-mount_flags.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-mount_flags.Tpo -c -o src/libcrun/libcrun_testing_a-mount_flags.o `test -f 'src/libcrun/mount_flags.c' || echo '$(srcdir)/'`src/libcrun/mount_flags.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-mount_flags.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-mount_flags.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/mount_flags.c' object='src/libcrun/libcrun_testing_a-mount_flags.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-mount_flags.o `test -f 'src/libcrun/mount_flags.c' || echo '$(srcdir)/'`src/libcrun/mount_flags.c src/libcrun/libcrun_testing_a-mount_flags.obj: src/libcrun/mount_flags.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-mount_flags.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-mount_flags.Tpo -c -o src/libcrun/libcrun_testing_a-mount_flags.obj `if test -f 'src/libcrun/mount_flags.c'; then $(CYGPATH_W) 'src/libcrun/mount_flags.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/mount_flags.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-mount_flags.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-mount_flags.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/mount_flags.c' object='src/libcrun/libcrun_testing_a-mount_flags.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-mount_flags.obj `if test -f 'src/libcrun/mount_flags.c'; then $(CYGPATH_W) 'src/libcrun/mount_flags.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/mount_flags.c'; fi` src/libcrun/libcrun_testing_a-scheduler.o: src/libcrun/scheduler.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-scheduler.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-scheduler.Tpo -c -o src/libcrun/libcrun_testing_a-scheduler.o `test -f 'src/libcrun/scheduler.c' || echo '$(srcdir)/'`src/libcrun/scheduler.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-scheduler.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-scheduler.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/scheduler.c' object='src/libcrun/libcrun_testing_a-scheduler.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-scheduler.o `test -f 'src/libcrun/scheduler.c' || echo '$(srcdir)/'`src/libcrun/scheduler.c src/libcrun/libcrun_testing_a-scheduler.obj: src/libcrun/scheduler.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-scheduler.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-scheduler.Tpo -c -o src/libcrun/libcrun_testing_a-scheduler.obj `if test -f 'src/libcrun/scheduler.c'; then $(CYGPATH_W) 'src/libcrun/scheduler.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/scheduler.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-scheduler.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-scheduler.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/scheduler.c' object='src/libcrun/libcrun_testing_a-scheduler.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-scheduler.obj `if test -f 'src/libcrun/scheduler.c'; then $(CYGPATH_W) 'src/libcrun/scheduler.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/scheduler.c'; fi` src/libcrun/libcrun_testing_a-seccomp.o: src/libcrun/seccomp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-seccomp.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp.Tpo -c -o src/libcrun/libcrun_testing_a-seccomp.o `test -f 'src/libcrun/seccomp.c' || echo '$(srcdir)/'`src/libcrun/seccomp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/seccomp.c' object='src/libcrun/libcrun_testing_a-seccomp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-seccomp.o `test -f 'src/libcrun/seccomp.c' || echo '$(srcdir)/'`src/libcrun/seccomp.c src/libcrun/libcrun_testing_a-seccomp.obj: src/libcrun/seccomp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-seccomp.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp.Tpo -c -o src/libcrun/libcrun_testing_a-seccomp.obj `if test -f 'src/libcrun/seccomp.c'; then $(CYGPATH_W) 'src/libcrun/seccomp.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/seccomp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/seccomp.c' object='src/libcrun/libcrun_testing_a-seccomp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-seccomp.obj `if test -f 'src/libcrun/seccomp.c'; then $(CYGPATH_W) 'src/libcrun/seccomp.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/seccomp.c'; fi` src/libcrun/libcrun_testing_a-seccomp_notify.o: src/libcrun/seccomp_notify.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-seccomp_notify.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp_notify.Tpo -c -o src/libcrun/libcrun_testing_a-seccomp_notify.o `test -f 'src/libcrun/seccomp_notify.c' || echo '$(srcdir)/'`src/libcrun/seccomp_notify.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp_notify.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp_notify.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/seccomp_notify.c' object='src/libcrun/libcrun_testing_a-seccomp_notify.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-seccomp_notify.o `test -f 'src/libcrun/seccomp_notify.c' || echo '$(srcdir)/'`src/libcrun/seccomp_notify.c src/libcrun/libcrun_testing_a-seccomp_notify.obj: src/libcrun/seccomp_notify.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-seccomp_notify.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp_notify.Tpo -c -o src/libcrun/libcrun_testing_a-seccomp_notify.obj `if test -f 'src/libcrun/seccomp_notify.c'; then $(CYGPATH_W) 'src/libcrun/seccomp_notify.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/seccomp_notify.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp_notify.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp_notify.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/seccomp_notify.c' object='src/libcrun/libcrun_testing_a-seccomp_notify.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-seccomp_notify.obj `if test -f 'src/libcrun/seccomp_notify.c'; then $(CYGPATH_W) 'src/libcrun/seccomp_notify.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/seccomp_notify.c'; fi` src/libcrun/libcrun_testing_a-signals.o: src/libcrun/signals.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-signals.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-signals.Tpo -c -o src/libcrun/libcrun_testing_a-signals.o `test -f 'src/libcrun/signals.c' || echo '$(srcdir)/'`src/libcrun/signals.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-signals.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-signals.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/signals.c' object='src/libcrun/libcrun_testing_a-signals.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-signals.o `test -f 'src/libcrun/signals.c' || echo '$(srcdir)/'`src/libcrun/signals.c src/libcrun/libcrun_testing_a-signals.obj: src/libcrun/signals.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-signals.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-signals.Tpo -c -o src/libcrun/libcrun_testing_a-signals.obj `if test -f 'src/libcrun/signals.c'; then $(CYGPATH_W) 'src/libcrun/signals.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/signals.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-signals.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-signals.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/signals.c' object='src/libcrun/libcrun_testing_a-signals.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-signals.obj `if test -f 'src/libcrun/signals.c'; then $(CYGPATH_W) 'src/libcrun/signals.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/signals.c'; fi` src/libcrun/libcrun_testing_a-status.o: src/libcrun/status.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-status.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-status.Tpo -c -o src/libcrun/libcrun_testing_a-status.o `test -f 'src/libcrun/status.c' || echo '$(srcdir)/'`src/libcrun/status.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-status.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-status.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/status.c' object='src/libcrun/libcrun_testing_a-status.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-status.o `test -f 'src/libcrun/status.c' || echo '$(srcdir)/'`src/libcrun/status.c src/libcrun/libcrun_testing_a-status.obj: src/libcrun/status.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-status.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-status.Tpo -c -o src/libcrun/libcrun_testing_a-status.obj `if test -f 'src/libcrun/status.c'; then $(CYGPATH_W) 'src/libcrun/status.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/status.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-status.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-status.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/status.c' object='src/libcrun/libcrun_testing_a-status.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-status.obj `if test -f 'src/libcrun/status.c'; then $(CYGPATH_W) 'src/libcrun/status.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/status.c'; fi` src/libcrun/libcrun_testing_a-terminal.o: src/libcrun/terminal.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-terminal.o -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-terminal.Tpo -c -o src/libcrun/libcrun_testing_a-terminal.o `test -f 'src/libcrun/terminal.c' || echo '$(srcdir)/'`src/libcrun/terminal.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-terminal.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-terminal.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/terminal.c' object='src/libcrun/libcrun_testing_a-terminal.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-terminal.o `test -f 'src/libcrun/terminal.c' || echo '$(srcdir)/'`src/libcrun/terminal.c src/libcrun/libcrun_testing_a-terminal.obj: src/libcrun/terminal.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_testing_a-terminal.obj -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_testing_a-terminal.Tpo -c -o src/libcrun/libcrun_testing_a-terminal.obj `if test -f 'src/libcrun/terminal.c'; then $(CYGPATH_W) 'src/libcrun/terminal.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/terminal.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_testing_a-terminal.Tpo src/libcrun/$(DEPDIR)/libcrun_testing_a-terminal.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/terminal.c' object='src/libcrun/libcrun_testing_a-terminal.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_testing_a_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_testing_a-terminal.obj `if test -f 'src/libcrun/terminal.c'; then $(CYGPATH_W) 'src/libcrun/terminal.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/terminal.c'; fi` src/libcrun/libcrun_la-utils.lo: src/libcrun/utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-utils.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-utils.Tpo -c -o src/libcrun/libcrun_la-utils.lo `test -f 'src/libcrun/utils.c' || echo '$(srcdir)/'`src/libcrun/utils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-utils.Tpo src/libcrun/$(DEPDIR)/libcrun_la-utils.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/utils.c' object='src/libcrun/libcrun_la-utils.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-utils.lo `test -f 'src/libcrun/utils.c' || echo '$(srcdir)/'`src/libcrun/utils.c src/libcrun/blake3/libcrun_la-blake3.lo: src/libcrun/blake3/blake3.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/blake3/libcrun_la-blake3.lo -MD -MP -MF src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3.Tpo -c -o src/libcrun/blake3/libcrun_la-blake3.lo `test -f 'src/libcrun/blake3/blake3.c' || echo '$(srcdir)/'`src/libcrun/blake3/blake3.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3.Tpo src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/blake3/blake3.c' object='src/libcrun/blake3/libcrun_la-blake3.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/blake3/libcrun_la-blake3.lo `test -f 'src/libcrun/blake3/blake3.c' || echo '$(srcdir)/'`src/libcrun/blake3/blake3.c src/libcrun/blake3/libcrun_la-blake3_portable.lo: src/libcrun/blake3/blake3_portable.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/blake3/libcrun_la-blake3_portable.lo -MD -MP -MF src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3_portable.Tpo -c -o src/libcrun/blake3/libcrun_la-blake3_portable.lo `test -f 'src/libcrun/blake3/blake3_portable.c' || echo '$(srcdir)/'`src/libcrun/blake3/blake3_portable.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3_portable.Tpo src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3_portable.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/blake3/blake3_portable.c' object='src/libcrun/blake3/libcrun_la-blake3_portable.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/blake3/libcrun_la-blake3_portable.lo `test -f 'src/libcrun/blake3/blake3_portable.c' || echo '$(srcdir)/'`src/libcrun/blake3/blake3_portable.c src/libcrun/libcrun_la-cgroup-cgroupfs.lo: src/libcrun/cgroup-cgroupfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-cgroup-cgroupfs.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-cgroup-cgroupfs.Tpo -c -o src/libcrun/libcrun_la-cgroup-cgroupfs.lo `test -f 'src/libcrun/cgroup-cgroupfs.c' || echo '$(srcdir)/'`src/libcrun/cgroup-cgroupfs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-cgroup-cgroupfs.Tpo src/libcrun/$(DEPDIR)/libcrun_la-cgroup-cgroupfs.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-cgroupfs.c' object='src/libcrun/libcrun_la-cgroup-cgroupfs.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-cgroup-cgroupfs.lo `test -f 'src/libcrun/cgroup-cgroupfs.c' || echo '$(srcdir)/'`src/libcrun/cgroup-cgroupfs.c src/libcrun/libcrun_la-cgroup-resources.lo: src/libcrun/cgroup-resources.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-cgroup-resources.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-cgroup-resources.Tpo -c -o src/libcrun/libcrun_la-cgroup-resources.lo `test -f 'src/libcrun/cgroup-resources.c' || echo '$(srcdir)/'`src/libcrun/cgroup-resources.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-cgroup-resources.Tpo src/libcrun/$(DEPDIR)/libcrun_la-cgroup-resources.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-resources.c' object='src/libcrun/libcrun_la-cgroup-resources.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-cgroup-resources.lo `test -f 'src/libcrun/cgroup-resources.c' || echo '$(srcdir)/'`src/libcrun/cgroup-resources.c src/libcrun/libcrun_la-cgroup-setup.lo: src/libcrun/cgroup-setup.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-cgroup-setup.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-cgroup-setup.Tpo -c -o src/libcrun/libcrun_la-cgroup-setup.lo `test -f 'src/libcrun/cgroup-setup.c' || echo '$(srcdir)/'`src/libcrun/cgroup-setup.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-cgroup-setup.Tpo src/libcrun/$(DEPDIR)/libcrun_la-cgroup-setup.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-setup.c' object='src/libcrun/libcrun_la-cgroup-setup.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-cgroup-setup.lo `test -f 'src/libcrun/cgroup-setup.c' || echo '$(srcdir)/'`src/libcrun/cgroup-setup.c src/libcrun/libcrun_la-cgroup-systemd.lo: src/libcrun/cgroup-systemd.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-cgroup-systemd.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-cgroup-systemd.Tpo -c -o src/libcrun/libcrun_la-cgroup-systemd.lo `test -f 'src/libcrun/cgroup-systemd.c' || echo '$(srcdir)/'`src/libcrun/cgroup-systemd.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-cgroup-systemd.Tpo src/libcrun/$(DEPDIR)/libcrun_la-cgroup-systemd.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-systemd.c' object='src/libcrun/libcrun_la-cgroup-systemd.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-cgroup-systemd.lo `test -f 'src/libcrun/cgroup-systemd.c' || echo '$(srcdir)/'`src/libcrun/cgroup-systemd.c src/libcrun/libcrun_la-cgroup-utils.lo: src/libcrun/cgroup-utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-cgroup-utils.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-cgroup-utils.Tpo -c -o src/libcrun/libcrun_la-cgroup-utils.lo `test -f 'src/libcrun/cgroup-utils.c' || echo '$(srcdir)/'`src/libcrun/cgroup-utils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-cgroup-utils.Tpo src/libcrun/$(DEPDIR)/libcrun_la-cgroup-utils.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup-utils.c' object='src/libcrun/libcrun_la-cgroup-utils.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-cgroup-utils.lo `test -f 'src/libcrun/cgroup-utils.c' || echo '$(srcdir)/'`src/libcrun/cgroup-utils.c src/libcrun/libcrun_la-cgroup.lo: src/libcrun/cgroup.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-cgroup.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-cgroup.Tpo -c -o src/libcrun/libcrun_la-cgroup.lo `test -f 'src/libcrun/cgroup.c' || echo '$(srcdir)/'`src/libcrun/cgroup.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-cgroup.Tpo src/libcrun/$(DEPDIR)/libcrun_la-cgroup.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cgroup.c' object='src/libcrun/libcrun_la-cgroup.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-cgroup.lo `test -f 'src/libcrun/cgroup.c' || echo '$(srcdir)/'`src/libcrun/cgroup.c src/libcrun/libcrun_la-chroot_realpath.lo: src/libcrun/chroot_realpath.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-chroot_realpath.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-chroot_realpath.Tpo -c -o src/libcrun/libcrun_la-chroot_realpath.lo `test -f 'src/libcrun/chroot_realpath.c' || echo '$(srcdir)/'`src/libcrun/chroot_realpath.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-chroot_realpath.Tpo src/libcrun/$(DEPDIR)/libcrun_la-chroot_realpath.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/chroot_realpath.c' object='src/libcrun/libcrun_la-chroot_realpath.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-chroot_realpath.lo `test -f 'src/libcrun/chroot_realpath.c' || echo '$(srcdir)/'`src/libcrun/chroot_realpath.c src/libcrun/libcrun_la-cloned_binary.lo: src/libcrun/cloned_binary.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-cloned_binary.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-cloned_binary.Tpo -c -o src/libcrun/libcrun_la-cloned_binary.lo `test -f 'src/libcrun/cloned_binary.c' || echo '$(srcdir)/'`src/libcrun/cloned_binary.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-cloned_binary.Tpo src/libcrun/$(DEPDIR)/libcrun_la-cloned_binary.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cloned_binary.c' object='src/libcrun/libcrun_la-cloned_binary.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-cloned_binary.lo `test -f 'src/libcrun/cloned_binary.c' || echo '$(srcdir)/'`src/libcrun/cloned_binary.c src/libcrun/libcrun_la-container.lo: src/libcrun/container.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-container.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-container.Tpo -c -o src/libcrun/libcrun_la-container.lo `test -f 'src/libcrun/container.c' || echo '$(srcdir)/'`src/libcrun/container.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-container.Tpo src/libcrun/$(DEPDIR)/libcrun_la-container.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/container.c' object='src/libcrun/libcrun_la-container.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-container.lo `test -f 'src/libcrun/container.c' || echo '$(srcdir)/'`src/libcrun/container.c src/libcrun/libcrun_la-criu.lo: src/libcrun/criu.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-criu.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-criu.Tpo -c -o src/libcrun/libcrun_la-criu.lo `test -f 'src/libcrun/criu.c' || echo '$(srcdir)/'`src/libcrun/criu.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-criu.Tpo src/libcrun/$(DEPDIR)/libcrun_la-criu.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/criu.c' object='src/libcrun/libcrun_la-criu.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-criu.lo `test -f 'src/libcrun/criu.c' || echo '$(srcdir)/'`src/libcrun/criu.c src/libcrun/libcrun_la-custom-handler.lo: src/libcrun/custom-handler.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-custom-handler.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-custom-handler.Tpo -c -o src/libcrun/libcrun_la-custom-handler.lo `test -f 'src/libcrun/custom-handler.c' || echo '$(srcdir)/'`src/libcrun/custom-handler.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-custom-handler.Tpo src/libcrun/$(DEPDIR)/libcrun_la-custom-handler.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/custom-handler.c' object='src/libcrun/libcrun_la-custom-handler.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-custom-handler.lo `test -f 'src/libcrun/custom-handler.c' || echo '$(srcdir)/'`src/libcrun/custom-handler.c src/libcrun/libcrun_la-ebpf.lo: src/libcrun/ebpf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-ebpf.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-ebpf.Tpo -c -o src/libcrun/libcrun_la-ebpf.lo `test -f 'src/libcrun/ebpf.c' || echo '$(srcdir)/'`src/libcrun/ebpf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-ebpf.Tpo src/libcrun/$(DEPDIR)/libcrun_la-ebpf.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/ebpf.c' object='src/libcrun/libcrun_la-ebpf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-ebpf.lo `test -f 'src/libcrun/ebpf.c' || echo '$(srcdir)/'`src/libcrun/ebpf.c src/libcrun/libcrun_la-error.lo: src/libcrun/error.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-error.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-error.Tpo -c -o src/libcrun/libcrun_la-error.lo `test -f 'src/libcrun/error.c' || echo '$(srcdir)/'`src/libcrun/error.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-error.Tpo src/libcrun/$(DEPDIR)/libcrun_la-error.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/error.c' object='src/libcrun/libcrun_la-error.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-error.lo `test -f 'src/libcrun/error.c' || echo '$(srcdir)/'`src/libcrun/error.c src/libcrun/handlers/libcrun_la-handler-utils.lo: src/libcrun/handlers/handler-utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_la-handler-utils.lo -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_la-handler-utils.Tpo -c -o src/libcrun/handlers/libcrun_la-handler-utils.lo `test -f 'src/libcrun/handlers/handler-utils.c' || echo '$(srcdir)/'`src/libcrun/handlers/handler-utils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_la-handler-utils.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_la-handler-utils.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/handler-utils.c' object='src/libcrun/handlers/libcrun_la-handler-utils.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_la-handler-utils.lo `test -f 'src/libcrun/handlers/handler-utils.c' || echo '$(srcdir)/'`src/libcrun/handlers/handler-utils.c src/libcrun/handlers/libcrun_la-krun.lo: src/libcrun/handlers/krun.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_la-krun.lo -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_la-krun.Tpo -c -o src/libcrun/handlers/libcrun_la-krun.lo `test -f 'src/libcrun/handlers/krun.c' || echo '$(srcdir)/'`src/libcrun/handlers/krun.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_la-krun.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_la-krun.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/krun.c' object='src/libcrun/handlers/libcrun_la-krun.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_la-krun.lo `test -f 'src/libcrun/handlers/krun.c' || echo '$(srcdir)/'`src/libcrun/handlers/krun.c src/libcrun/handlers/libcrun_la-mono.lo: src/libcrun/handlers/mono.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_la-mono.lo -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_la-mono.Tpo -c -o src/libcrun/handlers/libcrun_la-mono.lo `test -f 'src/libcrun/handlers/mono.c' || echo '$(srcdir)/'`src/libcrun/handlers/mono.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_la-mono.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_la-mono.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/mono.c' object='src/libcrun/handlers/libcrun_la-mono.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_la-mono.lo `test -f 'src/libcrun/handlers/mono.c' || echo '$(srcdir)/'`src/libcrun/handlers/mono.c src/libcrun/handlers/libcrun_la-spin.lo: src/libcrun/handlers/spin.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_la-spin.lo -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_la-spin.Tpo -c -o src/libcrun/handlers/libcrun_la-spin.lo `test -f 'src/libcrun/handlers/spin.c' || echo '$(srcdir)/'`src/libcrun/handlers/spin.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_la-spin.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_la-spin.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/spin.c' object='src/libcrun/handlers/libcrun_la-spin.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_la-spin.lo `test -f 'src/libcrun/handlers/spin.c' || echo '$(srcdir)/'`src/libcrun/handlers/spin.c src/libcrun/handlers/libcrun_la-wasmedge.lo: src/libcrun/handlers/wasmedge.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_la-wasmedge.lo -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmedge.Tpo -c -o src/libcrun/handlers/libcrun_la-wasmedge.lo `test -f 'src/libcrun/handlers/wasmedge.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmedge.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmedge.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmedge.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/wasmedge.c' object='src/libcrun/handlers/libcrun_la-wasmedge.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_la-wasmedge.lo `test -f 'src/libcrun/handlers/wasmedge.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmedge.c src/libcrun/handlers/libcrun_la-wasmer.lo: src/libcrun/handlers/wasmer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_la-wasmer.lo -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmer.Tpo -c -o src/libcrun/handlers/libcrun_la-wasmer.lo `test -f 'src/libcrun/handlers/wasmer.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmer.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmer.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmer.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/wasmer.c' object='src/libcrun/handlers/libcrun_la-wasmer.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_la-wasmer.lo `test -f 'src/libcrun/handlers/wasmer.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmer.c src/libcrun/handlers/libcrun_la-wasmtime.lo: src/libcrun/handlers/wasmtime.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/handlers/libcrun_la-wasmtime.lo -MD -MP -MF src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmtime.Tpo -c -o src/libcrun/handlers/libcrun_la-wasmtime.lo `test -f 'src/libcrun/handlers/wasmtime.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmtime.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmtime.Tpo src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmtime.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/handlers/wasmtime.c' object='src/libcrun/handlers/libcrun_la-wasmtime.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/handlers/libcrun_la-wasmtime.lo `test -f 'src/libcrun/handlers/wasmtime.c' || echo '$(srcdir)/'`src/libcrun/handlers/wasmtime.c src/libcrun/libcrun_la-intelrdt.lo: src/libcrun/intelrdt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-intelrdt.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-intelrdt.Tpo -c -o src/libcrun/libcrun_la-intelrdt.lo `test -f 'src/libcrun/intelrdt.c' || echo '$(srcdir)/'`src/libcrun/intelrdt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-intelrdt.Tpo src/libcrun/$(DEPDIR)/libcrun_la-intelrdt.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/intelrdt.c' object='src/libcrun/libcrun_la-intelrdt.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-intelrdt.lo `test -f 'src/libcrun/intelrdt.c' || echo '$(srcdir)/'`src/libcrun/intelrdt.c src/libcrun/libcrun_la-io_priority.lo: src/libcrun/io_priority.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-io_priority.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-io_priority.Tpo -c -o src/libcrun/libcrun_la-io_priority.lo `test -f 'src/libcrun/io_priority.c' || echo '$(srcdir)/'`src/libcrun/io_priority.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-io_priority.Tpo src/libcrun/$(DEPDIR)/libcrun_la-io_priority.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/io_priority.c' object='src/libcrun/libcrun_la-io_priority.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-io_priority.lo `test -f 'src/libcrun/io_priority.c' || echo '$(srcdir)/'`src/libcrun/io_priority.c src/libcrun/libcrun_la-linux.lo: src/libcrun/linux.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-linux.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-linux.Tpo -c -o src/libcrun/libcrun_la-linux.lo `test -f 'src/libcrun/linux.c' || echo '$(srcdir)/'`src/libcrun/linux.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-linux.Tpo src/libcrun/$(DEPDIR)/libcrun_la-linux.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/linux.c' object='src/libcrun/libcrun_la-linux.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-linux.lo `test -f 'src/libcrun/linux.c' || echo '$(srcdir)/'`src/libcrun/linux.c src/libcrun/libcrun_la-mount_flags.lo: src/libcrun/mount_flags.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-mount_flags.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-mount_flags.Tpo -c -o src/libcrun/libcrun_la-mount_flags.lo `test -f 'src/libcrun/mount_flags.c' || echo '$(srcdir)/'`src/libcrun/mount_flags.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-mount_flags.Tpo src/libcrun/$(DEPDIR)/libcrun_la-mount_flags.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/mount_flags.c' object='src/libcrun/libcrun_la-mount_flags.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-mount_flags.lo `test -f 'src/libcrun/mount_flags.c' || echo '$(srcdir)/'`src/libcrun/mount_flags.c src/libcrun/libcrun_la-scheduler.lo: src/libcrun/scheduler.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-scheduler.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-scheduler.Tpo -c -o src/libcrun/libcrun_la-scheduler.lo `test -f 'src/libcrun/scheduler.c' || echo '$(srcdir)/'`src/libcrun/scheduler.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-scheduler.Tpo src/libcrun/$(DEPDIR)/libcrun_la-scheduler.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/scheduler.c' object='src/libcrun/libcrun_la-scheduler.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-scheduler.lo `test -f 'src/libcrun/scheduler.c' || echo '$(srcdir)/'`src/libcrun/scheduler.c src/libcrun/libcrun_la-seccomp.lo: src/libcrun/seccomp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-seccomp.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-seccomp.Tpo -c -o src/libcrun/libcrun_la-seccomp.lo `test -f 'src/libcrun/seccomp.c' || echo '$(srcdir)/'`src/libcrun/seccomp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-seccomp.Tpo src/libcrun/$(DEPDIR)/libcrun_la-seccomp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/seccomp.c' object='src/libcrun/libcrun_la-seccomp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-seccomp.lo `test -f 'src/libcrun/seccomp.c' || echo '$(srcdir)/'`src/libcrun/seccomp.c src/libcrun/libcrun_la-seccomp_notify.lo: src/libcrun/seccomp_notify.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-seccomp_notify.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-seccomp_notify.Tpo -c -o src/libcrun/libcrun_la-seccomp_notify.lo `test -f 'src/libcrun/seccomp_notify.c' || echo '$(srcdir)/'`src/libcrun/seccomp_notify.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-seccomp_notify.Tpo src/libcrun/$(DEPDIR)/libcrun_la-seccomp_notify.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/seccomp_notify.c' object='src/libcrun/libcrun_la-seccomp_notify.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-seccomp_notify.lo `test -f 'src/libcrun/seccomp_notify.c' || echo '$(srcdir)/'`src/libcrun/seccomp_notify.c src/libcrun/libcrun_la-signals.lo: src/libcrun/signals.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-signals.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-signals.Tpo -c -o src/libcrun/libcrun_la-signals.lo `test -f 'src/libcrun/signals.c' || echo '$(srcdir)/'`src/libcrun/signals.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-signals.Tpo src/libcrun/$(DEPDIR)/libcrun_la-signals.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/signals.c' object='src/libcrun/libcrun_la-signals.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-signals.lo `test -f 'src/libcrun/signals.c' || echo '$(srcdir)/'`src/libcrun/signals.c src/libcrun/libcrun_la-status.lo: src/libcrun/status.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-status.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-status.Tpo -c -o src/libcrun/libcrun_la-status.lo `test -f 'src/libcrun/status.c' || echo '$(srcdir)/'`src/libcrun/status.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-status.Tpo src/libcrun/$(DEPDIR)/libcrun_la-status.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/status.c' object='src/libcrun/libcrun_la-status.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-status.lo `test -f 'src/libcrun/status.c' || echo '$(srcdir)/'`src/libcrun/status.c src/libcrun/libcrun_la-terminal.lo: src/libcrun/terminal.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -MT src/libcrun/libcrun_la-terminal.lo -MD -MP -MF src/libcrun/$(DEPDIR)/libcrun_la-terminal.Tpo -c -o src/libcrun/libcrun_la-terminal.lo `test -f 'src/libcrun/terminal.c' || echo '$(srcdir)/'`src/libcrun/terminal.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/libcrun_la-terminal.Tpo src/libcrun/$(DEPDIR)/libcrun_la-terminal.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/terminal.c' object='src/libcrun/libcrun_la-terminal.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrun_la_CFLAGS) $(CFLAGS) -c -o src/libcrun/libcrun_la-terminal.lo `test -f 'src/libcrun/terminal.c' || echo '$(srcdir)/'`src/libcrun/terminal.c lua/luacrun_la-lua_crun.lo: lua/lua_crun.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(luacrun_la_CFLAGS) $(CFLAGS) -MT lua/luacrun_la-lua_crun.lo -MD -MP -MF lua/$(DEPDIR)/luacrun_la-lua_crun.Tpo -c -o lua/luacrun_la-lua_crun.lo `test -f 'lua/lua_crun.c' || echo '$(srcdir)/'`lua/lua_crun.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) lua/$(DEPDIR)/luacrun_la-lua_crun.Tpo lua/$(DEPDIR)/luacrun_la-lua_crun.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lua/lua_crun.c' object='lua/luacrun_la-lua_crun.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(luacrun_la_CFLAGS) $(CFLAGS) -c -o lua/luacrun_la-lua_crun.lo `test -f 'lua/lua_crun.c' || echo '$(srcdir)/'`lua/lua_crun.c python/crun_la-crun_python.lo: python/crun_python.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(python_crun_la_CFLAGS) $(CFLAGS) -MT python/crun_la-crun_python.lo -MD -MP -MF python/$(DEPDIR)/crun_la-crun_python.Tpo -c -o python/crun_la-crun_python.lo `test -f 'python/crun_python.c' || echo '$(srcdir)/'`python/crun_python.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) python/$(DEPDIR)/crun_la-crun_python.Tpo python/$(DEPDIR)/crun_la-crun_python.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='python/crun_python.c' object='python/crun_la-crun_python.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(python_crun_la_CFLAGS) $(CFLAGS) -c -o python/crun_la-crun_python.lo `test -f 'python/crun_python.c' || echo '$(srcdir)/'`python/crun_python.c src/crun-crun.o: src/crun.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-crun.o -MD -MP -MF src/$(DEPDIR)/crun-crun.Tpo -c -o src/crun-crun.o `test -f 'src/crun.c' || echo '$(srcdir)/'`src/crun.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-crun.Tpo src/$(DEPDIR)/crun-crun.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/crun.c' object='src/crun-crun.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-crun.o `test -f 'src/crun.c' || echo '$(srcdir)/'`src/crun.c src/crun-crun.obj: src/crun.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-crun.obj -MD -MP -MF src/$(DEPDIR)/crun-crun.Tpo -c -o src/crun-crun.obj `if test -f 'src/crun.c'; then $(CYGPATH_W) 'src/crun.c'; else $(CYGPATH_W) '$(srcdir)/src/crun.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-crun.Tpo src/$(DEPDIR)/crun-crun.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/crun.c' object='src/crun-crun.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-crun.obj `if test -f 'src/crun.c'; then $(CYGPATH_W) 'src/crun.c'; else $(CYGPATH_W) '$(srcdir)/src/crun.c'; fi` src/crun-run.o: src/run.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-run.o -MD -MP -MF src/$(DEPDIR)/crun-run.Tpo -c -o src/crun-run.o `test -f 'src/run.c' || echo '$(srcdir)/'`src/run.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-run.Tpo src/$(DEPDIR)/crun-run.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/run.c' object='src/crun-run.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-run.o `test -f 'src/run.c' || echo '$(srcdir)/'`src/run.c src/crun-run.obj: src/run.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-run.obj -MD -MP -MF src/$(DEPDIR)/crun-run.Tpo -c -o src/crun-run.obj `if test -f 'src/run.c'; then $(CYGPATH_W) 'src/run.c'; else $(CYGPATH_W) '$(srcdir)/src/run.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-run.Tpo src/$(DEPDIR)/crun-run.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/run.c' object='src/crun-run.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-run.obj `if test -f 'src/run.c'; then $(CYGPATH_W) 'src/run.c'; else $(CYGPATH_W) '$(srcdir)/src/run.c'; fi` src/crun-delete.o: src/delete.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-delete.o -MD -MP -MF src/$(DEPDIR)/crun-delete.Tpo -c -o src/crun-delete.o `test -f 'src/delete.c' || echo '$(srcdir)/'`src/delete.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-delete.Tpo src/$(DEPDIR)/crun-delete.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/delete.c' object='src/crun-delete.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-delete.o `test -f 'src/delete.c' || echo '$(srcdir)/'`src/delete.c src/crun-delete.obj: src/delete.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-delete.obj -MD -MP -MF src/$(DEPDIR)/crun-delete.Tpo -c -o src/crun-delete.obj `if test -f 'src/delete.c'; then $(CYGPATH_W) 'src/delete.c'; else $(CYGPATH_W) '$(srcdir)/src/delete.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-delete.Tpo src/$(DEPDIR)/crun-delete.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/delete.c' object='src/crun-delete.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-delete.obj `if test -f 'src/delete.c'; then $(CYGPATH_W) 'src/delete.c'; else $(CYGPATH_W) '$(srcdir)/src/delete.c'; fi` src/crun-kill.o: src/kill.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-kill.o -MD -MP -MF src/$(DEPDIR)/crun-kill.Tpo -c -o src/crun-kill.o `test -f 'src/kill.c' || echo '$(srcdir)/'`src/kill.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-kill.Tpo src/$(DEPDIR)/crun-kill.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/kill.c' object='src/crun-kill.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-kill.o `test -f 'src/kill.c' || echo '$(srcdir)/'`src/kill.c src/crun-kill.obj: src/kill.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-kill.obj -MD -MP -MF src/$(DEPDIR)/crun-kill.Tpo -c -o src/crun-kill.obj `if test -f 'src/kill.c'; then $(CYGPATH_W) 'src/kill.c'; else $(CYGPATH_W) '$(srcdir)/src/kill.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-kill.Tpo src/$(DEPDIR)/crun-kill.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/kill.c' object='src/crun-kill.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-kill.obj `if test -f 'src/kill.c'; then $(CYGPATH_W) 'src/kill.c'; else $(CYGPATH_W) '$(srcdir)/src/kill.c'; fi` src/crun-pause.o: src/pause.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-pause.o -MD -MP -MF src/$(DEPDIR)/crun-pause.Tpo -c -o src/crun-pause.o `test -f 'src/pause.c' || echo '$(srcdir)/'`src/pause.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-pause.Tpo src/$(DEPDIR)/crun-pause.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/pause.c' object='src/crun-pause.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-pause.o `test -f 'src/pause.c' || echo '$(srcdir)/'`src/pause.c src/crun-pause.obj: src/pause.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-pause.obj -MD -MP -MF src/$(DEPDIR)/crun-pause.Tpo -c -o src/crun-pause.obj `if test -f 'src/pause.c'; then $(CYGPATH_W) 'src/pause.c'; else $(CYGPATH_W) '$(srcdir)/src/pause.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-pause.Tpo src/$(DEPDIR)/crun-pause.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/pause.c' object='src/crun-pause.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-pause.obj `if test -f 'src/pause.c'; then $(CYGPATH_W) 'src/pause.c'; else $(CYGPATH_W) '$(srcdir)/src/pause.c'; fi` src/crun-unpause.o: src/unpause.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-unpause.o -MD -MP -MF src/$(DEPDIR)/crun-unpause.Tpo -c -o src/crun-unpause.o `test -f 'src/unpause.c' || echo '$(srcdir)/'`src/unpause.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-unpause.Tpo src/$(DEPDIR)/crun-unpause.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/unpause.c' object='src/crun-unpause.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-unpause.o `test -f 'src/unpause.c' || echo '$(srcdir)/'`src/unpause.c src/crun-unpause.obj: src/unpause.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-unpause.obj -MD -MP -MF src/$(DEPDIR)/crun-unpause.Tpo -c -o src/crun-unpause.obj `if test -f 'src/unpause.c'; then $(CYGPATH_W) 'src/unpause.c'; else $(CYGPATH_W) '$(srcdir)/src/unpause.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-unpause.Tpo src/$(DEPDIR)/crun-unpause.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/unpause.c' object='src/crun-unpause.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-unpause.obj `if test -f 'src/unpause.c'; then $(CYGPATH_W) 'src/unpause.c'; else $(CYGPATH_W) '$(srcdir)/src/unpause.c'; fi` src/crun-oci_features.o: src/oci_features.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-oci_features.o -MD -MP -MF src/$(DEPDIR)/crun-oci_features.Tpo -c -o src/crun-oci_features.o `test -f 'src/oci_features.c' || echo '$(srcdir)/'`src/oci_features.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-oci_features.Tpo src/$(DEPDIR)/crun-oci_features.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/oci_features.c' object='src/crun-oci_features.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-oci_features.o `test -f 'src/oci_features.c' || echo '$(srcdir)/'`src/oci_features.c src/crun-oci_features.obj: src/oci_features.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-oci_features.obj -MD -MP -MF src/$(DEPDIR)/crun-oci_features.Tpo -c -o src/crun-oci_features.obj `if test -f 'src/oci_features.c'; then $(CYGPATH_W) 'src/oci_features.c'; else $(CYGPATH_W) '$(srcdir)/src/oci_features.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-oci_features.Tpo src/$(DEPDIR)/crun-oci_features.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/oci_features.c' object='src/crun-oci_features.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-oci_features.obj `if test -f 'src/oci_features.c'; then $(CYGPATH_W) 'src/oci_features.c'; else $(CYGPATH_W) '$(srcdir)/src/oci_features.c'; fi` src/crun-spec.o: src/spec.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-spec.o -MD -MP -MF src/$(DEPDIR)/crun-spec.Tpo -c -o src/crun-spec.o `test -f 'src/spec.c' || echo '$(srcdir)/'`src/spec.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-spec.Tpo src/$(DEPDIR)/crun-spec.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/spec.c' object='src/crun-spec.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-spec.o `test -f 'src/spec.c' || echo '$(srcdir)/'`src/spec.c src/crun-spec.obj: src/spec.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-spec.obj -MD -MP -MF src/$(DEPDIR)/crun-spec.Tpo -c -o src/crun-spec.obj `if test -f 'src/spec.c'; then $(CYGPATH_W) 'src/spec.c'; else $(CYGPATH_W) '$(srcdir)/src/spec.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-spec.Tpo src/$(DEPDIR)/crun-spec.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/spec.c' object='src/crun-spec.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-spec.obj `if test -f 'src/spec.c'; then $(CYGPATH_W) 'src/spec.c'; else $(CYGPATH_W) '$(srcdir)/src/spec.c'; fi` src/crun-exec.o: src/exec.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-exec.o -MD -MP -MF src/$(DEPDIR)/crun-exec.Tpo -c -o src/crun-exec.o `test -f 'src/exec.c' || echo '$(srcdir)/'`src/exec.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-exec.Tpo src/$(DEPDIR)/crun-exec.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/exec.c' object='src/crun-exec.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-exec.o `test -f 'src/exec.c' || echo '$(srcdir)/'`src/exec.c src/crun-exec.obj: src/exec.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-exec.obj -MD -MP -MF src/$(DEPDIR)/crun-exec.Tpo -c -o src/crun-exec.obj `if test -f 'src/exec.c'; then $(CYGPATH_W) 'src/exec.c'; else $(CYGPATH_W) '$(srcdir)/src/exec.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-exec.Tpo src/$(DEPDIR)/crun-exec.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/exec.c' object='src/crun-exec.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-exec.obj `if test -f 'src/exec.c'; then $(CYGPATH_W) 'src/exec.c'; else $(CYGPATH_W) '$(srcdir)/src/exec.c'; fi` src/crun-list.o: src/list.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-list.o -MD -MP -MF src/$(DEPDIR)/crun-list.Tpo -c -o src/crun-list.o `test -f 'src/list.c' || echo '$(srcdir)/'`src/list.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-list.Tpo src/$(DEPDIR)/crun-list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/list.c' object='src/crun-list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-list.o `test -f 'src/list.c' || echo '$(srcdir)/'`src/list.c src/crun-list.obj: src/list.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-list.obj -MD -MP -MF src/$(DEPDIR)/crun-list.Tpo -c -o src/crun-list.obj `if test -f 'src/list.c'; then $(CYGPATH_W) 'src/list.c'; else $(CYGPATH_W) '$(srcdir)/src/list.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-list.Tpo src/$(DEPDIR)/crun-list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/list.c' object='src/crun-list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-list.obj `if test -f 'src/list.c'; then $(CYGPATH_W) 'src/list.c'; else $(CYGPATH_W) '$(srcdir)/src/list.c'; fi` src/crun-create.o: src/create.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-create.o -MD -MP -MF src/$(DEPDIR)/crun-create.Tpo -c -o src/crun-create.o `test -f 'src/create.c' || echo '$(srcdir)/'`src/create.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-create.Tpo src/$(DEPDIR)/crun-create.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/create.c' object='src/crun-create.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-create.o `test -f 'src/create.c' || echo '$(srcdir)/'`src/create.c src/crun-create.obj: src/create.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-create.obj -MD -MP -MF src/$(DEPDIR)/crun-create.Tpo -c -o src/crun-create.obj `if test -f 'src/create.c'; then $(CYGPATH_W) 'src/create.c'; else $(CYGPATH_W) '$(srcdir)/src/create.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-create.Tpo src/$(DEPDIR)/crun-create.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/create.c' object='src/crun-create.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-create.obj `if test -f 'src/create.c'; then $(CYGPATH_W) 'src/create.c'; else $(CYGPATH_W) '$(srcdir)/src/create.c'; fi` src/crun-start.o: src/start.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-start.o -MD -MP -MF src/$(DEPDIR)/crun-start.Tpo -c -o src/crun-start.o `test -f 'src/start.c' || echo '$(srcdir)/'`src/start.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-start.Tpo src/$(DEPDIR)/crun-start.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/start.c' object='src/crun-start.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-start.o `test -f 'src/start.c' || echo '$(srcdir)/'`src/start.c src/crun-start.obj: src/start.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-start.obj -MD -MP -MF src/$(DEPDIR)/crun-start.Tpo -c -o src/crun-start.obj `if test -f 'src/start.c'; then $(CYGPATH_W) 'src/start.c'; else $(CYGPATH_W) '$(srcdir)/src/start.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-start.Tpo src/$(DEPDIR)/crun-start.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/start.c' object='src/crun-start.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-start.obj `if test -f 'src/start.c'; then $(CYGPATH_W) 'src/start.c'; else $(CYGPATH_W) '$(srcdir)/src/start.c'; fi` src/crun-state.o: src/state.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-state.o -MD -MP -MF src/$(DEPDIR)/crun-state.Tpo -c -o src/crun-state.o `test -f 'src/state.c' || echo '$(srcdir)/'`src/state.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-state.Tpo src/$(DEPDIR)/crun-state.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/state.c' object='src/crun-state.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-state.o `test -f 'src/state.c' || echo '$(srcdir)/'`src/state.c src/crun-state.obj: src/state.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-state.obj -MD -MP -MF src/$(DEPDIR)/crun-state.Tpo -c -o src/crun-state.obj `if test -f 'src/state.c'; then $(CYGPATH_W) 'src/state.c'; else $(CYGPATH_W) '$(srcdir)/src/state.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-state.Tpo src/$(DEPDIR)/crun-state.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/state.c' object='src/crun-state.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-state.obj `if test -f 'src/state.c'; then $(CYGPATH_W) 'src/state.c'; else $(CYGPATH_W) '$(srcdir)/src/state.c'; fi` src/crun-update.o: src/update.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-update.o -MD -MP -MF src/$(DEPDIR)/crun-update.Tpo -c -o src/crun-update.o `test -f 'src/update.c' || echo '$(srcdir)/'`src/update.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-update.Tpo src/$(DEPDIR)/crun-update.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/update.c' object='src/crun-update.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-update.o `test -f 'src/update.c' || echo '$(srcdir)/'`src/update.c src/crun-update.obj: src/update.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-update.obj -MD -MP -MF src/$(DEPDIR)/crun-update.Tpo -c -o src/crun-update.obj `if test -f 'src/update.c'; then $(CYGPATH_W) 'src/update.c'; else $(CYGPATH_W) '$(srcdir)/src/update.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-update.Tpo src/$(DEPDIR)/crun-update.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/update.c' object='src/crun-update.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-update.obj `if test -f 'src/update.c'; then $(CYGPATH_W) 'src/update.c'; else $(CYGPATH_W) '$(srcdir)/src/update.c'; fi` src/crun-ps.o: src/ps.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-ps.o -MD -MP -MF src/$(DEPDIR)/crun-ps.Tpo -c -o src/crun-ps.o `test -f 'src/ps.c' || echo '$(srcdir)/'`src/ps.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-ps.Tpo src/$(DEPDIR)/crun-ps.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/ps.c' object='src/crun-ps.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-ps.o `test -f 'src/ps.c' || echo '$(srcdir)/'`src/ps.c src/crun-ps.obj: src/ps.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-ps.obj -MD -MP -MF src/$(DEPDIR)/crun-ps.Tpo -c -o src/crun-ps.obj `if test -f 'src/ps.c'; then $(CYGPATH_W) 'src/ps.c'; else $(CYGPATH_W) '$(srcdir)/src/ps.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-ps.Tpo src/$(DEPDIR)/crun-ps.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/ps.c' object='src/crun-ps.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-ps.obj `if test -f 'src/ps.c'; then $(CYGPATH_W) 'src/ps.c'; else $(CYGPATH_W) '$(srcdir)/src/ps.c'; fi` src/crun-checkpoint.o: src/checkpoint.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-checkpoint.o -MD -MP -MF src/$(DEPDIR)/crun-checkpoint.Tpo -c -o src/crun-checkpoint.o `test -f 'src/checkpoint.c' || echo '$(srcdir)/'`src/checkpoint.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-checkpoint.Tpo src/$(DEPDIR)/crun-checkpoint.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/checkpoint.c' object='src/crun-checkpoint.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-checkpoint.o `test -f 'src/checkpoint.c' || echo '$(srcdir)/'`src/checkpoint.c src/crun-checkpoint.obj: src/checkpoint.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-checkpoint.obj -MD -MP -MF src/$(DEPDIR)/crun-checkpoint.Tpo -c -o src/crun-checkpoint.obj `if test -f 'src/checkpoint.c'; then $(CYGPATH_W) 'src/checkpoint.c'; else $(CYGPATH_W) '$(srcdir)/src/checkpoint.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-checkpoint.Tpo src/$(DEPDIR)/crun-checkpoint.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/checkpoint.c' object='src/crun-checkpoint.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-checkpoint.obj `if test -f 'src/checkpoint.c'; then $(CYGPATH_W) 'src/checkpoint.c'; else $(CYGPATH_W) '$(srcdir)/src/checkpoint.c'; fi` src/crun-restore.o: src/restore.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-restore.o -MD -MP -MF src/$(DEPDIR)/crun-restore.Tpo -c -o src/crun-restore.o `test -f 'src/restore.c' || echo '$(srcdir)/'`src/restore.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-restore.Tpo src/$(DEPDIR)/crun-restore.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/restore.c' object='src/crun-restore.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-restore.o `test -f 'src/restore.c' || echo '$(srcdir)/'`src/restore.c src/crun-restore.obj: src/restore.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/crun-restore.obj -MD -MP -MF src/$(DEPDIR)/crun-restore.Tpo -c -o src/crun-restore.obj `if test -f 'src/restore.c'; then $(CYGPATH_W) 'src/restore.c'; else $(CYGPATH_W) '$(srcdir)/src/restore.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/crun-restore.Tpo src/$(DEPDIR)/crun-restore.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/restore.c' object='src/crun-restore.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/crun-restore.obj `if test -f 'src/restore.c'; then $(CYGPATH_W) 'src/restore.c'; else $(CYGPATH_W) '$(srcdir)/src/restore.c'; fi` src/libcrun/crun-cloned_binary.o: src/libcrun/cloned_binary.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/libcrun/crun-cloned_binary.o -MD -MP -MF src/libcrun/$(DEPDIR)/crun-cloned_binary.Tpo -c -o src/libcrun/crun-cloned_binary.o `test -f 'src/libcrun/cloned_binary.c' || echo '$(srcdir)/'`src/libcrun/cloned_binary.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/crun-cloned_binary.Tpo src/libcrun/$(DEPDIR)/crun-cloned_binary.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cloned_binary.c' object='src/libcrun/crun-cloned_binary.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/libcrun/crun-cloned_binary.o `test -f 'src/libcrun/cloned_binary.c' || echo '$(srcdir)/'`src/libcrun/cloned_binary.c src/libcrun/crun-cloned_binary.obj: src/libcrun/cloned_binary.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -MT src/libcrun/crun-cloned_binary.obj -MD -MP -MF src/libcrun/$(DEPDIR)/crun-cloned_binary.Tpo -c -o src/libcrun/crun-cloned_binary.obj `if test -f 'src/libcrun/cloned_binary.c'; then $(CYGPATH_W) 'src/libcrun/cloned_binary.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cloned_binary.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libcrun/$(DEPDIR)/crun-cloned_binary.Tpo src/libcrun/$(DEPDIR)/crun-cloned_binary.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libcrun/cloned_binary.c' object='src/libcrun/crun-cloned_binary.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crun_CFLAGS) $(CFLAGS) -c -o src/libcrun/crun-cloned_binary.obj `if test -f 'src/libcrun/cloned_binary.c'; then $(CYGPATH_W) 'src/libcrun/cloned_binary.c'; else $(CYGPATH_W) '$(srcdir)/src/libcrun/cloned_binary.c'; fi` tests/tests_libcrun_errors-tests_libcrun_errors.o: tests/tests_libcrun_errors.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_errors_CFLAGS) $(CFLAGS) -MT tests/tests_libcrun_errors-tests_libcrun_errors.o -MD -MP -MF tests/$(DEPDIR)/tests_libcrun_errors-tests_libcrun_errors.Tpo -c -o tests/tests_libcrun_errors-tests_libcrun_errors.o `test -f 'tests/tests_libcrun_errors.c' || echo '$(srcdir)/'`tests/tests_libcrun_errors.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_libcrun_errors-tests_libcrun_errors.Tpo tests/$(DEPDIR)/tests_libcrun_errors-tests_libcrun_errors.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/tests_libcrun_errors.c' object='tests/tests_libcrun_errors-tests_libcrun_errors.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_errors_CFLAGS) $(CFLAGS) -c -o tests/tests_libcrun_errors-tests_libcrun_errors.o `test -f 'tests/tests_libcrun_errors.c' || echo '$(srcdir)/'`tests/tests_libcrun_errors.c tests/tests_libcrun_errors-tests_libcrun_errors.obj: tests/tests_libcrun_errors.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_errors_CFLAGS) $(CFLAGS) -MT tests/tests_libcrun_errors-tests_libcrun_errors.obj -MD -MP -MF tests/$(DEPDIR)/tests_libcrun_errors-tests_libcrun_errors.Tpo -c -o tests/tests_libcrun_errors-tests_libcrun_errors.obj `if test -f 'tests/tests_libcrun_errors.c'; then $(CYGPATH_W) 'tests/tests_libcrun_errors.c'; else $(CYGPATH_W) '$(srcdir)/tests/tests_libcrun_errors.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_libcrun_errors-tests_libcrun_errors.Tpo tests/$(DEPDIR)/tests_libcrun_errors-tests_libcrun_errors.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/tests_libcrun_errors.c' object='tests/tests_libcrun_errors-tests_libcrun_errors.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_errors_CFLAGS) $(CFLAGS) -c -o tests/tests_libcrun_errors-tests_libcrun_errors.obj `if test -f 'tests/tests_libcrun_errors.c'; then $(CYGPATH_W) 'tests/tests_libcrun_errors.c'; else $(CYGPATH_W) '$(srcdir)/tests/tests_libcrun_errors.c'; fi` tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.o: tests/tests_libcrun_fuzzer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_fuzzer_CFLAGS) $(CFLAGS) -MT tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.o -MD -MP -MF tests/$(DEPDIR)/tests_libcrun_fuzzer-tests_libcrun_fuzzer.Tpo -c -o tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.o `test -f 'tests/tests_libcrun_fuzzer.c' || echo '$(srcdir)/'`tests/tests_libcrun_fuzzer.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_libcrun_fuzzer-tests_libcrun_fuzzer.Tpo tests/$(DEPDIR)/tests_libcrun_fuzzer-tests_libcrun_fuzzer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/tests_libcrun_fuzzer.c' object='tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_fuzzer_CFLAGS) $(CFLAGS) -c -o tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.o `test -f 'tests/tests_libcrun_fuzzer.c' || echo '$(srcdir)/'`tests/tests_libcrun_fuzzer.c tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.obj: tests/tests_libcrun_fuzzer.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_fuzzer_CFLAGS) $(CFLAGS) -MT tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.obj -MD -MP -MF tests/$(DEPDIR)/tests_libcrun_fuzzer-tests_libcrun_fuzzer.Tpo -c -o tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.obj `if test -f 'tests/tests_libcrun_fuzzer.c'; then $(CYGPATH_W) 'tests/tests_libcrun_fuzzer.c'; else $(CYGPATH_W) '$(srcdir)/tests/tests_libcrun_fuzzer.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_libcrun_fuzzer-tests_libcrun_fuzzer.Tpo tests/$(DEPDIR)/tests_libcrun_fuzzer-tests_libcrun_fuzzer.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/tests_libcrun_fuzzer.c' object='tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_fuzzer_CFLAGS) $(CFLAGS) -c -o tests/tests_libcrun_fuzzer-tests_libcrun_fuzzer.obj `if test -f 'tests/tests_libcrun_fuzzer.c'; then $(CYGPATH_W) 'tests/tests_libcrun_fuzzer.c'; else $(CYGPATH_W) '$(srcdir)/tests/tests_libcrun_fuzzer.c'; fi` tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.o: tests/tests_libcrun_intelrdt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_intelrdt_CFLAGS) $(CFLAGS) -MT tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.o -MD -MP -MF tests/$(DEPDIR)/tests_libcrun_intelrdt-tests_libcrun_intelrdt.Tpo -c -o tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.o `test -f 'tests/tests_libcrun_intelrdt.c' || echo '$(srcdir)/'`tests/tests_libcrun_intelrdt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_libcrun_intelrdt-tests_libcrun_intelrdt.Tpo tests/$(DEPDIR)/tests_libcrun_intelrdt-tests_libcrun_intelrdt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/tests_libcrun_intelrdt.c' object='tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_intelrdt_CFLAGS) $(CFLAGS) -c -o tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.o `test -f 'tests/tests_libcrun_intelrdt.c' || echo '$(srcdir)/'`tests/tests_libcrun_intelrdt.c tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.obj: tests/tests_libcrun_intelrdt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_intelrdt_CFLAGS) $(CFLAGS) -MT tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.obj -MD -MP -MF tests/$(DEPDIR)/tests_libcrun_intelrdt-tests_libcrun_intelrdt.Tpo -c -o tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.obj `if test -f 'tests/tests_libcrun_intelrdt.c'; then $(CYGPATH_W) 'tests/tests_libcrun_intelrdt.c'; else $(CYGPATH_W) '$(srcdir)/tests/tests_libcrun_intelrdt.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_libcrun_intelrdt-tests_libcrun_intelrdt.Tpo tests/$(DEPDIR)/tests_libcrun_intelrdt-tests_libcrun_intelrdt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/tests_libcrun_intelrdt.c' object='tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_intelrdt_CFLAGS) $(CFLAGS) -c -o tests/tests_libcrun_intelrdt-tests_libcrun_intelrdt.obj `if test -f 'tests/tests_libcrun_intelrdt.c'; then $(CYGPATH_W) 'tests/tests_libcrun_intelrdt.c'; else $(CYGPATH_W) '$(srcdir)/tests/tests_libcrun_intelrdt.c'; fi` tests/tests_libcrun_utils-tests_libcrun_utils.o: tests/tests_libcrun_utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_utils_CFLAGS) $(CFLAGS) -MT tests/tests_libcrun_utils-tests_libcrun_utils.o -MD -MP -MF tests/$(DEPDIR)/tests_libcrun_utils-tests_libcrun_utils.Tpo -c -o tests/tests_libcrun_utils-tests_libcrun_utils.o `test -f 'tests/tests_libcrun_utils.c' || echo '$(srcdir)/'`tests/tests_libcrun_utils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_libcrun_utils-tests_libcrun_utils.Tpo tests/$(DEPDIR)/tests_libcrun_utils-tests_libcrun_utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/tests_libcrun_utils.c' object='tests/tests_libcrun_utils-tests_libcrun_utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_utils_CFLAGS) $(CFLAGS) -c -o tests/tests_libcrun_utils-tests_libcrun_utils.o `test -f 'tests/tests_libcrun_utils.c' || echo '$(srcdir)/'`tests/tests_libcrun_utils.c tests/tests_libcrun_utils-tests_libcrun_utils.obj: tests/tests_libcrun_utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_utils_CFLAGS) $(CFLAGS) -MT tests/tests_libcrun_utils-tests_libcrun_utils.obj -MD -MP -MF tests/$(DEPDIR)/tests_libcrun_utils-tests_libcrun_utils.Tpo -c -o tests/tests_libcrun_utils-tests_libcrun_utils.obj `if test -f 'tests/tests_libcrun_utils.c'; then $(CYGPATH_W) 'tests/tests_libcrun_utils.c'; else $(CYGPATH_W) '$(srcdir)/tests/tests_libcrun_utils.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_libcrun_utils-tests_libcrun_utils.Tpo tests/$(DEPDIR)/tests_libcrun_utils-tests_libcrun_utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/tests_libcrun_utils.c' object='tests/tests_libcrun_utils-tests_libcrun_utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_tests_libcrun_utils_CFLAGS) $(CFLAGS) -c -o tests/tests_libcrun_utils-tests_libcrun_utils.obj `if test -f 'tests/tests_libcrun_utils.c'; then $(CYGPATH_W) 'tests/tests_libcrun_utils.c'; else $(CYGPATH_W) '$(srcdir)/tests/tests_libcrun_utils.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf lua/.libs lua/_libs -rm -rf python/.libs python/_libs -rm -rf src/libcrun/.libs src/libcrun/_libs -rm -rf src/libcrun/blake3/.libs src/libcrun/blake3/_libs -rm -rf src/libcrun/handlers/.libs src/libcrun/handlers/_libs -rm -rf tests/.libs tests/_libs distclean-libtool: -rm -f libtool config.lt 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) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_LIBRARIES) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_LIBRARIES) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? tests/tests_libcrun_utils.log: tests/tests_libcrun_utils$(EXEEXT) @p='tests/tests_libcrun_utils$(EXEEXT)'; \ b='tests/tests_libcrun_utils'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/tests_libcrun_errors.log: tests/tests_libcrun_errors$(EXEEXT) @p='tests/tests_libcrun_errors$(EXEEXT)'; \ b='tests/tests_libcrun_errors'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/tests_libcrun_intelrdt.log: tests/tests_libcrun_intelrdt$(EXEEXT) @p='tests/tests_libcrun_intelrdt$(EXEEXT)'; \ b='tests/tests_libcrun_intelrdt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .py.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(PY_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_PY_LOG_DRIVER_FLAGS) $(PY_LOG_DRIVER_FLAGS) -- $(PY_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.py$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(PY_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_PY_LOG_DRIVER_FLAGS) $(PY_LOG_DRIVER_FLAGS) -- $(PY_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -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) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_LIBRARIES) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(MANS) config.h install-binPROGRAMS: install-libLTLIBRARIES installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(luaexecdir)" "$(DESTDIR)$(pyexecdir)" "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) 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: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -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) -rm -f lua/$(DEPDIR)/$(am__dirstamp) -rm -f lua/$(am__dirstamp) -rm -f python/$(DEPDIR)/$(am__dirstamp) -rm -f python/$(am__dirstamp) -rm -f src/$(DEPDIR)/$(am__dirstamp) -rm -f src/$(am__dirstamp) -rm -f src/libcrun/$(DEPDIR)/$(am__dirstamp) -rm -f src/libcrun/$(am__dirstamp) -rm -f src/libcrun/blake3/$(DEPDIR)/$(am__dirstamp) -rm -f src/libcrun/blake3/$(am__dirstamp) -rm -f src/libcrun/handlers/$(DEPDIR)/$(am__dirstamp) -rm -f src/libcrun/handlers/$(am__dirstamp) -rm -f tests/$(DEPDIR)/$(am__dirstamp) -rm -f tests/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive clean-am: clean-binPROGRAMS clean-checkLIBRARIES clean-generic \ clean-libLTLIBRARIES clean-libtool clean-luaexecLTLIBRARIES \ clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ clean-pyexecLTLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f lua/$(DEPDIR)/luacrun_la-lua_crun.Plo -rm -f python/$(DEPDIR)/crun_la-crun_python.Plo -rm -f src/$(DEPDIR)/crun-checkpoint.Po -rm -f src/$(DEPDIR)/crun-create.Po -rm -f src/$(DEPDIR)/crun-crun.Po -rm -f src/$(DEPDIR)/crun-delete.Po -rm -f src/$(DEPDIR)/crun-exec.Po -rm -f src/$(DEPDIR)/crun-kill.Po -rm -f src/$(DEPDIR)/crun-list.Po -rm -f src/$(DEPDIR)/crun-oci_features.Po -rm -f src/$(DEPDIR)/crun-pause.Po -rm -f src/$(DEPDIR)/crun-ps.Po -rm -f src/$(DEPDIR)/crun-restore.Po -rm -f src/$(DEPDIR)/crun-run.Po -rm -f src/$(DEPDIR)/crun-spec.Po -rm -f src/$(DEPDIR)/crun-start.Po -rm -f src/$(DEPDIR)/crun-state.Po -rm -f src/$(DEPDIR)/crun-unpause.Po -rm -f src/$(DEPDIR)/crun-update.Po -rm -f src/libcrun/$(DEPDIR)/crun-cloned_binary.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup-cgroupfs.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup-resources.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup-setup.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup-systemd.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup-utils.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-chroot_realpath.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cloned_binary.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-container.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-criu.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-custom-handler.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-ebpf.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-error.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-intelrdt.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-io_priority.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-linux.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-mount_flags.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-scheduler.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-seccomp.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-seccomp_notify.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-signals.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-status.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-terminal.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-utils.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-cgroupfs.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-resources.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-setup.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-systemd.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-utils.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-chroot_realpath.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cloned_binary.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-container.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-criu.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-custom-handler.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-ebpf.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-error.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-intelrdt.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-io_priority.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-linux.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-mount_flags.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-scheduler.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp_notify.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-signals.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-status.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-terminal.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-utils.Po -rm -f src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3.Plo -rm -f src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3_portable.Plo -rm -f src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3.Po -rm -f src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3_portable.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-handler-utils.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-krun.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-mono.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-spin.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmedge.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmer.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmtime.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-handler-utils.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-krun.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-mono.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-spin.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmedge.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmer.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmtime.Po -rm -f tests/$(DEPDIR)/init.Po -rm -f tests/$(DEPDIR)/tests_libcrun_errors-tests_libcrun_errors.Po -rm -f tests/$(DEPDIR)/tests_libcrun_fuzzer-tests_libcrun_fuzzer.Po -rm -f tests/$(DEPDIR)/tests_libcrun_intelrdt-tests_libcrun_intelrdt.Po -rm -f tests/$(DEPDIR)/tests_libcrun_utils-tests_libcrun_utils.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-man install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-libLTLIBRARIES \ install-luaexecLTLIBRARIES install-pyexecLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man1 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 lua/$(DEPDIR)/luacrun_la-lua_crun.Plo -rm -f python/$(DEPDIR)/crun_la-crun_python.Plo -rm -f src/$(DEPDIR)/crun-checkpoint.Po -rm -f src/$(DEPDIR)/crun-create.Po -rm -f src/$(DEPDIR)/crun-crun.Po -rm -f src/$(DEPDIR)/crun-delete.Po -rm -f src/$(DEPDIR)/crun-exec.Po -rm -f src/$(DEPDIR)/crun-kill.Po -rm -f src/$(DEPDIR)/crun-list.Po -rm -f src/$(DEPDIR)/crun-oci_features.Po -rm -f src/$(DEPDIR)/crun-pause.Po -rm -f src/$(DEPDIR)/crun-ps.Po -rm -f src/$(DEPDIR)/crun-restore.Po -rm -f src/$(DEPDIR)/crun-run.Po -rm -f src/$(DEPDIR)/crun-spec.Po -rm -f src/$(DEPDIR)/crun-start.Po -rm -f src/$(DEPDIR)/crun-state.Po -rm -f src/$(DEPDIR)/crun-unpause.Po -rm -f src/$(DEPDIR)/crun-update.Po -rm -f src/libcrun/$(DEPDIR)/crun-cloned_binary.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup-cgroupfs.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup-resources.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup-setup.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup-systemd.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup-utils.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cgroup.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-chroot_realpath.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-cloned_binary.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-container.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-criu.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-custom-handler.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-ebpf.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-error.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-intelrdt.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-io_priority.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-linux.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-mount_flags.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-scheduler.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-seccomp.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-seccomp_notify.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-signals.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-status.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-terminal.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_la-utils.Plo -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-cgroupfs.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-resources.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-setup.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-systemd.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup-utils.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cgroup.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-chroot_realpath.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-cloned_binary.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-container.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-criu.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-custom-handler.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-ebpf.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-error.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-intelrdt.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-io_priority.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-linux.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-mount_flags.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-scheduler.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-seccomp_notify.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-signals.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-status.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-terminal.Po -rm -f src/libcrun/$(DEPDIR)/libcrun_testing_a-utils.Po -rm -f src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3.Plo -rm -f src/libcrun/blake3/$(DEPDIR)/libcrun_la-blake3_portable.Plo -rm -f src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3.Po -rm -f src/libcrun/blake3/$(DEPDIR)/libcrun_testing_a-blake3_portable.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-handler-utils.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-krun.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-mono.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-spin.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmedge.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmer.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_la-wasmtime.Plo -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-handler-utils.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-krun.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-mono.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-spin.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmedge.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmer.Po -rm -f src/libcrun/handlers/$(DEPDIR)/libcrun_testing_a-wasmtime.Po -rm -f tests/$(DEPDIR)/init.Po -rm -f tests/$(DEPDIR)/tests_libcrun_errors-tests_libcrun_errors.Po -rm -f tests/$(DEPDIR)/tests_libcrun_fuzzer-tests_libcrun_fuzzer.Po -rm -f tests/$(DEPDIR)/tests_libcrun_intelrdt-tests_libcrun_intelrdt.Po -rm -f tests/$(DEPDIR)/tests_libcrun_utils-tests_libcrun_utils.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \ uninstall-luaexecLTLIBRARIES uninstall-man \ uninstall-pyexecLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook uninstall-man: uninstall-man1 .MAKE: $(am__recursive_targets) all check check-am install install-am \ install-exec-am install-strip uninstall-am .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles am--refresh check check-TESTS check-am clean \ clean-binPROGRAMS clean-checkLIBRARIES clean-cscope \ clean-generic clean-libLTLIBRARIES clean-libtool \ clean-luaexecLTLIBRARIES clean-noinstLTLIBRARIES \ clean-noinstPROGRAMS clean-pyexecLTLIBRARIES cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ dist-zip dist-zstd distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-exec-hook \ install-html install-html-am install-info install-info-am \ install-libLTLIBRARIES install-luaexecLTLIBRARIES install-man \ install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-pyexecLTLIBRARIES install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am recheck tags tags-am uninstall \ uninstall-am uninstall-binPROGRAMS uninstall-hook \ uninstall-libLTLIBRARIES uninstall-luaexecLTLIBRARIES \ uninstall-man uninstall-man1 uninstall-pyexecLTLIBRARIES .PRECIOUS: Makefile # outdir is needed by the make_srpm build type on Fedora copr # https://docs.pagure.org/copr.copr/user_documentation.html#make-srpm outdir ?= $(WD) RPM_OPTS ?= --define "_sourcedir $(WD)" --define "_specdir $(WD)" --define "_builddir $(WD)" --define "_srcrpmdir $(outdir)" --define "_rpmdir $(outdir)" --define "_buildrootdir $(WD)/.build" rpm/crun.spec # Clean any safe.directory values added to global gitconfig because of srpm and # rpm target runs clean-global-gitconfig: $(shell git config --global --unset-all safe.directory $(shell pwd)/libocispec) $(shell git config --global --unset-all safe.directory $(shell pwd)/rpm) $(shell git config --global --unset-all safe.directory /crun) srpm: echo $(VERSION) $(MAKE) -C rpm tarball-prep rpmbuild -bs $(RPM_OPTS) rpm/crun.spec $(MAKE) clean-global-gitconfig rpm: srpm rpmbuild -ba $(RPM_OPTS) rpm/crun.spec $(MAKE) clean-global-gitconfig libocispec/libocispec.la: $(MAKE) $(AM_MAKEFLAGS) -C libocispec libocispec.la @LUA_BINDINGS_TRUE@$(LUACRUN_ROCKSPEC): lua/luacrun.rockspec @LUA_BINDINGS_TRUE@ sed -e 's/@RELEASEVERSION/$(LUACRUN_RELEASE_VERSION)/g' < lua/luacrun.rockspec | \ @LUA_BINDINGS_TRUE@ sed -e 's/@CLEANVERSION/$(LUACRUN_CLEAN_VERSION)/g' > $@ @LUA_BINDINGS_TRUE@$(LUACRUN_ROCK): dist-gzip $(LUACRUN_ROCKSPEC) @LUA_BINDINGS_TRUE@ rm -f $(LUACRUN_ROCK) @LUA_BINDINGS_TRUE@ mv "$(distdir).tar.gz" "crun-$(LUACRUN_RELEASE_VERSION).tar.gz" @LUA_BINDINGS_TRUE@ tar -xzf "crun-$(LUACRUN_RELEASE_VERSION).tar.gz" --transform="s/crun-$(VERSION)\(.*\)$$/crun-$(LUACRUN_RELEASE_VERSION)\1/" @LUA_BINDINGS_TRUE@ tar -czf "crun-$(LUACRUN_RELEASE_VERSION).tar.gz" "crun-$(LUACRUN_RELEASE_VERSION)" @LUA_BINDINGS_TRUE@ rm -rf "crun-$(LUACRUN_RELEASE_VERSION)" @LUA_BINDINGS_TRUE@ zip -j $(LUACRUN_ROCK) $(LUACRUN_ROCKSPEC) "crun-$(LUACRUN_RELEASE_VERSION).tar.gz" @LUA_BINDINGS_TRUE@ rm -f "crun-$(LUACRUN_RELEASE_VERSION).tar.gz" @LUA_BINDINGS_TRUE@dist-luarock: $(LUACRUN_ROCK) .version: $(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@ git-version.h: @if test -e $(abs_top_srcdir)/.tarball-git-version.h; then \ cp $(abs_top_srcdir)/.tarball-git-version.h $@; \ elif test -e $(abs_top_srcdir)/.git; then \ version=`$(AM__GEN)git --git-dir=$(abs_top_srcdir)/.git rev-parse HEAD`; \ $(AM__GEN)printf "/* autogenerated. */\n#ifndef GIT_VERSION\n# define GIT_VERSION \"%s\"\n#endif\n" $$version > $@-t && mv $@-t $@; \ fi nixpkgs: @nix run -f channel:nixpkgs-unstable nix-prefetch-git -- \ --no-deepClone https://github.com/nixos/nixpkgs > nix/nixpkgs.json dist-hook: $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version $(AM__GEN)cp git-version.h $(distdir)/.tarball-git-version.h crun.1: $(abs_srcdir)/crun.1.md @HAVE_MD2MAN_TRUE@ $(MD2MAN) -in $(abs_srcdir)/crun.1.md -out crun.1 krun.1: $(abs_srcdir)/krun.1.md @HAVE_MD2MAN_TRUE@ $(MD2MAN) -in $(abs_srcdir)/krun.1.md -out krun.1 install-exec-hook: @ENABLE_KRUN_TRUE@ $(LN_S) crun$(EXEEXT) $(DESTDIR)$(bindir)/krun$(EXEEXT) @ENABLE_WASM_TRUE@ $(LN_S) crun$(EXEEXT) $(DESTDIR)$(bindir)/crun-wasm$(EXEEXT) uninstall-hook: @ENABLE_KRUN_TRUE@ rm -f $(DESTDIR)$(bindir)/krun$(EXEEXT) @ENABLE_WASM_TRUE@ rm -f $(DESTDIR)$(bindir)/crun-wasm$(EXEEXT) generate-man: crun.1 krun.1 sync: (cd libocispec; git pull https://github.com/containers/libocispec main) coverity: $(MAKE) $(AM_MAKEFLAGS) -C libocispec $(MAKE) $(AM_MAKEFLAGS) crun libcrun.rs: src/libcrun/container.h bindgen src/libcrun/container.h -- -I$(abs_builddir) -I$(abs_builddir)/libocispec/src > $@ generate-rust-bindings: libcrun.rs generate-signals.c: src/libcrun/signals.perf ${GPERF} --lookup-function-name libcrun_signal_in_word_set -m 100 --null-strings --pic -tCEG -S1 $< > src/libcrun/signals.c generate-mount_flags.c: src/libcrun/mount_flags.perf ${GPERF} --lookup-function-name libcrun_mount_flag_in_word_set -m 100 -tCEG -S1 $< > src/libcrun/mount_flags.c clang-format: # do not format files that were copied into the source directory. git ls-files src tests | grep -E "\\.[hc]" | grep -v "blake3\|chroot_realpath.c\|cloned_binary.c\|signals.c\|mount_flags.c" | xargs clang-format -style=file -i shellcheck: shellcheck tests/*/*.sh contrib/*.sh .PHONY: coverity sync generate-rust-bindings generate-signals.c generate-mount_flags.c clang-format shellcheck # 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: crun-1.16.1/config.h.in0000644000000000000000000001216614656670155013005 0ustar0000000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if CRIU join NS support is available */ #undef CRIU_JOIN_NS_SUPPORT /* Define if CRIU pre-dump support is available */ #undef CRIU_PRE_DUMP_SUPPORT /* Define if shared libraries are enabled */ #undef DYNLOAD_LIBCRUN /* Define to 1 if the system has the type `atomic_int'. */ #undef HAVE_ATOMIC_INT /* Define if libcap is available */ #undef HAVE_CAP /* Define to 1 if you have the `copy_file_range' function. */ #undef HAVE_COPY_FILE_RANGE /* Define if CRIU is available */ #undef HAVE_CRIU /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define if DLOPEN is available */ #undef HAVE_DLOPEN /* Define if eBPF is available */ #undef HAVE_EBPF /* Define to 1 if you have the header file. */ #undef HAVE_ERROR_H /* Define to 1 if you have the `fgetpwent_r' function. */ #undef HAVE_FGETPWENT_R /* Define to 1 if you have the `fgetxattr' function. */ #undef HAVE_FGETXATTR /* Define if FSCONFIG_CMD_CREATE is available in linux/mount.h */ #undef HAVE_FSCONFIG_CMD_CREATE_LINUX_MOUNT_H /* Define if FSCONFIG_CMD_CREATE is available in sys/mount.h */ #undef HAVE_FSCONFIG_CMD_CREATE_SYS_MOUNT_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `issetugid' function. */ #undef HAVE_ISSETUGID /* Define to 1 if you have the header file. */ #undef HAVE_LAUXLIB_H /* Define if libkrun is available */ #undef HAVE_LIBKRUN /* Define to 1 if you have the header file. */ #undef HAVE_LIBKRUN_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_BPF_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_IOPRIO_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_OPENAT2_H /* Define to 1 if you have the header file. */ #undef HAVE_LUACONF_H /* Define to 1 if you have the header file. */ #undef HAVE_LUALIB_H /* Define to 1 if you have the header file. */ #undef HAVE_LUA_H /* Define to 1 if you have the `memfd_create' function. */ #undef HAVE_MEMFD_CREATE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define if mono is available */ #undef HAVE_MONO /* Define to 1 if you have the header file. */ #undef HAVE_MONO_METADATA_ENVIRONMENT_H /* Define to 1 if you have the `sd_notify_barrier' function. */ #undef HAVE_SD_NOTIFY_BARRIER /* Define if seccomp is available */ #undef HAVE_SECCOMP /* Define if SECCOMP_GET_NOTIF_SIZES is available */ #undef HAVE_SECCOMP_GET_NOTIF_SIZES /* Define to 1 if you have the header file. */ #undef HAVE_SECCOMP_H /* Define if spin is available */ #undef HAVE_SPIN /* Define to 1 if you have the `statx' function. */ #undef HAVE_STATX /* Define to 1 if you have the header file. */ #undef HAVE_STDATOMIC_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 if libsystemd is available */ #undef HAVE_SYSTEMD /* Define to 1 if you have the header file. */ #undef HAVE_SYSTEMD_SD_BUS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CAPABILITY_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 if WasmEdge is available */ #undef HAVE_WASMEDGE /* Define to 1 if you have the header file. */ #undef HAVE_WASMEDGE_WASMEDGE_H /* Define if wasmer is available */ #undef HAVE_WASMER /* Define to 1 if you have the header file. */ #undef HAVE_WASMER_H /* Define if wasmtime is available */ #undef HAVE_WASMTIME /* Define to 1 if you have the header file. */ #undef HAVE_WASMTIME_H /* Define if libyajl is available */ #undef HAVE_YAJL /* LIBCRUN_PUBLIC */ #undef LIBCRUN_PUBLIC /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define if seccomp_arch_resolve_name is available */ #undef SECCOMP_ARCH_RESOLVE_NAME /* Define if shared libraries are enabled */ #undef SHARED_LIBCRUN /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION crun-1.16.1/COPYING0000664000000000000000000004325413677104573012017 0ustar0000000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. crun-1.16.1/NEWS0000644000000000000000000007563414656670105011465 0ustar0000000000000000* crun-1.16.1 - fix a regression introduced by 1.16 where using 'rshared' rootfs mount propagation and the rootfs itself is a mountpoint. - inherit user from original process on exec, if not overridden. * crun-1.16 - build: fix build for s390x. - linux: fix mount of special files with rro. Open the mount target with O_PATH to prevent open(2) failures with special files like FIFOs or UNIX sockets. - Fix sd-bus error handling for cpu quota and period props update. - container: use relative path for rootfs if possible. If the rootfs cannot be resolved and it is below the current working directory, only use its relative path. - wasmedge: access container environment variables for the WasmEdge configuration. - cgroup, systemd: use MemoryMax instead of MemoryLimit. Fixes a warning for using an old configuration name. - cgroup, systemd: improve checks for sd_bus_message_append errors * crun-1.15 - fix a mount point leak under /run/crun, add a retry mechanism to unmount the directory if the removal failed with EBUSY. - linux: cgroups: fix potential mount leak when /sys/fs/cgroup is already mounted, causing the posthooks to not run. - release: build s390x binaries using musl libc. - features: add support for potentiallyUnsafeConfigAnnotations. - handlers: add option to load wasi-nn plugin for wasmedge. - linux: fix "harden chdir()" security measure. The previous check was not correct. - crun: add option --keep to the run command. When specified the container is not automatically deleted when it exits. * crun-1.14.4 - linux: fix mount of file with recursive flags. Do not assume it is a directory, but check the source type. * crun-1.14.3 - follow up for 1.14.2. Drop the version check for each command. * crun-1.14.2 - crun: drop check for OCI version. A recent bump in the OCI runtime specs caused crun to fail with every config file. Just drop the check since it doesn't add any value. * crun-1.14.1 - there was recently a security vulnerability (CVE-2024-21626) in runc that allowed a malicious user to chdir(2) to a /proc/*/fd entry that is outside the container rootfs. While crun is not affected directly, harden chdir by validating that we are still inside the container rootfs. - container: attempt to close all the files before execv(2). if we leak any fd, it prevents execv to gain access to files outside the container rootfs through /proc/self/fd/$fd. - fix a regression caused by 1.14 when installing the ebpf filter on a kernel older than 5.11. - cgroup, systemd: fix segfault if the resources block is not specified. * crun-1.14 - build: drop dependency on libgcrypt. Use blake3 to compute the cache key. - cpuset: don't clobber parent cgroup value when writing the cpuset value. - linux: force umask(0). Iit ensures that the `mknodat` syscall is not affected by the umask of the calling process, allowing file permissions to be set as specified in the OCI configuration. - ebpf: do not require MEMLOCK for eBPF programs. This requirement was relaxed in Linux 5.11. * crun-1.13 - src: use O_CLOEXEC for all open/openat calls - cgroup v1: use "max" when pids limit < 0. - improve error message when idmap mount fails because the underlying file system has no support for it. - libcrun: fix compilation when building without libseccomp and libcap. - fix relative idmapped mount when using the custom annotation. * crun-1.12 - add new WebAssembly handler: spin. - systemd: fallback to system bus if session bus is not available. - configure the cpu rt and cpuset controllers before joining them to avoid running temporarily the workload on the wrong cpus. - preconfigure the cpuset with required resources instead of using the parent's set. This prevents needless churn in the kernel as it tracks which CPUs have load balancing disabled. - try attr//* before the attr/* files. Writes to the attr/* files may fail if apparmor is not the first "major" LSM in the list of loaded LSMs (e.g. lsm=apparmor,bpf vs lsm=bpf,apparmor). * crun-1.11.2 - fix a regression caused by 1.11.1 where the process crashes if there are no CPU limits configured on cgroup v1. - fix error code check for the ptsname_r function. * crun-1.11.1 - force a remount operation with bind mounts from the host to correctly set all the mount flags. * crun-1.11 - cgroup: honor cpu burst. - systemd: set CPUQuota and CPUPeriod on the scope cgroup. - linux: append tmpfs mode if missing for mounts. This is the same behavior of runc. - cgroup: always use the user session for rootless. * crun-1.10 - support for Intel Resource Director Technology (RDT). - new mount option "copy-symlink". When provided for a mount, if the source is a symlink, then it is copied in the container instead of attempting a mount. - linux: open mounts before setgroups if in a userns. This solves a problem where a directory that was previously accessible to the user, become inaccessible after setgroups causing the bind mount to fail. * crun-1.9.2 - cgroup: reset the inherited cpu affinity after moving to cgroup. Old kernels do that automatically, but new kernels remember the affinity that was set before the cgroup move, so we need to reset it in order to honor the cpuset configuration. * crun-1.9.1 - utils: ignore ENOTSUP when chmod a symlink. It fixes a problem on Linux 6.6 that always refuses chmod on a symlink. - build: fix build on CentOS 7 - linux: add new fallback when mount fails with EBUSY, so that there is not an additional tmpfs mount if not needed. - utils: improve error message when a directory cannot be created as a component of the path is already existing as a non directory. * crun-1.9 - linux: support arbitrary idmapped mounts. Now it is possible to specify a mapping for any type of mount, not only bind mounts. - linux: add support for "ridmap" mount option to support recursive idmapped mounts. - crun delete: call systemd's reset-failed. In case systemd cgroup driver is used, and the systemd unit has failed (e.g. oom-killed), systemd won't remove the unit (that is, unless the "CollectMode: inactive-or-failed" property is set). - linux: fix check for oom_score_adj. Write the oom_score_adj file even when the new value is 0. - features: Support mountExtensions. - linux: correctly handle unknown signal string when it doesn't start with a digit. - linux: do not attempt to join again already joined namespace. - wasmer: use latest wasix API. * crun-1.8.7 - linux: fix a race condition when an exec was performed immediately after the start and the setns with the procfd failed. - features: Fix annotations formatting. - linux: do not write some errors twice. - libcrun: handle SIGWINCH by resizing the terminal file descriptor. - crun: new command "crun features". - linux: fix handling of idmapped mounts when the container joins an existing PID namespace. - linux: support io_priority from the OCI specs. - linux: handle correctly the case where the status file is not written yet for a container. - crun: fix segfault for "ps" when the container is not using cgroups. - cgroup: allow setting swap to 0. * crun-1.8.6 - crun: new command "crun features". - linux: fix handling of idmapped mounts when the container joins an existing PID namespace. - linux: support io_priority from the OCI specs. - linux: handle correctly the case where the status file is not written yet for a container. - crun: fix segfault for "ps" when the container is not using cgroups. - cgroup: allow setting swap to 0. * crun-1.8.5 - scheduler: use definition from the OCI configuration file instead of the custom label that is now dropped and not supported anymore. - cgroup: fix creating cgroup under "domain threaded". - cgroup, systemd: set the memory limit on the system scope. - restore tty settings from the correct file descriptor. It was previously restoring the settings from the wrong file descriptor causing the tty settings to be changed on the calling terminal. - criu: check if the criu_join_ns_add function exists. Fix a segfault with new versions of CRIU. - linux: do not precreate devs with euid > 0. Fix creating devices when running the OCI runtime as non root user. - linux: improve PID detection on systems that lack pidfd. While there is still a window of time that the PID could be recycled, now it is now reduced to a minimum. - criu: fix memory leak. - logging: improve error message when dlopen fails. * crun-1.8.4 - fix build on CentOS 7. - drop custom annotation to set the time namespace and use the OCI specs instead. - cgroup: workaround cpu quota/period issue with v1. Sometimes setting CPU quota period fails when a new period is lower, and a parent cgroup has CPU quota limit set. - cgroup: fix set quota to -1 on cgroup v1. - criu: drop loading unused functions. * crun-1.8.3 - update: initialize the rt limits only on cgroup v1. * crun-1.8.2 - lua bindings for libcrun. - wasmedge: add current directory to preopen paths. - linux: inherit parent mount flags when making a path masked. - libcrun: custom annotation to set the scheduler for the container process. - cgroup: fallback to blkio.bfq files if blkio is not available on cgroup v1. - cgroup: initialize rt limits when using systemd. - tty: chown the tty to the exec user instead of the user specified to create the container. - cgroup: fallback to create cgroupfs as sibling of the current cgroup if there is none specified and it cannot be created in the root cgroup. * crun-1.8.1 - linux: idmapped mounts expect the same configuration as the user namespace mappings. Before they were expecting the inverted mapping. It is a breaking change, but the behavior was aligned to what runc will do as well. - krun: always allow /dev/kvm in the cgroup configuration. - handlers: disable exec for handlers that do not support it. - selinux: allow setting fscontext using a custom annotation. - cgroup: reset systemd unit if start fails. - cgroup: rmdir the entire systemd scope. It fixes a leak on cgroupv1. - cgroup: always delete the cgroup on errors. On some errors it could have been leaked before. * crun-1.8 - linux: precreate devices on the host. - cgroup: support cpuset mounted with noprefix. - linux: mount the source cgroup if cgroupns=host. - libcrun: don't clone self from read-only mount. - build: fix build without dlfcn.h. - linux: set PR_SET_DUMPABLE. - utils: fix applying AppArmor profile. - linux: write setgroups=deny when mapping a single uid/gid. - cgroup: fix enter cgroupv1 mount on RHEL 7. * crun-1.7.2 - criu: hardcode library name to libcriu.so.2. - cgroup: always enable all controllers, even if the cgroup was already joined. Regression caused by crun-1.7. * crun-1.7.1 - criu: load libcriu dynamically. - seccomp: initialize libgcrypt. - handlers: fix rewriting the argv if the full cmdline doesn't fit. - utils: honor SELinux label when using a custom handler. - utils: honor AppArmor label when using a custom handler. - krun: copy the OCI configuration file into the container. - utils: fix creating the default user namespace when running with euid != 0. - Add setlinebuf() when --debug and --log=file: are used. - Fix timestamp format in the error messages. - krun: disable libkrun's collection of env vars * crun-1.7 - seccomp: use a cache for the generated BPF. - add support for setting the domainname through the OCI spec. - handlers: define wasm and krun. - wasmtime: add support for compiling .wat format. - cgroup: honor checkBeforeUpdate on cgroupv2. - crun: chown std streams before joining the user namespace. - crun: display rundir in --version output. - container: with cgroupfs use clone3 to join directly the target cgroup. - linux: create parent directories for created devices with mode 0755. - wasm: inherit environment variables in the WasmEdge handler. * crun-1.6 - runc compatibility: -v now prints the version string. - build: fix build with glibc 2.36. - container: drop intermediate userns custom feature. - cgroup: change the delegate cgroup semantic so that the cgroup is created in the container payload after the cgroup namespace is created. - seccomp: use helper process to send file descriptor to the listener socket. It enables to be notified on every syscall without hanging the main process. - linux: add a fallback to using kill(2) if pidfd_send_signal(2) fails with ENOSYS. - krun: add support for krun-sev. - wasmtime: always grant file system capability for workdir inside the container. - wasmtime: inherit arguments list from the handler instead of the current process. - wasmedge: use released wasmedge library instead of libwasmedge_c.so. * crun-1.5 - add mono based native .NET handler - new Wasmtime backend for running WebAssembly - add support for wasmedge 0.10 and dropping support for wasmedge 0.9.x - dropping support for experimental `WasmEdgeProcess` from wasmedge handler - honor process user's uid when setting the HOME environment variable - create the current working directory if it is missing in the container - fallback to using a tmpfs mount if umount of /sys and /proc fails - fallback to netlink to setup lo device - fix creating devices in the rootfs - fallback to using io.weight if io.bfq.weight doesn't exist - remove tun/tap from the default allow list - linux: devices mounts have noexec and nosuid - fix copyup of files from the container to the tmpfs - honor $PATH for newgidmap and newguidmap - krun: limit the number of vCPUs to 8 - cgroup: add support for cpu.idle * crun-1.4.5 - CRIU: add support for different manage cgroups modes. - linux: the hook processes inherit the crun process environment if there is no environment block specified in the OCI configuration. - exec: fix double free when using --apparmor and --process-label. * crun-1.4.4 - wasm, kubernetes: support wasm for kubernetes infrastructure with side-cars - Resolve symlinks in bind mounts when creating a user namespace. - Fix CVE-2022-27650: exec does not set inheritable capabilities. * crun-1.4.3 - cgroup: avoid infinite loop when deleting a cgroup if it contains processes that cannot be terminated. - support additional options for idmap mounts. It is now possible to specify what mappings must be used for the idmapped mount. - open the source for a bind mount in the host. It is useful when creating a user namespace so that the parent directories for the source directory are not required to be accessible to the users in the user namespace. * crun-1.4.2 - CRIU: add pre-dump support. - Fix running with a read-only /dev. The /dev/console file is created before re-mounting /dev as read-only. - Ignore EROFS when chowning standard stream files. - Add validation for sysctls before applying them. - Attempt looking up the executable after the setresuid syscall, this solves an issue on NFS when the executable file is not owned by root in the container, but the UID:GID combination configured for the container can access it. * crun-1.4.1 - Fix check for an invalid path. crun was performing the wrong check to validate a path, causing spurious failures at runtime. - Allow deleting a container while in `created` state. It goes against what the OCI runtime specs dictate, but it is the expected behavior since runc allows it. - Fix regression when joining a container that has explicit paths for the namespaces. - cgroup: do not set cpu limits if number of shares is set to 0. Moby uses 0 to indicate no limits. - Fix build issues when configured with --enable-shared. - Fix build on systems where OPEN_TREE_CLOEXEC is not defined. - Improve diagnostics for errors returned by dbus. * crun-1.4 - wasm: support for running on kubernetes with containerd. - linux: add support for recursive mount options. e.g. it is possible to specify "rro" to make the mount read-only recursively. - add support for idmapped mounts through a new mount option "idmap". - linux: improve detection of /dev target. Previously a mount like `/dev/` was not properly detected as mounting /dev/ from the host. - now crun exec uses CLONE_INTO_CGROUP on supported kernels when using cgroup v2. - retry the openat2 syscall if it fails with EAGAIN. - cgroup: set the CPUWeight/CPUShares on the systemd scope cgroup. - on new kernels, use setns with pidfd. - attempt the chdir again with the specified user if it failed before changing credentials. - ebpf: fix build on 32 bits systems. - crun --version shows the configured handlers. * crun-1.3 - add support to natively build and run WebAssembly workload and WebAssembly containers. - allow to specify sub-cgroup for exec. - chown std streams if they are not a TTY. - attach the correct streams if the container is suspended and restored multiple times. - fix race condition when enabling controllers on cgroup v2. - the fallback code to mount cgroupfs bind mounts the current cgroup path instead of the host /sys. * crun-1.2 - exec: fix regression in 1.1 where containers are being wrongly reported as paused. - criu: add support for external ipc, uts and time namespaces. * crun-1.1 - cgroup: use cgroup.kill when available. It is faster to kill a container through its cgroup as there is no need to recurse over the cgroup pids and terminate each one of them. - exec: refuse to exec in a paused container/cgroup. - container: Set primary process to 1 via LISTEN_PID by default if user configuration is missing. - criu: Add support for external PID namespace. - criu: fix save of external descriptors. Now restored containers attach correctly their standard streams. - utils: retry openat2 on EAGAIN. If the openat2 syscall is interrupted, try again. * crun-1.0 - cgroup: chown the current container cgroup to root in the container. - linux: treat pidfd_open failures EINVAL as ESRCH - cgroup: add support for setting memory.use_hierarchy on cgroup v1. - Makefile.am: fix link error when using directly libcrun. - Fix symlink target mangling for tmpcopyup targets. * crun-0.21 - honor memory swappiness set to 0 - status: add fields for owner and created timestamp - cgroup: lookup pids controller as well when the memory controller is not available - when compiled with krun, automatically use it if the current executable file is called "krun". * crun-0.20.1 - container: ignore error when resetting the SELinux label for the keyring. * crun-0.20 - container: call prestart hooks before rootfs is RO. - cgroup: added support cleaning custom controllers on cgroupv1. - spec: add support for --bundle. - exec: add --no-new-privs. - exec: add --process-label and --apparmor to change SELinux and AppArmor labels. - cgroup: kill procs in cgroup on EBUSY. - cgroup: ignore devices errors when running in a user namespace. - seccomp: drop SECCOMP_FILTER_FLAG_LOG by default. - seccomp: report correct action in error message. - apply SELinux label to keyring. - add custom annotation run.oci.delegate-cgroup. - close_range fallbacks to close on EPERM. - report error if the cgroup path was set and the cgroup could not be joined. * crun-0.19.1 - on exec, honor additional_gids from the process spec, not the container definition. - spec: add cgroup ns if on cgroup v2. - systemd: support array of strings for cgroup annotation. * crun-0.19 - join all the cgroup v1 controllers. - raise a warning when newuidmap/newgidmap fail. - handle eBPF access(dev_name, F_OK) call correctly. - fix some memory leaks on errors when libcrun is used by a long running process. - fix the SELinux label for masked directories. - support default seccomp errno value. - fail if no default seccomp action specified. - support OCI seccomp notify listener. - improve OOM error messages. - ignore unknown capabilities and raise a warning. - always remount bind mounts to drop not requested mount flags. * crun-0.18 - fix build without CLONE_NEWCGROUP. - fix conversion from blkio to io. - add custom annotation to load raw BPF. - set working directory for libkrun - fix symlink lookup on old kernels that lack openat2 - skip +cpu on EINVAL in cgroup root. Enabling the cpu controller is not permitted if there are already realtime processes running on the system. - Fix permission error when using NOTIFY_SOCKET with username spaces. - set HOME to root if the user not found. - simplify mount logic to not use a temporary mount. - ignore ENOSYS from keyctl. * crun-0.17 - allow creating user namespaces without root being mapped. - allow arbitrary IDs with single ID userns. - use close_range(CLOSE_RANGE_CLOEXEC) where available. - honor /sys/kernel/cgroup/delegate. - fix an issue with hooks running in the container PID namespace. - fix building without seccomp. - fix building without libcap. * crun-0.16 - CRIU support. - fallback to openat if openat2 returns EPERM. - ignore ENOENT for cgroup v1 mounts, if the mount fails with ENOENT, the controller might have been unmounted. - fix another race reading cgroup freeze. Reading from the cgroup fails with ENODEV if the cgroup was deleted in the meanwhile. * crun-0.15.1 - add experimental support for libkrun. - fix check for pidfd availability on older kernels. - linux: do not set data when remounting read-only. Fix 'ro' mounts on older kernels when SELinux is enabled. - linux: label the cgroup v1 tmpfs when SELinux is enabled. - container: truncate the pid file before writing to it. - exec: fix check for read bytes from the sync socket. - check the process has a cgroup before allowing pause and resume. - linux: always create a user namespace if not running with euid == 0. - libcrun can use a hook instead of executing a container process. - use libyajl to generate hooks json input. - handle correctly ENOENT for seccomp notifications. * crun-0.15 - add support for OCI unified cgroup v2. - add json format option to `crun list`. - get last kernel capability dynamically instead of using a build time constant. - enable all available cgroup controllers. - support the seccomp SCMP_ACT_LOG action. - support the seccomp SCMP_ACT_KILL_THREAD action. - properly set a SELinux label for the mqueue mount. - `crun kill` uses pidfd when supported. - experimental support for seccomp notifications. - fix bundle option for `crun create` and `crun run`. - allow to declare path to config file. - check /sys/kernel/security/apparmor when using AppArmor. - doesn't accept type=bind alone anymore, but require either "bind" or "rbind" to be present in the mount flags. * crun-0.14.1 - fix a regression in crun-0.14 where openat2(2) would fail when bind mounting a symlink. - various small fixes to allow running regression tests outside of source tree. * crun-0.14 - cgroup, systemd: create container under subcgroup. Now a "/container" sub-cgroup is created and fully managed by libcrun. This is a different behaviour than what runc does. - libcrun: use the openat2 syscall available since Linux 5.6. - container: allow hooks output to file through an annotation. - linux: support joining PID/IPC namespace not owned by the user namespace. Requires Linux 5.3. - linux: avoid double fork for creating the init process if not needed. - linux: fix an issue where the basename for $NOTIFY_SOCKET is different than /notify. - rootless: allow /dev/{tty,ptmx} to be present in linux.devices. - cgroup: fix an issue on CentOS 7.8 when using net_cls and net_prio. - seccomp: honor errnoRet from OCI spec runtime. - exec: set setresuid/setresgid before setting up the terminal. - cgroup, v2: fix crun update with both --memory -1 --memory-swap -1. - cgroup, v2: fixing setting unlimited swap. - cgroup, v2: allow to set unlimited swap per se. - cgroup, v2: treat negative numbers as "max" - cgroup, v2: raise error if swap is set without memory limit. - cgroup: ignore cpu resources if set to 0. - libcrun: audit errno in crun_make_error calls - libcrun: fix read_pid_stat usage. - linux: fix double close on the same file descriptor. - container: Prevent deletion of not stopped container - status: Use process start time for identification - CRIU: several improvements. - linux: fix path lookups for relative paths containing '/'. - linux: use the SELinux mount label for the notify socket. - status: delete doesn't fail if the process already exited. * crun-0.13 - license: change license to gplv2+ and lgpl2.1+. - criu: initial support for `container restore`. - state: If a container is paused, report its state as 'paused'. - cgroup: use the memory controller to ready PIDs. The pid controller is not available on kernels older than 4.3. - linux: drop context= for remount. Older linux versions complain when the selinux label is specified on a remount. - utils: fix mount on not writeable path. - cgroup: support systemd properties via annotations. - systemd: do not set hard-code collectmode value. It can be set through an annotation. - cgroup: write the correct blkio settings. - exec: do not inherit env variables from main pid. - ebpf: fix endianness issue on s390x. - linux: fix recursive mount on cgroup v1. * crun-0.12.2.1 - when not using a cgroup namespace, mount only the cgroup v1 subpath. * crun-0.12.2 - do not require read permissions on / - add support for the "time" namespace via a custom annotation - fix mount of cgroup v1 when using a cgroup namespace - set default umask to 0022 - use the correct path for notify socket with "crun run -d" - always use setsid - use correct indices for seccomp generation - fixed several issues with cgroup v2 and the cgroupfs driver * crun-0.12.1 - fix the order of clone syscall arguments on s390 and cris. - if no mode is specified use 0666 for devices. - fix running with a relative bundle directory. - fix some regressions in the mounts path resolution. - drop a warning when cgroup are not available for rootless. * crun-0.12 - masked paths use only MS_UNBINDABLE - mount doesn't specify mount data when there are no options - support new hook types: createRuntime, createContainer and startContainer - safer mount options. A temporary mount is prepared outside of the rootfs before being moved to it. - apply selinux/apparmor before the pivot_root. - handle correctly proc remounts. It is now supported to specify hidepid= - fix exec if a namespace is not available. - handle swap limit with the same semantic as on cgroup v1. - bring network device up. - reset all signal handlers to default. * crun-0.11 - cgroups2: map memory reservation to memory.low - statx fallbacks to stat on EINVAL - utils: do not fail if the path we are trying to create already exists - generate seccomp profile in the parent process, not in the container init process. Memory usage is more reliable now and a container can run with ~250K of max memory. - support for Linux personality. - support for umask. - support for the hugetlb controller on cgroup v2. - PIDs from a cgroup are read recursively. - do not fork on "create". - now by default seccomp doesn't fail on an unknown syscall. The previous behavior can be enabled with an annotation. - fix joining cgroup on cgroup v2 when a named hierarchy is also present. - fix creating user namespaces with more than 2^32 IDs mapped. - on exec, keep the SELinux label or AppArmor profile from the - container configuration. - runtime specific annotation are prefixed with run.oci. * crun-0.10.6 - when running with a terminal, change the ownership for the terminal to the specified user - spec: honor the --rootless flag - linux: make sure the source path is resolved when checking the file type. Regression introduced with 0.10.5. * crun-0.10.5 - fix CVE-2019-18837 - fix running on CentOS/RHEL 8 - report errors opening the console socket - not leave config.json around if the container could not be created * crun-0.10.4 - ignore errors creating /dev/console - add an annotation "io.crun.keep_original_groups", if it is set then crun won't drop additional groups when creating the container * crun-0.10.3 - systemd: set collectmode=inactive-or-failed - fix build on Alpine - use the current working directory to lookup local paths - improve the error message when a hook fails - add granular enable/disable configure options * crun-0.10.2 - fix a regression in 0.10.1 where cgroups v1 could not be created - correctly chown cgroups when using a user namespace so that systemd can run in a container that uses a user namespace * crun-0.10.1 - linux: Keep MS_RDONLY when remounting bind mount of a read-only source. It solves an issue on Fedora Silverblue where /usr is mounted read only. - fix exec of rootless containers when cgroups are not available * crun-0.10 - support for AppArmor - fix for CVE-2019-16884, make sure writes to /proc for the SELinux and AppArmor labels are on procfs. - exec supports --preserve-fds - seccomp: fix lookup for pseudo syscalls, seccomp now works fine on non native archs - cgroup: ignore rootless errors if manager != systemd - error: always write errors to stderr - chroot: follow symlinks for the last component - set $HOME if it is not already defined * crun-0.9.1 - fix an issue with tmpcopyup that didn't work correctly with symlinks - create a new cgroup namespace before mounting the cgroup file system, so that it uses the correct namespace * crun-0.9 - fix exec into containers running systemd on cgroups v2 - kill: honor --all - kill: when not using a PID namespace, use the freezer controller to prevent the container forking new processes - linux: handle tmpcopyup option to copy files from the rootfs to the new mounted tmpfs. - OCI: honor seccomp options. If not specified any seccomp option, now crun will default to using SECCOMP_FILTER_FLAG_SPEC_ALLOW | SECCOMP_FILTER_FLAG_LOG when using the seccomp(2) syscall * crun-0.8 - executable lookup. Now create fails immediately if the specified executable doesn't exist - subreaper enabled only when crun is attached - fix notify socket when used from create and prevent it hanging indefinitely when the container exits - correctly write cpu controller resources when using cgroups v2 - support for the freezer controller when using cgroups v2 - honor unspecified minor/major number for devices when using cgroups v2 - reintroduce --no-pivot - do not add a cgroup path again if it was already specified in the OCI configuration * crun-0.7 - support devices on cgroups v2 using eBPF. - new option --cgroup-manager=MANAGER. Accepted values are cgroupfs, systemd and disabled. - can run without using cgroups also as root. - NOTIFY_SOCKET works also for containers created via create/start. - when using systemd, create the same name for the scope as runc does. * crun-0.6 - tty: set the size on the exec tty. - cgroup: enable only the controllers needed. - cgroup: in unified mode report the errors also for rootless. - cgroup2: add support for the cpuset controller. - linux: ignore tmpcopyup. * crun-0.5 - logging: support --log=syslog: and log=journald. - seccomp: if the syscall is not known, ignore it. - container: move set oom before entering userns. - status: always honor XDG_RUNTIME_DIR. - linux: resolve symlinks in the target for bind mounts. - fix all issues found by Coverity. - pass Kubernetes e2e tests on Fedora with CRI-O. * crun-0.4 - partial support for cgroup v2 (cpu, io, memory, pids controllers). - pass all the OCI validation tests (https://github.com/opencontainers/runtime-tools). - implement --log-format. crun now works with containerd. - fixed some issues that prevented crun to work on older kernels. crun-1.16.1/COPYING.libcrun0000664000000000000000000006364213677104573013457 0ustar0000000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! crun-1.16.1/README.md0000644000000000000000000001246014654642544012235 0ustar0000000000000000

[![Coverity Status](https://scan.coverity.com/projects/17787/badge.svg)](https://scan.coverity.com/projects/giuseppe-crun) [![CodeQL](https://github.com/containers/crun/workflows/CodeQL/badge.svg)](https://github.com/containers/crun/actions?query=workflow%3ACodeQL) A fast and low-memory footprint OCI Container Runtime fully written in C. crun conforms to the OCI Container Runtime specifications (). ## Documentation The user documentation is available [here](crun.1.md). ## Why another implementation? While most of the tools used in the Linux containers ecosystem are written in Go, I believe C is a better fit for a lower level tool like a container runtime. runc, the most used implementation of the OCI runtime specs written in Go, re-execs itself and use a module written in C for setting up the environment before the container process starts. crun aims to be also usable as a library that can be easily included in programs without requiring an external process for managing OCI containers. ## Performance crun is faster than runc and has a much lower memory footprint. This is the elapsed time on my machine for running sequentially 100 containers, the containers run `/bin/true`: | | crun | runc | % | | ------------- | ------: | -----: | ------: | | 100 /bin/true | 0:01.69 | 0:3.34 | \-49.4% | crun requires fewer resources, so it is also possible to set stricter limits on the memory allowed in the container: ```console # podman --runtime /usr/bin/runc run --rm --memory 4M fedora echo it works Error: container_linux.go:346: starting container process caused "process_linux.go:327: getting pipe fds for pid 13859 caused \"readlink /proc/13859/fd/0: no such file or directory\"": OCI runtime command not found error # podman --runtime /usr/bin/crun run --rm --memory 512k fedora echo it works it works ``` ## Dependencies These dependencies are required for the build: ### Fedora ```console $ sudo dnf install -y make python git gcc automake autoconf libcap-devel \ systemd-devel yajl-devel libseccomp-devel pkg-config \ go-md2man glibc-static python3-libmount libtool ``` ### RHEL/CentOS 8 ```console $ sudo yum --enablerepo='*' --disablerepo='media-*' install -y make automake \ autoconf gettext \ libtool gcc libcap-devel systemd-devel yajl-devel \ glibc-static libseccomp-devel python36 git ``` go-md2man is not available on RHEL/CentOS 8, so if you'd like to build the man page, you also need to manually install go-md2man. It can be installed with: ```console $ sudo yum --enablerepo='*' install -y golang $ export GOPATH=$HOME/go $ go get github.com/cpuguy83/go-md2man $ export PATH=$PATH:$GOPATH/bin ``` ### Ubuntu ```console $ sudo apt-get install -y make git gcc build-essential pkgconf libtool \ libsystemd-dev libprotobuf-c-dev libcap-dev libseccomp-dev libyajl-dev \ go-md2man autoconf python3 automake ``` ### Alpine ```console # apk add gcc automake autoconf libtool gettext pkgconf git make musl-dev \ python3 libcap-dev libseccomp-dev yajl-dev argp-standalone go-md2man ``` ### Tumbleweed ```console # zypper install make automake autoconf gettext libtool gcc libcap-devel \ systemd-devel libyajl-devel libseccomp-devel python3 go-md2man \ glibc-static; ``` Note that Tumbleweed requires you to specify libseccomp's header file location as a compiler flag. ```console # ./autogen.sh # ./configure CFLAGS='-I/usr/include/libseccomp' # make ``` ## Build Unless you are also building the Python bindings, Python is needed only by libocispec to generate the C parser at build time, it won't be used afterwards. Once all the dependencies are installed: ```console $ ./autogen.sh $ ./configure $ make ``` To install into default PREFIX (`/usr/local`): ```console $ sudo make install ``` ### Shared Libraries The previous build instructions do not enable shared libraries, therefore you will be unable to use libcrun. If you wish to build the shared libraries you can change the previous `./configure` statement to `./configure --enable-shared`. ## Static build It is possible to build a statically linked binary of crun by using the officially provided [nix](https://nixos.org/nixos/packages.html?attr=crun&channel=unstable&query=crun) package and the derivation of it [within this repository](nix/). The builds are completely reproducible and will create a x86\_64/amd64 stripped ELF binary for [glibc](https://www.gnu.org/software/libc). ### Nix To build the binaries by locally installing the nix package manager: ```console $ curl -L https://nixos.org/nix/install | sh $ git clone --recursive https://github.com/containers/crun.git && cd crun $ nix build -f nix/ $ ./result/bin/crun --version ``` ### Ansible An [Ansible Role](https://github.com/alvistack/ansible-role-crun) is also available to automate the installation of the above statically linked binary on its supported OS: ```console $ sudo su - # mkdir -p ~/.ansible/roles # cd ~/.ansible/roles # git clone https://github.com/alvistack/ansible-role-crun.git crun # cd ~/.ansible/roles/crun # pip3 install --upgrade --ignore-installed --requirement requirements.txt # molecule converge # molecule verify ``` ## Lua bindings A Lua binding is available. See [the README](lua/README.md) for more information. crun-1.16.1/SECURITY.md0000664000000000000000000000035613677104573012551 0ustar0000000000000000## Reporting a Vulnerability If you discover a potential security issue in this project we ask that you notify us directly via email to security@oci.run (not affiliated with opencontainers.org). Please do **not** create a public issue. crun-1.16.1/autogen.sh0000775000000000000000000000031514035072211012732 0ustar0000000000000000#!/bin/sh if ! (pkg-config --version > /dev/null 2>&1); then echo "pkg-config not found. Please install it">&2 exit 1 fi mkdir -p m4 git submodule update --init --recursive exec autoreconf -fi crun-1.16.1/crun.1.md0000644000000000000000000004632514514171717012407 0ustar0000000000000000crun 1 "User Commands" ================================================== # NAME crun - a fast and lightweight OCI runtime # SYNOPSIS crun [global options] command [command options] [arguments...] # DESCRIPTION crun is a command line program for running Linux containers that follow the Open Container Initiative (OCI) format. # COMMANDS **create** Create a container. The runtime detaches from the container process once the container environment is created. It is necessary to successively use `start` for starting the container. **delete** Remove definition for a container. **exec** Exec a command in a running container. **list** List known containers. **kill** Send the specified signal to the container init process. If no signal is specified, SIGTERM is used. **ps** Show the processes running in a container. **run** Create and immediately start a container. **spec** Generate a configuration file. **start** Start a container that was previously created. A container cannot be started multiple times. **state** Output the state of a container. **pause** Pause all the processes in the container. **resume** Resume the processes in the container. **update** Update container resource constraints. **checkpoint** Checkpoint a running container using CRIU **restore** Restore a container from a checkpoint # STATE By default, when running as root user, crun saves its state under the **/run/crun** directory. As unprivileged user, instead the *XDG_RUNTIME_DIR* environment variable is honored, and the directory **$XDG_RUNTIME_DIR/crun** is used. The global option **--root** overrides this setting. # GLOBAL OPTIONS **--debug** Produce verbose output. **--log**=_LOG-DESTINATION_ Define the destination for the error and warning messages generated by crun. If the error happens late in the container init process, when crun already stopped watching it, then it will be printed to the container stderr. It is specified in the form *BACKEND:SPECIFIER*. These following backends are supported: - file:PATH - journald:IDENTIFIER - syslog:IDENTIFIER If no backend is specified, then *file:* is used by default. **--log-format**=_FORMAT_ Define the format of the log messages. It can either be **text**, or **json**. The default is **text**. **--no-pivot** Use `chroot(2)` instead of `pivot_root(2)` when creating the container. This option is not safe, and should be avoided. **--root**=_DIR_ Defines where to store the state for crun containers. **--systemd-cgroup** Use systemd for configuring cgroups. If not specified, the cgroup is created directly using the cgroupfs backend. **--cgroup-manager**=_MANAGER_ Specify what cgroup manager must be used. Permitted values are **cgroupfs**, **systemd** and **disabled**. **-?**, **--help** Print a help list. **--usage** Print a short usage message. **-V**, **--version** Print program version ## CREATE OPTIONS crun [global options] create [options] CONTAINER **--bundle**=_PATH_ Path to the OCI bundle, by default it is the current directory. **--config**=_FILE_ Override the configuration file to use. The default value is **config.json**. **--console-socket**=_SOCKET_ Path to a UNIX socket that will receive the ptmx end of the tty for the container. **--no-new-keyring** Keep the same session key **--preserve-fds**=_N_ Additional number of FDs to pass into the container. **--pid-file**=_PATH_ Path to the file that will contain the container process PID. ## RUN OPTIONS crun [global options] run [options] CONTAINER **--bundle**=_BUNDLE_ Path to the OCI bundle, by default it is the current directory. **--config**=_FILE_ Override the configuration file to use. The default value is **config.json**. **--console-socket**=_SOCKET_ Path to a UNIX socket that will receive the ptmx end of the tty for the container. **--no-new-keyring** Keep the same session key. **--preserve-fds**=_N_ Additional number of FDs to pass into the container. **--pid-file**=_PATH_ Path to the file that will contain the container process PID. **--detach** Detach the container process from the current session. ## DELETE OPTIONS crun [global options] delete [options] CONTAINER **--force** Delete the container even if it is still running. **--regex**=_REGEX_ Delete all the containers that satisfy the specified regex. ## EXEC OPTIONS crun [global options] exec [options] CONTAINER CMD **--apparmor**=_PROFILE_ Set the apparmor profile for the process. **--console-socket**=_SOCKET_ Path to a UNIX socket that will receive the ptmx end of the tty for the container. **--cwd**=_PATH_ Set the working directory for the process to PATH. **--cap**=_CAP_ Specify an additional capability to add to the process. **--detach** Detach the container process from the current session. **--cgroup**=_PATH_ Specify a sub-cgroup path inside the container cgroup. The path must already exist in the container cgroup. **--env**=_ENV_ Specify an environment variable. **--no-new-privs** Set the no new privileges value for the process. **--preserve-fds**=_N_ Additional number of FDs to pass into the container. **--process**=_FILE_ Path to a file containing the process JSON configuration. **--process-label**=_VALUE_ Set the asm process label for the process commonly used with selinux. **--pid-file**=_PATH_ Path to the file that will contain the new process PID. **-t** **--tty** Allocate a pseudo TTY. **-u _USERSPEC_ **--user**=_USERSPEC_ Specify the user in the form UID[:GID]. ## LIST OPTIONS crun [global options] list [options] **-q** **--quiet** Show only the container ID. ## KILL OPTIONS crun [global options] kill [options] CONTAINER SIGNAL **--all** Kill all the processes in the container. **--regex**=_REGEX_ Kill all the containers that satisfy the specified regex. ## PS OPTIONS crun [global options] ps [options] **--format**=_FORMAT_ Specify the output format. It must be either `table` or `json`. By default `table` is used. ## SPEC OPTIONS crun [global options] spec [options] **-b** _DIR_ **--bundle**=_DIR_ Path to the root of the bundle dir (default "."). **--rootless** Generate a config.json file that is usable by an unprivileged user. ## UPDATE OPTIONS crun [global options] update [options] CONTAINER **--blkio-weight**=_VALUE_ Specifies per cgroup weight. **--cpu-period**=_VALUE_ CPU CFS period to be used for hardcapping. **--cpu-quota**=_VALUE_ CPU CFS hardcap limit. **--cpu-rt-period**=_VALUE_ CPU realtime period to be used for hardcapping. **--cpu-rt-runtime**=_VALUE_ CPU realtime hardcap limit. **--cpu-share**=_VALUE_ CPU shares. **--cpuset-cpus**=_VALUE_ CPU(s) to use. **--cpuset-mems**=_VALUE_ Memory node(s) to use. **--kernel-memory**=_VALUE_ Kernel memory limit. **--kernel-memory-tcp**=_VALUE_ Kernel memory limit for TCP buffer. **--memory**=_VALUE_ Memory limit. **--memory-reservation**=_VALUE_ Memory reservation or soft_limit. **--memory-swap**=_VALUE_ Total memory usage. **--pids-limit**=_VALUE_ Maximum number of pids allowed in the container. **-r**, **--resources**=_FILE_ Path to the file containing the resources to update. ## CHECKPOINT OPTIONS crun [global options] checkpoint [options] CONTAINER **--image-path**=_DIR_ Path for saving CRIU image files **--work-path**=_DIR_ Path for saving work files and logs **--leave-running** Leave the process running after checkpointing **--tcp-established** Allow open TCP connections **--ext-unix-sk** Allow external UNIX sockets **--shell-job** Allow shell jobs **--pre-dump** Only checkpoint the container's memory without stopping the container. It is not possible to restore a container from a pre-dump. A pre-dump always needs a final checkpoint (without **--pre-dump**). It is possible to make as many pre-dumps as necessary. For a second pre-dump or for a final checkpoint it is necessary to use **--parent-path** to point crun (and thus CRIU) to the pre-dump. **--parent-path**=_DIR_ Doing multiple pre-dumps or the final checkpoint after one or multiple pre-dumps requires that crun (and thus CRIU) knows the location of the pre-dump. It is important to use a relative path from the actual checkpoint directory specified via **--image-path**. It will fail if an absolute path is used. **--manage-cgroups-mode**=_MODE_ Specify which CRIU manage cgroup mode should be used. Permitted values are **soft**, **ignore**, **full** or **strict**. Default is **soft**. ## RESTORE OPTIONS crun [global options] restore [options] CONTAINER **-b DIR** **--bundle**=_DIR_ Container bundle directory (default ".") **--image-path**=_DIR_ Path for saving CRIU image files **--work-path**=_DIR_ Path for saving work files and logs **--tcp-established** Allow open TCP connections **--ext-unix** Allow external UNIX sockets **--shell-job** Allow shell jobs **--detach** Detach from the container's process **--pid-file**=_FILE_ Where to write the PID of the container **--manage-cgroups-mode**=_MODE_ Specify which CRIU manage cgroup mode should be used. Permitted values are **soft**, **ignore**, **full** or **strict**. Default is **soft**. # Extensions to OCI ## `run.oci.mount_context_type=context` Set the mount context type on volumes mounted with SELinux labels. Valid context types are: context (default) fscontext defcontext rootcontext More information on how the context mount flags works see the `mount(8)` man page. ## `run.oci.seccomp.receiver=PATH` If the annotation `run.oci.seccomp.receiver=PATH` is specified, the seccomp listener is sent to the UNIX socket listening on the specified path. It can also set with the `RUN_OCI_SECCOMP_RECEIVER` environment variable. It is an experimental feature, and the annotation will be removed once it is supported in the OCI runtime specs. It must be an absolute path. ## `run.oci.seccomp.plugins=PATH` If the annotation `run.oci.seccomp.plugins=PLUGIN1[:PLUGIN2]...` is specified, the seccomp listener fd is handled through the specified plugins. The plugin must either be an absolute path or a file name that is looked up by `dlopen(3)`. More information on how the lookup is performed are available on the `ld.so(8)` man page. ## `run.oci.seccomp_fail_unknown_syscall=1` If the annotation `run.oci.seccomp_fail_unknown_syscall` is present, then crun will fail when an unknown syscall is encountered in the seccomp configuration. ## `run.oci.seccomp_bpf_data=PATH` If the annotation `run.oci.seccomp_bpf_data` is present, then crun ignores the seccomp section in the OCI configuration file and use the specified data as the raw data to the `seccomp(SECCOMP_SET_MODE_FILTER)` syscall. The data must be encoded in base64. It is an experimental feature, and the annotation will be removed once it is supported in the OCI runtime specs. ## `run.oci.keep_original_groups=1` If the annotation `run.oci.keep_original_groups` is present, then crun will skip the `setgroups` syscall that is used to either set the additional groups specified in the OCI configuration, or to reset the list of additional groups if none is specified. ## `run.oci.pidfd_receiver=PATH` It is an experimental feature and will be removed once the feature is in the OCI runtime specs. If present, specify the path to the UNIX socket that will receive the pidfd for the container process. ## `run.oci.systemd.force_cgroup_v1=/PATH` If the annotation `run.oci.systemd.force_cgroup_v1=/PATH` is present, then crun will override the specified mount point `/PATH` with a cgroup v1 mount made of a single hierarchy `none,name=systemd`. It is useful to run on a cgroup v2 system containers using older versions of systemd that lack support for cgroup v2. **Note**: Your container host has to have the cgroup v1 mount already present, otherwise this will not work. If you want to run the container rootless, the user it runs under has to have permissions to this mountpoint. For example, as root: ``` mkdir /sys/fs/cgroup/systemd mount cgroup -t cgroup /sys/fs/cgroup/systemd -o none,name=systemd,xattr chown -R the_user.the_user /sys/fs/cgroup/systemd ``` ## `run.oci.systemd.subgroup=SUBGROUP` Override the name for the systemd sub cgroup created under the systemd scope, so the final cgroup will be like: ``` /sys/fs/cgroup/$PATH/$SUBGROUP ``` When it is set to the empty string, a sub cgroup is not created. If not specified, it defaults to `container` on cgroup v2, and to `""` on cgroup v1. e.g. ``` /sys/fs/cgroup//system.slice/foo-352700.scope/container ``` ## `run.oci.delegate-cgroup=DELEGATED-CGROUP` If the `run.oci.systemd.subgroup` annotation is specified, yet another sub-cgroup is created and the container process is moved here. If a cgroup namespace is used, the cgroup namespace is created before moving the container to the delegated cgroup. ``` /sys/fs/cgroup/$PATH/$SUBGROUP/$DELEGATED-CGROUP ``` The runtime doesn't apply any limit to the `$DELEGATED-CGROUP` sub-cgroup, the runtime uses only `$PATH/$SUBGROUP`. The container payload fully manages `$DELEGATE-CGROUP`, the limits applied to `$PATH/$SUBGROUP` still applies to `$DELEGATE-CGROUP`. Since cgroup delegation is not safe on cgroup v1, this option is supported only on cgroup v2. ## `run.oci.hooks.stdout=FILE` If the annotation `run.oci.hooks.stdout` is present, then crun will open the specified file and use it as the stdout for the hook processes. The file is opened in append mode and it is created if it doesn't already exist. ## `run.oci.hooks.stderr=FILE` If the annotation `run.oci.hooks.stderr` is present, then crun will open the specified file and use it as the stderr for the hook processes. The file is opened in append mode and it is created if it doesn't already exist. ## `run.oci.handler=HANDLER` It is an experimental feature. If specified, run the specified handler for execing the container. The only supported values are `krun` and `wasm`. - `krun`: When `krun` is specified, the `libkrun.so` shared object is loaded and it is used to launch the container using libkrun. - `wasm`: If specified, run the wasm handler for container. Allows running wasm workload natively. Accepts a `.wasm` binary as input and if `.wat` is provided it will be automatically compiled into a wasm module. Stdout of wasm module is relayed back via crun. ## tmpcopyup mount options If the `tmpcopyup` option is specified for a tmpfs, then the path that is shadowed by the tmpfs mount is recursively copied up to the tmpfs itself. ## copy-symlink mount options If the `copy-symlink` option is specified, if the source of a bind mount is a symlink, the symlink is recreated at the specified destination instead of attempting a mount that would resolve the symlink itself. If the destination already exists and it is not a symlink with the expected content, crun will return an error. ## r$FLAG mount options If a `r$FLAG` mount option is specified then the flag `$FLAG` is set recursively for each children mount. These flags are supported: - "rro" - "rrw" - "rsuid" - "rnosuid" - "rdev" - "rnodev" - "rexec" - "rnoexec" - "rsync" - "rasync" - "rdirsync" - "rmand" - "rnomand" - "ratime" - "rnoatime" - "rdiratime" - "rnodiratime" - "rrelatime" - "rnorelatime" - "rstrictatime" - "rnostrictatime" ## idmap mount options If the `idmap` option is specified then the mount is ID mapped using the container target user namespace. This is an experimental feature and can change at any time without notice. The `idmap` option supports a custom mapping that can be different than the user namespace used by the container. The mapping can be specified after the `idmap` option like: `idmap=uids=0-1-10#10-11-10;gids=0-100-10`. For each triplet, the first value is the start of the backing file system IDs that are mapped to the second value on the host. The length of this mapping is given in the third value. Multiple ranges are separated with `#`. These values are written to the `/proc/$PID/uid_map` and `/proc/$PID/gid_map` files to create the user namespace for the idmapped mount. The only two options that are currently supported after `idmap` are `uids` and `gids`. When a custom mapping is specified, a new user namespace is created for the idmapped mount. If no option is specified, then the container user namespace is used. If the specified mapping is prepended with a '@' then the mapping is considered relative to the container user namespace. The host ID for the mapping is changed to account for the relative position of the container user in the container user namespace. For example, the mapping: `uids=@1-3-10`, given a configuration like ``` "uidMappings": [ { "containerID": 0, "hostID": 0, "size": 1 }, { "containerID": 1, "hostID": 2, "size": 1000 } ] ``` will be converted to the absolute value `uids=1-4-10`, where 4 is calculated by adding 3 (container ID in the `uids=` mapping) and 1 (`hostID - containerID` for the user namespace mapping where `containerID = 1` is found). The current implementation doesn't take into account multiple user namespace ranges, so it is the caller's responsibility to split a mapping if it overlaps multiple ranges in the user namespace. In such a case, there won't be any error reported. ## Automatically create user namespace When running as user different than root, an user namespace is automatically created even if it is not specified in the config file. The current user is mapped to the ID 0 in the container, and any additional id specified in the files `/etc/subuid` and `/etc/subgid` is automatically added starting with ID 1. # CGROUP v2 **Note**: cgroup v2 does not yet support control of realtime processes and the cpu controller can only be enabled when all RT processes are in the root cgroup. This will make crun fail while running alongside RT processes. If the cgroup configuration found is for cgroup v1, crun attempts a conversion when running on a cgroup v2 system. These are the OCI resources currently supported with cgroup v2 and how they are converted when needed from the cgroup v1 configuration. ## Memory controller | OCI (x) | cgroup 2 value (y) | conversion | comment | |---|---|---|---| | limit | memory.max | y = x || | swap | memory.swap.max | y = x - memory_limit | the swap limit on cgroup v1 includes the memory usage too | | reservation | memory.low | y = x || ## PIDs controller | OCI (x) | cgroup 2 value (y) | conversion | comment | |---|---|---|---| | limit | pids.max | y = x || ## CPU controller | OCI (x) | cgroup 2 value (y) | conversion | comment | |---|---|---|---| | shares | cpu.weight | y = (1 + ((x - 2) * 9999) / 262142) | convert from [2-262144] to [1-10000]| | period | cpu.max | y = x| period and quota are written together| | quota | cpu.max | y = x| period and quota are written together| ## blkio controller | OCI (x) | cgroup 2 value (y) | conversion | comment | |---|---|---|---| | weight | io.bfq.weight | y = x || | weight_device | io.bfq.weight | y = x || | weight | io.weight (fallback) | y = 1 + (x-10)*9999/990 | convert linearly from [10-1000] to [1-10000] | | weight_device | io.weight (fallback) | y = 1 + (x-10)*9999/990 | convert linearly from [10-1000] to [1-10000] | | rbps | io.max | y=x || | wbps | io.max | y=x || | riops | io.max |y=x || | wiops | io.max |y=x || ## cpuset controller | OCI (x) | cgroup 2 value (y) | conversion | comment | |---|---|---|---| | cpus | cpuset.cpus | y = x || | mems | cpuset.mems | y = x || ## hugetlb controller | OCI (x) | cgroup 2 value (y) | conversion | comment | |---|---|---|---| | .limit_in_bytes | hugetlb..max | y = x || crun-1.16.1/crun.10000644000000000000000000005237514514171717012012 0ustar0000000000000000.nh .TH crun 1 "User Commands" .SH NAME .PP crun - a fast and lightweight OCI runtime .SH SYNOPSIS .PP crun [global options] command [command options] [arguments...] .SH DESCRIPTION .PP crun is a command line program for running Linux containers that follow the Open Container Initiative (OCI) format. .SH COMMANDS .PP \fBcreate\fP Create a container. The runtime detaches from the container process once the container environment is created. It is necessary to successively use \fB\fCstart\fR for starting the container. .PP \fBdelete\fP Remove definition for a container. .PP \fBexec\fP Exec a command in a running container. .PP \fBlist\fP List known containers. .PP \fBkill\fP Send the specified signal to the container init process. If no signal is specified, SIGTERM is used. .PP \fBps\fP Show the processes running in a container. .PP \fBrun\fP Create and immediately start a container. .PP \fBspec\fP Generate a configuration file. .PP \fBstart\fP Start a container that was previously created. A container cannot be started multiple times. .PP \fBstate\fP Output the state of a container. .PP \fBpause\fP Pause all the processes in the container. .PP \fBresume\fP Resume the processes in the container. .PP \fBupdate\fP Update container resource constraints. .PP \fBcheckpoint\fP Checkpoint a running container using CRIU .PP \fBrestore\fP Restore a container from a checkpoint .SH STATE .PP By default, when running as root user, crun saves its state under the \fB/run/crun\fP directory. As unprivileged user, instead the \fIXDG_RUNTIME_DIR\fP environment variable is honored, and the directory \fB$XDG_RUNTIME_DIR/crun\fP is used. The global option \fB--root\fP overrides this setting. .SH GLOBAL OPTIONS .PP \fB--debug\fP Produce verbose output. .PP \fB--log\fP=\fILOG-DESTINATION\fP Define the destination for the error and warning messages generated by crun. If the error happens late in the container init process, when crun already stopped watching it, then it will be printed to the container stderr. .PP It is specified in the form \fIBACKEND:SPECIFIER\fP\&. .PP These following backends are supported: .RS .IP \(bu 2 file:PATH .IP \(bu 2 journald:IDENTIFIER .IP \(bu 2 syslog:IDENTIFIER .RE .PP If no backend is specified, then \fIfile:\fP is used by default. .PP \fB--log-format\fP=\fIFORMAT\fP Define the format of the log messages. It can either be \fBtext\fP, or \fBjson\fP\&. The default is \fBtext\fP\&. .PP \fB--no-pivot\fP Use \fB\fCchroot(2)\fR instead of \fB\fCpivot_root(2)\fR when creating the container. This option is not safe, and should be avoided. .PP \fB--root\fP=\fIDIR\fP Defines where to store the state for crun containers. .PP \fB--systemd-cgroup\fP Use systemd for configuring cgroups. If not specified, the cgroup is created directly using the cgroupfs backend. .PP \fB--cgroup-manager\fP=\fIMANAGER\fP Specify what cgroup manager must be used. Permitted values are \fBcgroupfs\fP, \fBsystemd\fP and \fBdisabled\fP\&. .PP \fB-?\fP, \fB--help\fP Print a help list. .PP \fB--usage\fP Print a short usage message. .PP \fB-V\fP, \fB--version\fP Print program version .SH CREATE OPTIONS .PP crun [global options] create [options] CONTAINER .PP \fB--bundle\fP=\fIPATH\fP Path to the OCI bundle, by default it is the current directory. .PP \fB--config\fP=\fIFILE\fP Override the configuration file to use. The default value is \fBconfig.json\fP\&. .PP \fB--console-socket\fP=\fISOCKET\fP Path to a UNIX socket that will receive the ptmx end of the tty for the container. .PP \fB--no-new-keyring\fP Keep the same session key .PP \fB--preserve-fds\fP=\fIN\fP Additional number of FDs to pass into the container. .PP \fB--pid-file\fP=\fIPATH\fP Path to the file that will contain the container process PID. .SH RUN OPTIONS .PP crun [global options] run [options] CONTAINER .PP \fB--bundle\fP=\fIBUNDLE\fP Path to the OCI bundle, by default it is the current directory. .PP \fB--config\fP=\fIFILE\fP Override the configuration file to use. The default value is \fBconfig.json\fP\&. .PP \fB--console-socket\fP=\fISOCKET\fP Path to a UNIX socket that will receive the ptmx end of the tty for the container. .PP \fB--no-new-keyring\fP Keep the same session key. .PP \fB--preserve-fds\fP=\fIN\fP Additional number of FDs to pass into the container. .PP \fB--pid-file\fP=\fIPATH\fP Path to the file that will contain the container process PID. .PP \fB--detach\fP Detach the container process from the current session. .SH DELETE OPTIONS .PP crun [global options] delete [options] CONTAINER .PP \fB--force\fP Delete the container even if it is still running. .PP \fB--regex\fP=\fIREGEX\fP Delete all the containers that satisfy the specified regex. .SH EXEC OPTIONS .PP crun [global options] exec [options] CONTAINER CMD .PP \fB--apparmor\fP=\fIPROFILE\fP Set the apparmor profile for the process. .PP \fB--console-socket\fP=\fISOCKET\fP Path to a UNIX socket that will receive the ptmx end of the tty for the container. .PP \fB--cwd\fP=\fIPATH\fP Set the working directory for the process to PATH. .PP \fB--cap\fP=\fICAP\fP Specify an additional capability to add to the process. .PP \fB--detach\fP Detach the container process from the current session. .PP \fB--cgroup\fP=\fIPATH\fP Specify a sub-cgroup path inside the container cgroup. The path must already exist in the container cgroup. .PP \fB--env\fP=\fIENV\fP Specify an environment variable. .PP \fB--no-new-privs\fP Set the no new privileges value for the process. .PP \fB--preserve-fds\fP=\fIN\fP Additional number of FDs to pass into the container. .PP \fB--process\fP=\fIFILE\fP Path to a file containing the process JSON configuration. .PP \fB--process-label\fP=\fIVALUE\fP Set the asm process label for the process commonly used with selinux. .PP \fB--pid-file\fP=\fIPATH\fP Path to the file that will contain the new process PID. .PP \fB-t\fP \fB--tty\fP Allocate a pseudo TTY. .PP **-u \fIUSERSPEC\fP \fB--user\fP=\fIUSERSPEC\fP Specify the user in the form UID[:GID]. .SH LIST OPTIONS .PP crun [global options] list [options] .PP \fB-q\fP \fB--quiet\fP Show only the container ID. .SH KILL OPTIONS .PP crun [global options] kill [options] CONTAINER SIGNAL .PP \fB--all\fP Kill all the processes in the container. .PP \fB--regex\fP=\fIREGEX\fP Kill all the containers that satisfy the specified regex. .SH PS OPTIONS .PP crun [global options] ps [options] .PP \fB--format\fP=\fIFORMAT\fP Specify the output format. It must be either \fB\fCtable\fR or \fB\fCjson\fR\&. By default \fB\fCtable\fR is used. .SH SPEC OPTIONS .PP crun [global options] spec [options] .PP \fB-b\fP \fIDIR\fP \fB--bundle\fP=\fIDIR\fP Path to the root of the bundle dir (default "."). .PP \fB--rootless\fP Generate a config.json file that is usable by an unprivileged user. .SH UPDATE OPTIONS .PP crun [global options] update [options] CONTAINER .PP \fB--blkio-weight\fP=\fIVALUE\fP Specifies per cgroup weight. .PP \fB--cpu-period\fP=\fIVALUE\fP CPU CFS period to be used for hardcapping. .PP \fB--cpu-quota\fP=\fIVALUE\fP CPU CFS hardcap limit. .PP \fB--cpu-rt-period\fP=\fIVALUE\fP CPU realtime period to be used for hardcapping. .PP \fB--cpu-rt-runtime\fP=\fIVALUE\fP CPU realtime hardcap limit. .PP \fB--cpu-share\fP=\fIVALUE\fP CPU shares. .PP \fB--cpuset-cpus\fP=\fIVALUE\fP CPU(s) to use. .PP \fB--cpuset-mems\fP=\fIVALUE\fP Memory node(s) to use. .PP \fB--kernel-memory\fP=\fIVALUE\fP Kernel memory limit. .PP \fB--kernel-memory-tcp\fP=\fIVALUE\fP Kernel memory limit for TCP buffer. .PP \fB--memory\fP=\fIVALUE\fP Memory limit. .PP \fB--memory-reservation\fP=\fIVALUE\fP Memory reservation or soft_limit. .PP \fB--memory-swap\fP=\fIVALUE\fP Total memory usage. .PP \fB--pids-limit\fP=\fIVALUE\fP Maximum number of pids allowed in the container. .PP \fB-r\fP, \fB--resources\fP=\fIFILE\fP Path to the file containing the resources to update. .SH CHECKPOINT OPTIONS .PP crun [global options] checkpoint [options] CONTAINER .PP \fB--image-path\fP=\fIDIR\fP Path for saving CRIU image files .PP \fB--work-path\fP=\fIDIR\fP Path for saving work files and logs .PP \fB--leave-running\fP Leave the process running after checkpointing .PP \fB--tcp-established\fP Allow open TCP connections .PP \fB--ext-unix-sk\fP Allow external UNIX sockets .PP \fB--shell-job\fP Allow shell jobs .PP \fB--pre-dump\fP Only checkpoint the container's memory without stopping the container. It is not possible to restore a container from a pre-dump. A pre-dump always needs a final checkpoint (without \fB--pre-dump\fP). It is possible to make as many pre-dumps as necessary. For a second pre-dump or for a final checkpoint it is necessary to use \fB--parent-path\fP to point crun (and thus CRIU) to the pre-dump. .PP \fB--parent-path\fP=\fIDIR\fP Doing multiple pre-dumps or the final checkpoint after one or multiple pre-dumps requires that crun (and thus CRIU) knows the location of the pre-dump. It is important to use a relative path from the actual checkpoint directory specified via \fB--image-path\fP\&. It will fail if an absolute path is used. .PP \fB--manage-cgroups-mode\fP=\fIMODE\fP Specify which CRIU manage cgroup mode should be used. Permitted values are \fBsoft\fP, \fBignore\fP, \fBfull\fP or \fBstrict\fP\&. Default is \fBsoft\fP\&. .SH RESTORE OPTIONS .PP crun [global options] restore [options] CONTAINER .PP \fB-b DIR\fP \fB--bundle\fP=\fIDIR\fP Container bundle directory (default ".") .PP \fB--image-path\fP=\fIDIR\fP Path for saving CRIU image files .PP \fB--work-path\fP=\fIDIR\fP Path for saving work files and logs .PP \fB--tcp-established\fP Allow open TCP connections .PP \fB--ext-unix\fP Allow external UNIX sockets .PP \fB--shell-job\fP Allow shell jobs .PP \fB--detach\fP Detach from the container's process .PP \fB--pid-file\fP=\fIFILE\fP Where to write the PID of the container .PP \fB--manage-cgroups-mode\fP=\fIMODE\fP Specify which CRIU manage cgroup mode should be used. Permitted values are \fBsoft\fP, \fBignore\fP, \fBfull\fP or \fBstrict\fP\&. Default is \fBsoft\fP\&. .SH Extensions to OCI .SH \fB\fCrun.oci.mount_context_type=context\fR .PP Set the mount context type on volumes mounted with SELinux labels. .PP Valid context types are: context (default) fscontext defcontext rootcontext .PP More information on how the context mount flags works see the \fB\fCmount(8)\fR man page. .SH \fB\fCrun.oci.seccomp.receiver=PATH\fR .PP If the annotation \fB\fCrun.oci.seccomp.receiver=PATH\fR is specified, the seccomp listener is sent to the UNIX socket listening on the specified path. It can also set with the \fB\fCRUN_OCI_SECCOMP_RECEIVER\fR environment variable. It is an experimental feature, and the annotation will be removed once it is supported in the OCI runtime specs. It must be an absolute path. .SH \fB\fCrun.oci.seccomp.plugins=PATH\fR .PP If the annotation \fB\fCrun.oci.seccomp.plugins=PLUGIN1[:PLUGIN2]...\fR is specified, the seccomp listener fd is handled through the specified plugins. The plugin must either be an absolute path or a file name that is looked up by \fB\fCdlopen(3)\fR\&. More information on how the lookup is performed are available on the \fB\fCld.so(8)\fR man page. .SH \fB\fCrun.oci.seccomp_fail_unknown_syscall=1\fR .PP If the annotation \fB\fCrun.oci.seccomp_fail_unknown_syscall\fR is present, then crun will fail when an unknown syscall is encountered in the seccomp configuration. .SH \fB\fCrun.oci.seccomp_bpf_data=PATH\fR .PP If the annotation \fB\fCrun.oci.seccomp_bpf_data\fR is present, then crun ignores the seccomp section in the OCI configuration file and use the specified data as the raw data to the \fB\fCseccomp(SECCOMP_SET_MODE_FILTER)\fR syscall. The data must be encoded in base64. .PP It is an experimental feature, and the annotation will be removed once it is supported in the OCI runtime specs. .SH \fB\fCrun.oci.keep_original_groups=1\fR .PP If the annotation \fB\fCrun.oci.keep_original_groups\fR is present, then crun will skip the \fB\fCsetgroups\fR syscall that is used to either set the additional groups specified in the OCI configuration, or to reset the list of additional groups if none is specified. .SH \fB\fCrun.oci.pidfd_receiver=PATH\fR .PP It is an experimental feature and will be removed once the feature is in the OCI runtime specs. .PP If present, specify the path to the UNIX socket that will receive the pidfd for the container process. .SH \fB\fCrun.oci.systemd.force_cgroup_v1=/PATH\fR .PP If the annotation \fB\fCrun.oci.systemd.force_cgroup_v1=/PATH\fR is present, then crun will override the specified mount point \fB\fC/PATH\fR with a cgroup v1 mount made of a single hierarchy \fB\fCnone,name=systemd\fR\&. It is useful to run on a cgroup v2 system containers using older versions of systemd that lack support for cgroup v2. .PP \fBNote\fP: Your container host has to have the cgroup v1 mount already present, otherwise this will not work. If you want to run the container rootless, the user it runs under has to have permissions to this mountpoint. .PP For example, as root: .PP .RS .nf mkdir /sys/fs/cgroup/systemd mount cgroup -t cgroup /sys/fs/cgroup/systemd -o none,name=systemd,xattr chown -R the_user.the_user /sys/fs/cgroup/systemd .fi .RE .SH \fB\fCrun.oci.systemd.subgroup=SUBGROUP\fR .PP Override the name for the systemd sub cgroup created under the systemd scope, so the final cgroup will be like: .PP .RS .nf /sys/fs/cgroup/$PATH/$SUBGROUP .fi .RE .PP When it is set to the empty string, a sub cgroup is not created. .PP If not specified, it defaults to \fB\fCcontainer\fR on cgroup v2, and to \fB\fC""\fR on cgroup v1. .PP e.g. .PP .RS .nf /sys/fs/cgroup//system.slice/foo-352700.scope/container .fi .RE .SH \fB\fCrun.oci.delegate-cgroup=DELEGATED-CGROUP\fR .PP If the \fB\fCrun.oci.systemd.subgroup\fR annotation is specified, yet another sub-cgroup is created and the container process is moved here. .PP If a cgroup namespace is used, the cgroup namespace is created before moving the container to the delegated cgroup. .PP .RS .nf /sys/fs/cgroup/$PATH/$SUBGROUP/$DELEGATED-CGROUP .fi .RE .PP The runtime doesn't apply any limit to the \fB\fC$DELEGATED-CGROUP\fR sub-cgroup, the runtime uses only \fB\fC$PATH/$SUBGROUP\fR\&. .PP The container payload fully manages \fB\fC$DELEGATE-CGROUP\fR, the limits applied to \fB\fC$PATH/$SUBGROUP\fR still applies to \fB\fC$DELEGATE-CGROUP\fR\&. .PP Since cgroup delegation is not safe on cgroup v1, this option is supported only on cgroup v2. .SH \fB\fCrun.oci.hooks.stdout=FILE\fR .PP If the annotation \fB\fCrun.oci.hooks.stdout\fR is present, then crun will open the specified file and use it as the stdout for the hook processes. The file is opened in append mode and it is created if it doesn't already exist. .SH \fB\fCrun.oci.hooks.stderr=FILE\fR .PP If the annotation \fB\fCrun.oci.hooks.stderr\fR is present, then crun will open the specified file and use it as the stderr for the hook processes. The file is opened in append mode and it is created if it doesn't already exist. .SH \fB\fCrun.oci.handler=HANDLER\fR .PP It is an experimental feature. .PP If specified, run the specified handler for execing the container. The only supported values are \fB\fCkrun\fR and \fB\fCwasm\fR\&. .RS .IP \(bu 2 \fB\fCkrun\fR: When \fB\fCkrun\fR is specified, the \fB\fClibkrun.so\fR shared object is loaded and it is used to launch the container using libkrun. .IP \(bu 2 \fB\fCwasm\fR: If specified, run the wasm handler for container. Allows running wasm workload natively. Accepts a \fB\fC\&.wasm\fR binary as input and if \fB\fC\&.wat\fR is provided it will be automatically compiled into a wasm module. Stdout of wasm module is relayed back via crun. .RE .SH tmpcopyup mount options .PP If the \fB\fCtmpcopyup\fR option is specified for a tmpfs, then the path that is shadowed by the tmpfs mount is recursively copied up to the tmpfs itself. .SH copy-symlink mount options .PP If the \fB\fCcopy-symlink\fR option is specified, if the source of a bind mount is a symlink, the symlink is recreated at the specified destination instead of attempting a mount that would resolve the symlink itself. If the destination already exists and it is not a symlink with the expected content, crun will return an error. .SH r$FLAG mount options .PP If a \fB\fCr$FLAG\fR mount option is specified then the flag \fB\fC$FLAG\fR is set recursively for each children mount. .PP These flags are supported: .RS .IP \(bu 2 "rro" .IP \(bu 2 "rrw" .IP \(bu 2 "rsuid" .IP \(bu 2 "rnosuid" .IP \(bu 2 "rdev" .IP \(bu 2 "rnodev" .IP \(bu 2 "rexec" .IP \(bu 2 "rnoexec" .IP \(bu 2 "rsync" .IP \(bu 2 "rasync" .IP \(bu 2 "rdirsync" .IP \(bu 2 "rmand" .IP \(bu 2 "rnomand" .IP \(bu 2 "ratime" .IP \(bu 2 "rnoatime" .IP \(bu 2 "rdiratime" .IP \(bu 2 "rnodiratime" .IP \(bu 2 "rrelatime" .IP \(bu 2 "rnorelatime" .IP \(bu 2 "rstrictatime" .IP \(bu 2 "rnostrictatime" .RE .SH idmap mount options .PP If the \fB\fCidmap\fR option is specified then the mount is ID mapped using the container target user namespace. This is an experimental feature and can change at any time without notice. .PP The \fB\fCidmap\fR option supports a custom mapping that can be different than the user namespace used by the container. .PP The mapping can be specified after the \fB\fCidmap\fR option like: \fB\fCidmap=uids=0-1-10#10-11-10;gids=0-100-10\fR\&. .PP For each triplet, the first value is the start of the backing file system IDs that are mapped to the second value on the host. The length of this mapping is given in the third value. .PP Multiple ranges are separated with \fB\fC#\fR\&. .PP These values are written to the \fB\fC/proc/$PID/uid_map\fR and \fB\fC/proc/$PID/gid_map\fR files to create the user namespace for the idmapped mount. .PP The only two options that are currently supported after \fB\fCidmap\fR are \fB\fCuids\fR and \fB\fCgids\fR\&. .PP When a custom mapping is specified, a new user namespace is created for the idmapped mount. .PP If no option is specified, then the container user namespace is used. .PP If the specified mapping is prepended with a '@' then the mapping is considered relative to the container user namespace. The host ID for the mapping is changed to account for the relative position of the container user in the container user namespace. .PP For example, the mapping: \fB\fCuids=@1-3-10\fR, given a configuration like .PP .RS .nf "uidMappings": [ { "containerID": 0, "hostID": 0, "size": 1 }, { "containerID": 1, "hostID": 2, "size": 1000 } ] .fi .RE .PP will be converted to the absolute value \fB\fCuids=1-4-10\fR, where 4 is calculated by adding 3 (container ID in the \fB\fCuids=\fR mapping) and 1 (\fB\fChostID - containerID\fR for the user namespace mapping where \fB\fCcontainerID = 1\fR is found). .PP The current implementation doesn't take into account multiple user namespace ranges, so it is the caller's responsibility to split a mapping if it overlaps multiple ranges in the user namespace. In such a case, there won't be any error reported. .SH Automatically create user namespace .PP When running as user different than root, an user namespace is automatically created even if it is not specified in the config file. The current user is mapped to the ID 0 in the container, and any additional id specified in the files \fB\fC/etc/subuid\fR and \fB\fC/etc/subgid\fR is automatically added starting with ID 1. .SH CGROUP v2 .PP \fBNote\fP: cgroup v2 does not yet support control of realtime processes and the cpu controller can only be enabled when all RT processes are in the root cgroup. This will make crun fail while running alongside RT processes. .PP If the cgroup configuration found is for cgroup v1, crun attempts a conversion when running on a cgroup v2 system. .PP These are the OCI resources currently supported with cgroup v2 and how they are converted when needed from the cgroup v1 configuration. .SH Memory controller .TS allbox; l l l l l l l l . \fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR limit memory.max y = x swap memory.swap.max y = x - memory_limit T{ the swap limit on cgroup v1 includes the memory usage too T} reservation memory.low y = x .TE .SH PIDs controller .TS allbox; l l l l l l l l . \fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR limit pids.max y = x .TE .SH CPU controller .TS allbox; l l l l l l l l . \fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR shares cpu.weight T{ y = (1 + ((x - 2) * 9999) / 262142) T} T{ convert from [2-262144] to [1-10000] T} period cpu.max y = x T{ period and quota are written together T} quota cpu.max y = x T{ period and quota are written together T} .TE .SH blkio controller .TS allbox; l l l l l l l l . \fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR weight io.bfq.weight y = x weight_device io.bfq.weight y = x weight io.weight (fallback) y = 1 + (x-10)*9999/990 T{ convert linearly from [10-1000] to [1-10000] T} weight_device io.weight (fallback) y = 1 + (x-10)*9999/990 T{ convert linearly from [10-1000] to [1-10000] T} rbps io.max y=x wbps io.max y=x riops io.max y=x wiops io.max y=x .TE .SH cpuset controller .TS allbox; l l l l l l l l . \fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR cpus cpuset.cpus y = x mems cpuset.mems y = x .TE .SH hugetlb controller .TS allbox; l l l l l l l l . \fB\fCOCI (x)\fR \fB\fCcgroup 2 value (y)\fR \fB\fCconversion\fR \fB\fCcomment\fR \&.limit_in_bytes hugetlb.\&.max y = x .TE crun-1.16.1/libcrun.lds0000664000000000000000000000040113677104573013111 0ustar0000000000000000{ global: /* Not all the libcrun_ functions are exported, only those marked LIBCRUN_PUBLIC. */ libcrun_*; /* libocispec functions */ runtime_spec_*; free_runtime_spec_*; make_runtime_spec_*; local: *; }; crun-1.16.1/krun.1.md0000644000000000000000000000205414504567214012406 0ustar0000000000000000crun 1 "User Commands" ================================================== # NAME krun - crun based OCI runtime using libkrun to run containerized programs in isolated KVM environments # SYNOPSIS krun [global options] command [command options] [arguments...] # DESCRIPTION krun is a sub package of the crun command line program for running Linux containers that follow the Open Container Initiative (OCI) format. The krun command is a symbolic link to the crun executable, that tells crun to run in krun mode. krun uses the dynamic libkrun library to run processes in an isolated environment using KVM Virtualization. libkrun integrates a VMM (Virtual Machine Monitor, the userspace side of a Hypervisor) with the minimum amount of emulated devices required for its purpose, abstracting most of the complexity from Virtual Machine management. Because of the additional isolation, sharing content with processes and other containers outside of the krun VM is more difficult. # COMMANDS See crun.1 man page for the commands available to krun # SEE ALSO crun.1 crun-1.16.1/krun.10000644000000000000000000000205414504567214012007 0ustar0000000000000000.nh .TH crun 1 "User Commands" .SH NAME .PP krun - crun based OCI runtime using libkrun to run containerized programs in isolated KVM environments .SH SYNOPSIS .PP krun [global options] command [command options] [arguments...] .SH DESCRIPTION .PP krun is a sub package of the crun command line program for running Linux containers that follow the Open Container Initiative (OCI) format. The krun command is a symbolic link to the crun executable, that tells crun to run in krun mode. .PP krun uses the dynamic libkrun library to run processes in an isolated environment using KVM Virtualization. .PP libkrun integrates a VMM (Virtual Machine Monitor, the userspace side of a Hypervisor) with the minimum amount of emulated devices required for its purpose, abstracting most of the complexity from Virtual Machine management. .PP Because of the additional isolation, sharing content with processes and other containers outside of the krun VM is more difficult. .SH COMMANDS .PP See crun.1 man page for the commands available to krun .SH SEE ALSO .PP crun.1 crun-1.16.1/libocispec/0000755000000000000000000000000014656670214013064 5ustar0000000000000000crun-1.16.1/libocispec/build-aux/0000755000000000000000000000000014656670214014756 5ustar0000000000000000crun-1.16.1/libocispec/build-aux/compile0000755000000000000000000001635014656670151016341 0ustar0000000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 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* | MSYS*) 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/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.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 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/libocispec/build-aux/config.guess0000755000000000000000000012617314656670151017310 0ustar0000000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-08-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 1 2 13 15 trap 'exitcode=$?; test -z "$tmp" || rm -fr "$tmp"; exit $exitcode' 0 set_cc_for_build() { : "${TMPDIR=/tmp}" # shellcheck disable=SC2039 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$driver" break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) UNAME_REL="`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" case `isainfo -b` in 32) echo i386-pc-solaris2"$UNAME_REL" ;; 64) echo x86_64-pc-solaris2"$UNAME_REL" ;; esac exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi else echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf fi exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; *:Minix:*:*) echo "$UNAME_MACHINE"-unknown-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: crun-1.16.1/libocispec/build-aux/config.sub0000755000000000000000000007530414656670151016752 0ustar0000000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-08-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type IFS="-" read -r field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 os=$maybe_os ;; android-linux) basic_machine=$field1-unknown os=linux-android ;; *) basic_machine=$field1-$field2 os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any patern case $field1-$field2 in decstation-3100) basic_machine=mips-dec os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 os= ;; *) basic_machine=$field1 os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc os=bsd ;; a29khif) basic_machine=a29k-amd os=udi ;; adobe68k) basic_machine=m68010-adobe os=scout ;; alliant) basic_machine=fx80-alliant os= ;; altos | altos3068) basic_machine=m68k-altos os= ;; am29k) basic_machine=a29k-none os=bsd ;; amdahl) basic_machine=580-amdahl os=sysv ;; amiga) basic_machine=m68k-unknown os= ;; amigaos | amigados) basic_machine=m68k-unknown os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=sysv4 ;; apollo68) basic_machine=m68k-apollo os=sysv ;; apollo68bsd) basic_machine=m68k-apollo os=bsd ;; aros) basic_machine=i386-pc os=aros ;; aux) basic_machine=m68k-apple os=aux ;; balance) basic_machine=ns32k-sequent os=dynix ;; blackfin) basic_machine=bfin-unknown os=linux ;; cegcc) basic_machine=arm-unknown os=cegcc ;; convex-c1) basic_machine=c1-convex os=bsd ;; convex-c2) basic_machine=c2-convex os=bsd ;; convex-c32) basic_machine=c32-convex os=bsd ;; convex-c34) basic_machine=c34-convex os=bsd ;; convex-c38) basic_machine=c38-convex os=bsd ;; cray) basic_machine=j90-cray os=unicos ;; crds | unos) basic_machine=m68k-crds os= ;; da30) basic_machine=m68k-da30 os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec os= ;; delta88) basic_machine=m88k-motorola os=sysv3 ;; dicos) basic_machine=i686-pc os=dicos ;; djgpp) basic_machine=i586-pc os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=ose ;; gmicro) basic_machine=tron-gmicro os=sysv ;; go32) basic_machine=i386-pc os=go32 ;; h8300hms) basic_machine=h8300-hitachi os=hms ;; h8300xray) basic_machine=h8300-hitachi os=xray ;; h8500hms) basic_machine=h8500-hitachi os=hms ;; harris) basic_machine=m88k-harris os=sysv3 ;; hp300) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=bsd ;; hp300hpux) basic_machine=m68k-hp os=hpux ;; hppaosf) basic_machine=hppa1.1-hp os=osf ;; hppro) basic_machine=hppa1.1-hp os=proelf ;; i386mach) basic_machine=i386-mach os=mach ;; vsta) basic_machine=i386-pc os=vsta ;; isi68 | isi) basic_machine=m68k-isi os=sysv ;; m68knommu) basic_machine=m68k-unknown os=linux ;; magnum | m3230) basic_machine=mips-mips os=sysv ;; merlin) basic_machine=ns32k-utek os=sysv ;; mingw64) basic_machine=x86_64-pc os=mingw64 ;; mingw32) basic_machine=i686-pc os=mingw32 ;; mingw32ce) basic_machine=arm-unknown os=mingw32ce ;; monitor) basic_machine=m68k-rom68k os=coff ;; morphos) basic_machine=powerpc-unknown os=morphos ;; moxiebox) basic_machine=moxie-unknown os=moxiebox ;; msdos) basic_machine=i386-pc os=msdos ;; msys) basic_machine=i686-pc os=msys ;; mvs) basic_machine=i370-ibm os=mvs ;; nacl) basic_machine=le32-unknown os=nacl ;; ncr3000) basic_machine=i486-ncr os=sysv4 ;; netbsd386) basic_machine=i386-pc os=netbsd ;; netwinder) basic_machine=armv4l-rebel os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=newsos ;; news1000) basic_machine=m68030-sony os=newsos ;; necv70) basic_machine=v70-nec os=sysv ;; nh3000) basic_machine=m68k-harris os=cxux ;; nh[45]000) basic_machine=m88k-harris os=cxux ;; nindy960) basic_machine=i960-intel os=nindy ;; mon960) basic_machine=i960-intel os=mon960 ;; nonstopux) basic_machine=mips-compaq os=nonstopux ;; os400) basic_machine=powerpc-ibm os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=ose ;; os68k) basic_machine=m68k-none os=os68k ;; paragon) basic_machine=i860-intel os=osf ;; parisc) basic_machine=hppa-unknown os=linux ;; pw32) basic_machine=i586-unknown os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=rdos ;; rdos32) basic_machine=i386-pc os=rdos ;; rom68k) basic_machine=m68k-rom68k os=coff ;; sa29200) basic_machine=a29k-amd os=udi ;; sei) basic_machine=mips-sei os=seiux ;; sequent) basic_machine=i386-sequent os= ;; sps7) basic_machine=m68k-bull os=sysv2 ;; st2000) basic_machine=m68k-tandem os= ;; stratus) basic_machine=i860-stratus os=sysv4 ;; sun2) basic_machine=m68000-sun os= ;; sun2os3) basic_machine=m68000-sun os=sunos3 ;; sun2os4) basic_machine=m68000-sun os=sunos4 ;; sun3) basic_machine=m68k-sun os= ;; sun3os3) basic_machine=m68k-sun os=sunos3 ;; sun3os4) basic_machine=m68k-sun os=sunos4 ;; sun4) basic_machine=sparc-sun os= ;; sun4os3) basic_machine=sparc-sun os=sunos3 ;; sun4os4) basic_machine=sparc-sun os=sunos4 ;; sun4sol2) basic_machine=sparc-sun os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun os= ;; sv1) basic_machine=sv1-cray os=unicos ;; symmetry) basic_machine=i386-sequent os=dynix ;; t3e) basic_machine=alphaev5-cray os=unicos ;; t90) basic_machine=t90-cray os=unicos ;; toad1) basic_machine=pdp10-xkl os=tops20 ;; tpf) basic_machine=s390x-ibm os=tpf ;; udi29k) basic_machine=a29k-amd os=udi ;; ultra3) basic_machine=a29k-nyu os=sym1 ;; v810 | necv810) basic_machine=v810-nec os=none ;; vaxv) basic_machine=vax-dec os=sysv ;; vms) basic_machine=vax-dec os=vms ;; vxworks960) basic_machine=i960-wrs os=vxworks ;; vxworks68) basic_machine=m68k-wrs os=vxworks ;; vxworks29k) basic_machine=a29k-wrs os=vxworks ;; xbox) basic_machine=i686-pc os=mingw32 ;; ymp) basic_machine=ymp-cray os=unicos ;; *) basic_machine=$1 os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi os=${os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray os=${os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $os in irix*) ;; *) os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony os=newsos ;; next | m*-next) cpu=m68k vendor=next case $os in nextstep* ) ;; ns2*) os=nextstep2 ;; *) os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde os=${os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) IFS="-" read -r cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x$os != x ] then case $os in # First match some system type aliases that might get confused # with valid system types. # solaris* is a basic system type, with this one exception. auroraux) os=auroraux ;; bluegene*) os=cnk ;; solaris1 | solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; solaris) os=solaris2 ;; unixware*) os=sysv4.2uw ;; gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) es1800*) os=ose ;; # Some version numbers need modification chorusos*) os=chorusos ;; isc) os=isc2.2 ;; sco6) os=sco5v6 ;; sco5) os=sco3.2v5 ;; sco4) os=sco3.2v4 ;; sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` ;; sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; scout) # Don't match below ;; sco*) os=sco3.2v2 ;; psos*) os=psos ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # sysv* is not here because it comes later, after sysvr4. gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | kopensolaris* | plan9* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | knetbsd* | mirbsd* | netbsd* \ | bitrig* | openbsd* | solidbsd* | libertybsd* \ | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ | chorusrdb* | cegcc* | glidix* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ | linux-newlib* | linux-musl* | linux-uclibc* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ | interix* | uwin* | mks* | rhapsody* | darwin* \ | openstep* | oskit* | conix* | pw32* | nonstopux* \ | storm-chaos* | tops10* | tenex* | tops20* | its* \ | os2* | vos* | palmos* | uclinux* | nucleus* \ | morphos* | superux* | rtmk* | windiss* \ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; qnx*) case $cpu in x86 | i*86) ;; *) os=nto-$os ;; esac ;; hiux*) os=hiuxwe2 ;; nto-qnx*) ;; nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; sim | xray | os68k* | v88r* \ | windows* | osx | abug | netware* | os9* \ | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) ;; linux-dietlibc) os=linux-dietlibc ;; linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; lynx*178) os=lynxos178 ;; lynx*5) os=lynxos5 ;; lynx*) os=lynxos ;; mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; opened*) os=openedition ;; os400*) os=os400 ;; sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; wince*) os=wince ;; utek*) os=bsd ;; dynix*) os=bsd ;; acis*) os=aos ;; atheos*) os=atheos ;; syllable*) os=syllable ;; 386bsd) os=bsd ;; ctix* | uts*) os=sysv ;; nova*) os=rtmk-nova ;; ns2) os=nextstep2 ;; nsk*) os=nsk ;; # Preserve the version number of sinix5. sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; sinix*) os=sysv4 ;; tpf*) os=tpf ;; triton*) os=sysv3 ;; oss*) os=sysv3 ;; svr4*) os=sysv4 ;; svr3) os=sysv3 ;; sysvr4) os=sysv4 ;; # This must come after sysvr4. sysv*) ;; ose*) os=ose ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) os=mint ;; zvmoe) os=zvmoe ;; dicos*) os=dicos ;; pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $cpu in arm*) os=eabi ;; *) os=elf ;; esac ;; nacl*) ;; ios) ;; none) ;; *-eabi) ;; *) echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $cpu-$vendor in score-*) os=elf ;; spu-*) os=elf ;; *-acorn) os=riscix1.2 ;; arm*-rebel) os=linux ;; arm*-semi) os=aout ;; c4x-* | tic4x-*) os=coff ;; c8051-*) os=elf ;; clipper-intergraph) os=clix ;; hexagon-*) os=elf ;; tic54x-*) os=coff ;; tic55x-*) os=coff ;; tic6x-*) os=coff ;; # This must come before the *-dec entry. pdp10-*) os=tops20 ;; pdp11-*) os=none ;; *-dec | vax-*) os=ultrix4.2 ;; m68*-apollo) os=domain ;; i386-sun) os=sunos4.0.2 ;; m68000-sun) os=sunos3 ;; m68*-cisco) os=aout ;; mep-*) os=elf ;; mips*-cisco) os=elf ;; mips*-*) os=elf ;; or32-*) os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=sysv3 ;; sparc-* | *-sun) os=sunos4.1.1 ;; pru-*) os=elf ;; *-be) os=beos ;; *-ibm) os=aix ;; *-knuth) os=mmixware ;; *-wec) os=proelf ;; *-winbond) os=proelf ;; *-oki) os=proelf ;; *-hp) os=hpux ;; *-hitachi) os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=sysv ;; *-cbm) os=amigaos ;; *-dg) os=dgux ;; *-dolphin) os=sysv3 ;; m68k-ccur) os=rtu ;; m88k-omron*) os=luna ;; *-next) os=nextstep ;; *-sequent) os=ptx ;; *-crds) os=unos ;; *-ns) os=genix ;; i370-*) os=mvs ;; *-gould) os=sysv ;; *-highlevel) os=bsd ;; *-encore) os=bsd ;; *-sgi) os=irix ;; *-siemens) os=sysv4 ;; *-masscomp) os=rtu ;; f30[01]-fujitsu | f700-fujitsu) os=uxpv ;; *-rom68k) os=coff ;; *-*bug) os=coff ;; *-apple) os=macos ;; *-atari*) os=mint ;; *-wrs) os=vxworks ;; *) os=none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $os in riscix*) vendor=acorn ;; sunos*) vendor=sun ;; cnk*|-aix*) vendor=ibm ;; beos*) vendor=be ;; hpux*) vendor=hp ;; mpeix*) vendor=hp ;; hiux*) vendor=hitachi ;; unos*) vendor=crds ;; dgux*) vendor=dg ;; luna*) vendor=omron ;; genix*) vendor=ns ;; clix*) vendor=intergraph ;; mvs* | opened*) vendor=ibm ;; os400*) vendor=ibm ;; ptx*) vendor=sequent ;; tpf*) vendor=ibm ;; vxsim* | vxworks* | windiss*) vendor=wrs ;; aux*) vendor=apple ;; hms*) vendor=hitachi ;; mpw* | macos*) vendor=apple ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) vendor=atari ;; vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: crun-1.16.1/libocispec/build-aux/depcomp0000755000000000000000000005602014656670151016336 0ustar0000000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/libocispec/build-aux/install-sh0000755000000000000000000003643514656670151016775 0ustar0000000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2018-03-11.20; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac 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. ;; *) # Note that $RANDOM variable is not portable (e.g. dash); Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p' feature. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_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 && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/libocispec/build-aux/ltmain.sh0000644000000000000000000117106714656670146016617 0ustar0000000000000000#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.6 package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES 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 . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! 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 # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! 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 ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do eval $_G_hook '"$@"' # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ -specs=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: crun-1.16.1/libocispec/build-aux/missing0000755000000000000000000001533614656670151016365 0ustar0000000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/libocispec/build-aux/test-driver0000755000000000000000000001104214656670151017152 0ustar0000000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC # Copyright (C) 2011-2020 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. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>$log_file # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/libocispec/m4/0000755000000000000000000000000014656670214013404 5ustar0000000000000000crun-1.16.1/libocispec/m4/libtool.m40000644000000000000000000112530614656670146015326 0ustar0000000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ]) # serial 58 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS crun-1.16.1/libocispec/m4/ltoptions.m40000644000000000000000000003426214656670146015714 0ustar0000000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) crun-1.16.1/libocispec/m4/ltsugar.m40000644000000000000000000001044014656670146015332 0ustar0000000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) crun-1.16.1/libocispec/m4/ltversion.m40000644000000000000000000000127314656670146015702 0ustar0000000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) crun-1.16.1/libocispec/m4/lt~obsolete.m40000644000000000000000000001377414656670146016240 0ustar0000000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) crun-1.16.1/libocispec/src/0000755000000000000000000000000014656670214013653 5ustar0000000000000000crun-1.16.1/libocispec/src/ocispec/0000755000000000000000000000000014656670214015300 5ustar0000000000000000crun-1.16.1/libocispec/src/ocispec/image_spec_schema_config_schema.h0000644000000000000000000000732314656670200023732 0ustar0000000000000000// Generated from config-schema.json. Do not edit! #ifndef IMAGE_SPEC_SCHEMA_CONFIG_SCHEMA_SCHEMA_H #define IMAGE_SPEC_SCHEMA_CONFIG_SCHEMA_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/image_spec_schema_defs.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *user; image_spec_schema_defs_map_string_object *exposed_ports; char **env; size_t env_len; char **entrypoint; size_t entrypoint_len; char **cmd; size_t cmd_len; image_spec_schema_defs_map_string_object *volumes; char *working_dir; json_map_string_string *labels; char *stop_signal; bool args_escaped; yajl_val _residual; unsigned int args_escaped_present : 1; } image_spec_schema_config_schema_config; void free_image_spec_schema_config_schema_config (image_spec_schema_config_schema_config *ptr); image_spec_schema_config_schema_config *make_image_spec_schema_config_schema_config (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_image_spec_schema_config_schema_config (yajl_gen g, const image_spec_schema_config_schema_config *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char **diff_ids; size_t diff_ids_len; char *type; yajl_val _residual; } image_spec_schema_config_schema_rootfs; void free_image_spec_schema_config_schema_rootfs (image_spec_schema_config_schema_rootfs *ptr); image_spec_schema_config_schema_rootfs *make_image_spec_schema_config_schema_rootfs (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_image_spec_schema_config_schema_rootfs (yajl_gen g, const image_spec_schema_config_schema_rootfs *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *created; char *author; char *created_by; char *comment; bool empty_layer; unsigned int empty_layer_present : 1; } image_spec_schema_config_schema_history_element; void free_image_spec_schema_config_schema_history_element (image_spec_schema_config_schema_history_element *ptr); image_spec_schema_config_schema_history_element *make_image_spec_schema_config_schema_history_element (yajl_val tree, const struct parser_context *ctx, parser_error *err); typedef struct { char *created; char *author; char *architecture; char *variant; char *os; char *os_version; char **os_features; size_t os_features_len; image_spec_schema_config_schema_config *config; image_spec_schema_config_schema_rootfs *rootfs; image_spec_schema_config_schema_history_element **history; size_t history_len; yajl_val _residual; } image_spec_schema_config_schema; void free_image_spec_schema_config_schema (image_spec_schema_config_schema *ptr); image_spec_schema_config_schema *make_image_spec_schema_config_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_image_spec_schema_config_schema (yajl_gen g, const image_spec_schema_config_schema *ptr, const struct parser_context *ctx, parser_error *err); image_spec_schema_config_schema *image_spec_schema_config_schema_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); image_spec_schema_config_schema *image_spec_schema_config_schema_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); image_spec_schema_config_schema *image_spec_schema_config_schema_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *image_spec_schema_config_schema_generate_json(const image_spec_schema_config_schema *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/image_spec_schema_content_descriptor.h0000644000000000000000000000337414656670200025057 0ustar0000000000000000// Generated from content-descriptor.json. Do not edit! #ifndef IMAGE_SPEC_SCHEMA_CONTENT_DESCRIPTOR_SCHEMA_H #define IMAGE_SPEC_SCHEMA_CONTENT_DESCRIPTOR_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/image_spec_schema_defs_descriptor.h" #include "ocispec/image_spec_schema_defs.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *media_type; int64_t size; char *digest; char **urls; size_t urls_len; char *data; char *artifact_type; json_map_string_string *annotations; yajl_val _residual; unsigned int size_present : 1; } image_spec_schema_content_descriptor; void free_image_spec_schema_content_descriptor (image_spec_schema_content_descriptor *ptr); image_spec_schema_content_descriptor *make_image_spec_schema_content_descriptor (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_image_spec_schema_content_descriptor (yajl_gen g, const image_spec_schema_content_descriptor *ptr, const struct parser_context *ctx, parser_error *err); image_spec_schema_content_descriptor *image_spec_schema_content_descriptor_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); image_spec_schema_content_descriptor *image_spec_schema_content_descriptor_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); image_spec_schema_content_descriptor *image_spec_schema_content_descriptor_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *image_spec_schema_content_descriptor_generate_json(const image_spec_schema_content_descriptor *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/image_spec_schema_defs.h0000644000000000000000000000273514656670200022070 0ustar0000000000000000// Generated from defs.json. Do not edit! #ifndef IMAGE_SPEC_SCHEMA_DEFS_SCHEMA_H #define IMAGE_SPEC_SCHEMA_DEFS_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char unuseful; // unuseful definition to avoid empty struct } image_spec_schema_defs_map_string_object_element; void free_image_spec_schema_defs_map_string_object_element (image_spec_schema_defs_map_string_object_element *ptr); image_spec_schema_defs_map_string_object_element *make_image_spec_schema_defs_map_string_object_element (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_image_spec_schema_defs_map_string_object_element (yajl_gen g, const image_spec_schema_defs_map_string_object_element *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char **keys; image_spec_schema_defs_map_string_object_element **values; size_t len; } image_spec_schema_defs_map_string_object; void free_image_spec_schema_defs_map_string_object (image_spec_schema_defs_map_string_object *ptr); image_spec_schema_defs_map_string_object *make_image_spec_schema_defs_map_string_object (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_image_spec_schema_defs_map_string_object (yajl_gen g, const image_spec_schema_defs_map_string_object *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/image_spec_schema_defs_descriptor.h0000644000000000000000000000054214656670200024320 0ustar0000000000000000// Generated from defs-descriptor.json. Do not edit! #ifndef IMAGE_SPEC_SCHEMA_DEFS_DESCRIPTOR_SCHEMA_H #define IMAGE_SPEC_SCHEMA_DEFS_DESCRIPTOR_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/image_spec_schema_defs.h" #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/image_spec_schema_image_index_schema.h0000644000000000000000000000641714656670200024741 0ustar0000000000000000// Generated from image-index-schema.json. Do not edit! #ifndef IMAGE_SPEC_SCHEMA_IMAGE_INDEX_SCHEMA_SCHEMA_H #define IMAGE_SPEC_SCHEMA_IMAGE_INDEX_SCHEMA_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/image_spec_schema_defs_descriptor.h" #include "ocispec/image_spec_schema_content_descriptor.h" #include "ocispec/image_spec_schema_defs.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *architecture; char *os; char *os_version; char **os_features; size_t os_features_len; char *variant; yajl_val _residual; } image_spec_schema_image_index_schema_manifests_platform; void free_image_spec_schema_image_index_schema_manifests_platform (image_spec_schema_image_index_schema_manifests_platform *ptr); image_spec_schema_image_index_schema_manifests_platform *make_image_spec_schema_image_index_schema_manifests_platform (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_image_spec_schema_image_index_schema_manifests_platform (yajl_gen g, const image_spec_schema_image_index_schema_manifests_platform *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *media_type; int64_t size; char *digest; char **urls; size_t urls_len; image_spec_schema_image_index_schema_manifests_platform *platform; json_map_string_string *annotations; unsigned int size_present : 1; } image_spec_schema_image_index_schema_manifests_element; void free_image_spec_schema_image_index_schema_manifests_element (image_spec_schema_image_index_schema_manifests_element *ptr); image_spec_schema_image_index_schema_manifests_element *make_image_spec_schema_image_index_schema_manifests_element (yajl_val tree, const struct parser_context *ctx, parser_error *err); typedef struct { int schema_version; char *media_type; char *artifact_type; image_spec_schema_content_descriptor *subject; image_spec_schema_image_index_schema_manifests_element **manifests; size_t manifests_len; json_map_string_string *annotations; yajl_val _residual; unsigned int schema_version_present : 1; } image_spec_schema_image_index_schema; void free_image_spec_schema_image_index_schema (image_spec_schema_image_index_schema *ptr); image_spec_schema_image_index_schema *make_image_spec_schema_image_index_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_image_spec_schema_image_index_schema (yajl_gen g, const image_spec_schema_image_index_schema *ptr, const struct parser_context *ctx, parser_error *err); image_spec_schema_image_index_schema *image_spec_schema_image_index_schema_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); image_spec_schema_image_index_schema *image_spec_schema_image_index_schema_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); image_spec_schema_image_index_schema *image_spec_schema_image_index_schema_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *image_spec_schema_image_index_schema_generate_json(const image_spec_schema_image_index_schema *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/image_spec_schema_image_layout_schema.h0000644000000000000000000000275714656670200025152 0ustar0000000000000000// Generated from image-layout-schema.json. Do not edit! #ifndef IMAGE_SPEC_SCHEMA_IMAGE_LAYOUT_SCHEMA_SCHEMA_H #define IMAGE_SPEC_SCHEMA_IMAGE_LAYOUT_SCHEMA_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *image_layout_version; yajl_val _residual; } image_spec_schema_image_layout_schema; void free_image_spec_schema_image_layout_schema (image_spec_schema_image_layout_schema *ptr); image_spec_schema_image_layout_schema *make_image_spec_schema_image_layout_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_image_spec_schema_image_layout_schema (yajl_gen g, const image_spec_schema_image_layout_schema *ptr, const struct parser_context *ctx, parser_error *err); image_spec_schema_image_layout_schema *image_spec_schema_image_layout_schema_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); image_spec_schema_image_layout_schema *image_spec_schema_image_layout_schema_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); image_spec_schema_image_layout_schema *image_spec_schema_image_layout_schema_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *image_spec_schema_image_layout_schema_generate_json(const image_spec_schema_image_layout_schema *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/image_spec_schema_image_manifest_schema.h0000644000000000000000000000374314656670200025437 0ustar0000000000000000// Generated from image-manifest-schema.json. Do not edit! #ifndef IMAGE_SPEC_SCHEMA_IMAGE_MANIFEST_SCHEMA_SCHEMA_H #define IMAGE_SPEC_SCHEMA_IMAGE_MANIFEST_SCHEMA_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/image_spec_schema_defs_descriptor.h" #include "ocispec/image_spec_schema_content_descriptor.h" #include "ocispec/image_spec_schema_defs.h" #ifdef __cplusplus extern "C" { #endif typedef struct { int schema_version; char *media_type; char *artifact_type; image_spec_schema_content_descriptor *config; image_spec_schema_content_descriptor *subject; image_spec_schema_content_descriptor **layers; size_t layers_len; json_map_string_string *annotations; yajl_val _residual; unsigned int schema_version_present : 1; } image_spec_schema_image_manifest_schema; void free_image_spec_schema_image_manifest_schema (image_spec_schema_image_manifest_schema *ptr); image_spec_schema_image_manifest_schema *make_image_spec_schema_image_manifest_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_image_spec_schema_image_manifest_schema (yajl_gen g, const image_spec_schema_image_manifest_schema *ptr, const struct parser_context *ctx, parser_error *err); image_spec_schema_image_manifest_schema *image_spec_schema_image_manifest_schema_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); image_spec_schema_image_manifest_schema *image_spec_schema_image_manifest_schema_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); image_spec_schema_image_manifest_schema *image_spec_schema_image_manifest_schema_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *image_spec_schema_image_manifest_schema_generate_json(const image_spec_schema_image_manifest_schema *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_linux.h0000644000000000000000000002615014656670200024231 0ustar0000000000000000// Generated from config-linux.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_CONFIG_LINUX_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_CONFIG_LINUX_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/runtime_spec_schema_defs_linux.h" #include "ocispec/runtime_spec_schema_defs.h" #ifdef __cplusplus extern "C" { #endif typedef struct { int64_t limit; yajl_val _residual; unsigned int limit_present : 1; } runtime_spec_schema_config_linux_resources_pids; void free_runtime_spec_schema_config_linux_resources_pids (runtime_spec_schema_config_linux_resources_pids *ptr); runtime_spec_schema_config_linux_resources_pids *make_runtime_spec_schema_config_linux_resources_pids (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_linux_resources_pids (yajl_gen g, const runtime_spec_schema_config_linux_resources_pids *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { uint16_t weight; uint16_t leaf_weight; runtime_spec_schema_defs_linux_block_io_device_throttle **throttle_read_bps_device; size_t throttle_read_bps_device_len; runtime_spec_schema_defs_linux_block_io_device_throttle **throttle_write_bps_device; size_t throttle_write_bps_device_len; runtime_spec_schema_defs_linux_block_io_device_throttle **throttle_read_iops_device; size_t throttle_read_iops_device_len; runtime_spec_schema_defs_linux_block_io_device_throttle **throttle_write_iops_device; size_t throttle_write_iops_device_len; runtime_spec_schema_defs_linux_block_io_device_weight **weight_device; size_t weight_device_len; yajl_val _residual; unsigned int weight_present : 1; unsigned int leaf_weight_present : 1; } runtime_spec_schema_config_linux_resources_block_io; void free_runtime_spec_schema_config_linux_resources_block_io (runtime_spec_schema_config_linux_resources_block_io *ptr); runtime_spec_schema_config_linux_resources_block_io *make_runtime_spec_schema_config_linux_resources_block_io (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_linux_resources_block_io (yajl_gen g, const runtime_spec_schema_config_linux_resources_block_io *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *cpus; char *mems; uint64_t period; int64_t quota; uint64_t burst; uint64_t realtime_period; int64_t realtime_runtime; uint64_t shares; int64_t idle; yajl_val _residual; unsigned int period_present : 1; unsigned int quota_present : 1; unsigned int burst_present : 1; unsigned int realtime_period_present : 1; unsigned int realtime_runtime_present : 1; unsigned int shares_present : 1; unsigned int idle_present : 1; } runtime_spec_schema_config_linux_resources_cpu; void free_runtime_spec_schema_config_linux_resources_cpu (runtime_spec_schema_config_linux_resources_cpu *ptr); runtime_spec_schema_config_linux_resources_cpu *make_runtime_spec_schema_config_linux_resources_cpu (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_linux_resources_cpu (yajl_gen g, const runtime_spec_schema_config_linux_resources_cpu *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *page_size; uint64_t limit; unsigned int limit_present : 1; } runtime_spec_schema_config_linux_resources_hugepage_limits_element; void free_runtime_spec_schema_config_linux_resources_hugepage_limits_element (runtime_spec_schema_config_linux_resources_hugepage_limits_element *ptr); runtime_spec_schema_config_linux_resources_hugepage_limits_element *make_runtime_spec_schema_config_linux_resources_hugepage_limits_element (yajl_val tree, const struct parser_context *ctx, parser_error *err); typedef struct { int64_t kernel; int64_t kernel_tcp; int64_t limit; int64_t reservation; int64_t swap; uint64_t swappiness; bool disable_oom_killer; bool use_hierarchy; bool check_before_update; yajl_val _residual; unsigned int kernel_present : 1; unsigned int kernel_tcp_present : 1; unsigned int limit_present : 1; unsigned int reservation_present : 1; unsigned int swap_present : 1; unsigned int swappiness_present : 1; unsigned int disable_oom_killer_present : 1; unsigned int use_hierarchy_present : 1; unsigned int check_before_update_present : 1; } runtime_spec_schema_config_linux_resources_memory; void free_runtime_spec_schema_config_linux_resources_memory (runtime_spec_schema_config_linux_resources_memory *ptr); runtime_spec_schema_config_linux_resources_memory *make_runtime_spec_schema_config_linux_resources_memory (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_linux_resources_memory (yajl_gen g, const runtime_spec_schema_config_linux_resources_memory *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { uint32_t class_id; runtime_spec_schema_defs_linux_network_interface_priority **priorities; size_t priorities_len; yajl_val _residual; unsigned int class_id_present : 1; } runtime_spec_schema_config_linux_resources_network; void free_runtime_spec_schema_config_linux_resources_network (runtime_spec_schema_config_linux_resources_network *ptr); runtime_spec_schema_config_linux_resources_network *make_runtime_spec_schema_config_linux_resources_network (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_linux_resources_network (yajl_gen g, const runtime_spec_schema_config_linux_resources_network *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char unuseful; // unuseful definition to avoid empty struct } runtime_spec_schema_config_linux_resources_rdma; void free_runtime_spec_schema_config_linux_resources_rdma (runtime_spec_schema_config_linux_resources_rdma *ptr); runtime_spec_schema_config_linux_resources_rdma *make_runtime_spec_schema_config_linux_resources_rdma (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_linux_resources_rdma (yajl_gen g, const runtime_spec_schema_config_linux_resources_rdma *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { json_map_string_string *unified; runtime_spec_schema_defs_linux_device_cgroup **devices; size_t devices_len; runtime_spec_schema_config_linux_resources_pids *pids; runtime_spec_schema_config_linux_resources_block_io *block_io; runtime_spec_schema_config_linux_resources_cpu *cpu; runtime_spec_schema_config_linux_resources_hugepage_limits_element **hugepage_limits; size_t hugepage_limits_len; runtime_spec_schema_config_linux_resources_memory *memory; runtime_spec_schema_config_linux_resources_network *network; runtime_spec_schema_config_linux_resources_rdma *rdma; yajl_val _residual; } runtime_spec_schema_config_linux_resources; void free_runtime_spec_schema_config_linux_resources (runtime_spec_schema_config_linux_resources *ptr); runtime_spec_schema_config_linux_resources *make_runtime_spec_schema_config_linux_resources (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_linux_resources (yajl_gen g, const runtime_spec_schema_config_linux_resources *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *default_action; uint32_t default_errno_ret; char **flags; size_t flags_len; char *listener_path; char *listener_metadata; char **architectures; size_t architectures_len; runtime_spec_schema_defs_linux_syscall **syscalls; size_t syscalls_len; yajl_val _residual; unsigned int default_errno_ret_present : 1; } runtime_spec_schema_config_linux_seccomp; void free_runtime_spec_schema_config_linux_seccomp (runtime_spec_schema_config_linux_seccomp *ptr); runtime_spec_schema_config_linux_seccomp *make_runtime_spec_schema_config_linux_seccomp (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_linux_seccomp (yajl_gen g, const runtime_spec_schema_config_linux_seccomp *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *clos_id; char *l3cache_schema; char *mem_bw_schema; bool enable_cmt; bool enable_mbm; yajl_val _residual; unsigned int enable_cmt_present : 1; unsigned int enable_mbm_present : 1; } runtime_spec_schema_config_linux_intel_rdt; void free_runtime_spec_schema_config_linux_intel_rdt (runtime_spec_schema_config_linux_intel_rdt *ptr); runtime_spec_schema_config_linux_intel_rdt *make_runtime_spec_schema_config_linux_intel_rdt (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_linux_intel_rdt (yajl_gen g, const runtime_spec_schema_config_linux_intel_rdt *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { runtime_spec_schema_defs_linux_time_offsets *boottime; runtime_spec_schema_defs_linux_time_offsets *monotonic; yajl_val _residual; } runtime_spec_schema_config_linux_time_offsets; void free_runtime_spec_schema_config_linux_time_offsets (runtime_spec_schema_config_linux_time_offsets *ptr); runtime_spec_schema_config_linux_time_offsets *make_runtime_spec_schema_config_linux_time_offsets (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_linux_time_offsets (yajl_gen g, const runtime_spec_schema_config_linux_time_offsets *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { runtime_spec_schema_defs_linux_device **devices; size_t devices_len; runtime_spec_schema_defs_id_mapping **uid_mappings; size_t uid_mappings_len; runtime_spec_schema_defs_id_mapping **gid_mappings; size_t gid_mappings_len; runtime_spec_schema_defs_linux_namespace_reference **namespaces; size_t namespaces_len; runtime_spec_schema_config_linux_resources *resources; char *cgroups_path; char *rootfs_propagation; runtime_spec_schema_config_linux_seccomp *seccomp; json_map_string_string *sysctl; char **masked_paths; size_t masked_paths_len; char **readonly_paths; size_t readonly_paths_len; char *mount_label; runtime_spec_schema_config_linux_intel_rdt *intel_rdt; runtime_spec_schema_defs_linux_personality *personality; runtime_spec_schema_config_linux_time_offsets *time_offsets; yajl_val _residual; } runtime_spec_schema_config_linux; void free_runtime_spec_schema_config_linux (runtime_spec_schema_config_linux *ptr); runtime_spec_schema_config_linux *make_runtime_spec_schema_config_linux (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_linux (yajl_gen g, const runtime_spec_schema_config_linux *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_zos.h0000644000000000000000000000164114656670200023703 0ustar0000000000000000// Generated from config-zos.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_CONFIG_ZOS_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_CONFIG_ZOS_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/runtime_spec_schema_defs_zos.h" #include "ocispec/runtime_spec_schema_defs.h" #ifdef __cplusplus extern "C" { #endif typedef struct { runtime_spec_schema_defs_zos_device **devices; size_t devices_len; yajl_val _residual; } runtime_spec_schema_config_zos; void free_runtime_spec_schema_config_zos (runtime_spec_schema_config_zos *ptr); runtime_spec_schema_config_zos *make_runtime_spec_schema_config_zos (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_zos (yajl_gen g, const runtime_spec_schema_config_zos *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_schema.h0000644000000000000000000002352414656670200024334 0ustar0000000000000000// Generated from config-schema.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_CONFIG_SCHEMA_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_CONFIG_SCHEMA_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/runtime_spec_schema_defs.h" #include "ocispec/runtime_spec_schema_defs_linux.h" #include "ocispec/runtime_spec_schema_config_linux.h" #include "ocispec/runtime_spec_schema_config_solaris.h" #include "ocispec/runtime_spec_schema_config_windows.h" #include "ocispec/runtime_spec_schema_defs_windows.h" #include "ocispec/runtime_spec_schema_config_vm.h" #include "ocispec/runtime_spec_schema_defs_vm.h" #include "ocispec/runtime_spec_schema_config_zos.h" #include "ocispec/runtime_spec_schema_defs_zos.h" #ifdef __cplusplus extern "C" { #endif typedef struct { runtime_spec_schema_defs_hook **prestart; size_t prestart_len; runtime_spec_schema_defs_hook **create_runtime; size_t create_runtime_len; runtime_spec_schema_defs_hook **create_container; size_t create_container_len; runtime_spec_schema_defs_hook **start_container; size_t start_container_len; runtime_spec_schema_defs_hook **poststart; size_t poststart_len; runtime_spec_schema_defs_hook **poststop; size_t poststop_len; yajl_val _residual; } runtime_spec_schema_config_schema_hooks; void free_runtime_spec_schema_config_schema_hooks (runtime_spec_schema_config_schema_hooks *ptr); runtime_spec_schema_config_schema_hooks *make_runtime_spec_schema_config_schema_hooks (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_schema_hooks (yajl_gen g, const runtime_spec_schema_config_schema_hooks *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *path; bool readonly; yajl_val _residual; unsigned int readonly_present : 1; } runtime_spec_schema_config_schema_root; void free_runtime_spec_schema_config_schema_root (runtime_spec_schema_config_schema_root *ptr); runtime_spec_schema_config_schema_root *make_runtime_spec_schema_config_schema_root (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_schema_root (yajl_gen g, const runtime_spec_schema_config_schema_root *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { uint64_t height; uint64_t width; yajl_val _residual; unsigned int height_present : 1; unsigned int width_present : 1; } runtime_spec_schema_config_schema_process_console_size; void free_runtime_spec_schema_config_schema_process_console_size (runtime_spec_schema_config_schema_process_console_size *ptr); runtime_spec_schema_config_schema_process_console_size *make_runtime_spec_schema_config_schema_process_console_size (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_schema_process_console_size (yajl_gen g, const runtime_spec_schema_config_schema_process_console_size *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { uid_t uid; gid_t gid; uint32_t umask; gid_t *additional_gids; size_t additional_gids_len; char *username; yajl_val _residual; unsigned int uid_present : 1; unsigned int gid_present : 1; unsigned int umask_present : 1; } runtime_spec_schema_config_schema_process_user; void free_runtime_spec_schema_config_schema_process_user (runtime_spec_schema_config_schema_process_user *ptr); runtime_spec_schema_config_schema_process_user *make_runtime_spec_schema_config_schema_process_user (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_schema_process_user (yajl_gen g, const runtime_spec_schema_config_schema_process_user *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char **bounding; size_t bounding_len; char **permitted; size_t permitted_len; char **effective; size_t effective_len; char **inheritable; size_t inheritable_len; char **ambient; size_t ambient_len; yajl_val _residual; } runtime_spec_schema_config_schema_process_capabilities; void free_runtime_spec_schema_config_schema_process_capabilities (runtime_spec_schema_config_schema_process_capabilities *ptr); runtime_spec_schema_config_schema_process_capabilities *make_runtime_spec_schema_config_schema_process_capabilities (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_schema_process_capabilities (yajl_gen g, const runtime_spec_schema_config_schema_process_capabilities *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *_class; int32_t priority; yajl_val _residual; unsigned int priority_present : 1; } runtime_spec_schema_config_schema_process_io_priority; void free_runtime_spec_schema_config_schema_process_io_priority (runtime_spec_schema_config_schema_process_io_priority *ptr); runtime_spec_schema_config_schema_process_io_priority *make_runtime_spec_schema_config_schema_process_io_priority (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_schema_process_io_priority (yajl_gen g, const runtime_spec_schema_config_schema_process_io_priority *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *policy; int32_t nice; int32_t priority; char **flags; size_t flags_len; uint64_t runtime; uint64_t deadline; uint64_t period; yajl_val _residual; unsigned int nice_present : 1; unsigned int priority_present : 1; unsigned int runtime_present : 1; unsigned int deadline_present : 1; unsigned int period_present : 1; } runtime_spec_schema_config_schema_process_scheduler; void free_runtime_spec_schema_config_schema_process_scheduler (runtime_spec_schema_config_schema_process_scheduler *ptr); runtime_spec_schema_config_schema_process_scheduler *make_runtime_spec_schema_config_schema_process_scheduler (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_schema_process_scheduler (yajl_gen g, const runtime_spec_schema_config_schema_process_scheduler *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { uint64_t hard; uint64_t soft; char *type; unsigned int hard_present : 1; unsigned int soft_present : 1; } runtime_spec_schema_config_schema_process_rlimits_element; void free_runtime_spec_schema_config_schema_process_rlimits_element (runtime_spec_schema_config_schema_process_rlimits_element *ptr); runtime_spec_schema_config_schema_process_rlimits_element *make_runtime_spec_schema_config_schema_process_rlimits_element (yajl_val tree, const struct parser_context *ctx, parser_error *err); typedef struct { char **args; size_t args_len; char *command_line; runtime_spec_schema_config_schema_process_console_size *console_size; char *cwd; char **env; size_t env_len; bool terminal; runtime_spec_schema_config_schema_process_user *user; runtime_spec_schema_config_schema_process_capabilities *capabilities; char *apparmor_profile; int oom_score_adj; char *selinux_label; runtime_spec_schema_config_schema_process_io_priority *io_priority; bool no_new_privileges; runtime_spec_schema_config_schema_process_scheduler *scheduler; runtime_spec_schema_config_schema_process_rlimits_element **rlimits; size_t rlimits_len; yajl_val _residual; unsigned int terminal_present : 1; unsigned int oom_score_adj_present : 1; unsigned int no_new_privileges_present : 1; } runtime_spec_schema_config_schema_process; void free_runtime_spec_schema_config_schema_process (runtime_spec_schema_config_schema_process *ptr); runtime_spec_schema_config_schema_process *make_runtime_spec_schema_config_schema_process (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_schema_process (yajl_gen g, const runtime_spec_schema_config_schema_process *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *oci_version; runtime_spec_schema_config_schema_hooks *hooks; json_map_string_string *annotations; char *hostname; char *domainname; runtime_spec_schema_defs_mount **mounts; size_t mounts_len; runtime_spec_schema_config_schema_root *root; runtime_spec_schema_config_schema_process *process; runtime_spec_schema_config_linux *linux; runtime_spec_schema_config_solaris *solaris; runtime_spec_schema_config_windows *windows; runtime_spec_schema_config_vm *vm; runtime_spec_schema_config_zos *zos; yajl_val _residual; } runtime_spec_schema_config_schema; void free_runtime_spec_schema_config_schema (runtime_spec_schema_config_schema *ptr); runtime_spec_schema_config_schema *make_runtime_spec_schema_config_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_schema (yajl_gen g, const runtime_spec_schema_config_schema *ptr, const struct parser_context *ctx, parser_error *err); runtime_spec_schema_config_schema *runtime_spec_schema_config_schema_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); runtime_spec_schema_config_schema *runtime_spec_schema_config_schema_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); runtime_spec_schema_config_schema *runtime_spec_schema_config_schema_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *runtime_spec_schema_config_schema_generate_json(const runtime_spec_schema_config_schema *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_solaris.h0000644000000000000000000000540514656670200024546 0ustar0000000000000000// Generated from config-solaris.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_CONFIG_SOLARIS_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_CONFIG_SOLARIS_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *ncpus; yajl_val _residual; } runtime_spec_schema_config_solaris_capped_cpu; void free_runtime_spec_schema_config_solaris_capped_cpu (runtime_spec_schema_config_solaris_capped_cpu *ptr); runtime_spec_schema_config_solaris_capped_cpu *make_runtime_spec_schema_config_solaris_capped_cpu (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_solaris_capped_cpu (yajl_gen g, const runtime_spec_schema_config_solaris_capped_cpu *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *physical; char *swap; yajl_val _residual; } runtime_spec_schema_config_solaris_capped_memory; void free_runtime_spec_schema_config_solaris_capped_memory (runtime_spec_schema_config_solaris_capped_memory *ptr); runtime_spec_schema_config_solaris_capped_memory *make_runtime_spec_schema_config_solaris_capped_memory (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_solaris_capped_memory (yajl_gen g, const runtime_spec_schema_config_solaris_capped_memory *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *linkname; char *lower_link; char *allowed_address; char *configure_allowed_address; char *defrouter; char *mac_address; char *link_protection; } runtime_spec_schema_config_solaris_anet_element; void free_runtime_spec_schema_config_solaris_anet_element (runtime_spec_schema_config_solaris_anet_element *ptr); runtime_spec_schema_config_solaris_anet_element *make_runtime_spec_schema_config_solaris_anet_element (yajl_val tree, const struct parser_context *ctx, parser_error *err); typedef struct { char *milestone; char *limitpriv; char *max_shm_memory; runtime_spec_schema_config_solaris_capped_cpu *capped_cpu; runtime_spec_schema_config_solaris_capped_memory *capped_memory; runtime_spec_schema_config_solaris_anet_element **anet; size_t anet_len; yajl_val _residual; } runtime_spec_schema_config_solaris; void free_runtime_spec_schema_config_solaris (runtime_spec_schema_config_solaris *ptr); runtime_spec_schema_config_solaris *make_runtime_spec_schema_config_solaris (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_solaris (yajl_gen g, const runtime_spec_schema_config_solaris *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_vm.h0000644000000000000000000000523114656670200023511 0ustar0000000000000000// Generated from config-vm.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_CONFIG_VM_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_CONFIG_VM_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/runtime_spec_schema_defs.h" #include "ocispec/runtime_spec_schema_defs_vm.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *path; char **parameters; size_t parameters_len; yajl_val _residual; } runtime_spec_schema_config_vm_hypervisor; void free_runtime_spec_schema_config_vm_hypervisor (runtime_spec_schema_config_vm_hypervisor *ptr); runtime_spec_schema_config_vm_hypervisor *make_runtime_spec_schema_config_vm_hypervisor (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_vm_hypervisor (yajl_gen g, const runtime_spec_schema_config_vm_hypervisor *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *path; char **parameters; size_t parameters_len; char *initrd; yajl_val _residual; } runtime_spec_schema_config_vm_kernel; void free_runtime_spec_schema_config_vm_kernel (runtime_spec_schema_config_vm_kernel *ptr); runtime_spec_schema_config_vm_kernel *make_runtime_spec_schema_config_vm_kernel (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_vm_kernel (yajl_gen g, const runtime_spec_schema_config_vm_kernel *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *path; char *format; yajl_val _residual; } runtime_spec_schema_config_vm_image; void free_runtime_spec_schema_config_vm_image (runtime_spec_schema_config_vm_image *ptr); runtime_spec_schema_config_vm_image *make_runtime_spec_schema_config_vm_image (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_vm_image (yajl_gen g, const runtime_spec_schema_config_vm_image *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { runtime_spec_schema_config_vm_hypervisor *hypervisor; runtime_spec_schema_config_vm_kernel *kernel; runtime_spec_schema_config_vm_image *image; yajl_val _residual; } runtime_spec_schema_config_vm; void free_runtime_spec_schema_config_vm (runtime_spec_schema_config_vm *ptr); runtime_spec_schema_config_vm *make_runtime_spec_schema_config_vm (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_vm (yajl_gen g, const runtime_spec_schema_config_vm *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_windows.h0000644000000000000000000001444714656670200024572 0ustar0000000000000000// Generated from config-windows.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_CONFIG_WINDOWS_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_CONFIG_WINDOWS_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/runtime_spec_schema_defs.h" #include "ocispec/runtime_spec_schema_defs_windows.h" #ifdef __cplusplus extern "C" { #endif typedef struct { uint64_t limit; yajl_val _residual; unsigned int limit_present : 1; } runtime_spec_schema_config_windows_resources_memory; void free_runtime_spec_schema_config_windows_resources_memory (runtime_spec_schema_config_windows_resources_memory *ptr); runtime_spec_schema_config_windows_resources_memory *make_runtime_spec_schema_config_windows_resources_memory (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_windows_resources_memory (yajl_gen g, const runtime_spec_schema_config_windows_resources_memory *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { uint64_t count; uint16_t shares; uint16_t maximum; yajl_val _residual; unsigned int count_present : 1; unsigned int shares_present : 1; unsigned int maximum_present : 1; } runtime_spec_schema_config_windows_resources_cpu; void free_runtime_spec_schema_config_windows_resources_cpu (runtime_spec_schema_config_windows_resources_cpu *ptr); runtime_spec_schema_config_windows_resources_cpu *make_runtime_spec_schema_config_windows_resources_cpu (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_windows_resources_cpu (yajl_gen g, const runtime_spec_schema_config_windows_resources_cpu *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { uint64_t iops; uint64_t bps; uint64_t sandbox_size; yajl_val _residual; unsigned int iops_present : 1; unsigned int bps_present : 1; unsigned int sandbox_size_present : 1; } runtime_spec_schema_config_windows_resources_storage; void free_runtime_spec_schema_config_windows_resources_storage (runtime_spec_schema_config_windows_resources_storage *ptr); runtime_spec_schema_config_windows_resources_storage *make_runtime_spec_schema_config_windows_resources_storage (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_windows_resources_storage (yajl_gen g, const runtime_spec_schema_config_windows_resources_storage *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { runtime_spec_schema_config_windows_resources_memory *memory; runtime_spec_schema_config_windows_resources_cpu *cpu; runtime_spec_schema_config_windows_resources_storage *storage; yajl_val _residual; } runtime_spec_schema_config_windows_resources; void free_runtime_spec_schema_config_windows_resources (runtime_spec_schema_config_windows_resources *ptr); runtime_spec_schema_config_windows_resources *make_runtime_spec_schema_config_windows_resources (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_windows_resources (yajl_gen g, const runtime_spec_schema_config_windows_resources *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char **endpoint_list; size_t endpoint_list_len; bool allow_unqualified_dns_query; char **dns_search_list; size_t dns_search_list_len; char *network_shared_container_name; char *network_namespace; yajl_val _residual; unsigned int allow_unqualified_dns_query_present : 1; } runtime_spec_schema_config_windows_network; void free_runtime_spec_schema_config_windows_network (runtime_spec_schema_config_windows_network *ptr); runtime_spec_schema_config_windows_network *make_runtime_spec_schema_config_windows_network (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_windows_network (yajl_gen g, const runtime_spec_schema_config_windows_network *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char unuseful; // unuseful definition to avoid empty struct } runtime_spec_schema_config_windows_credential_spec; void free_runtime_spec_schema_config_windows_credential_spec (runtime_spec_schema_config_windows_credential_spec *ptr); runtime_spec_schema_config_windows_credential_spec *make_runtime_spec_schema_config_windows_credential_spec (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_windows_credential_spec (yajl_gen g, const runtime_spec_schema_config_windows_credential_spec *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *utility_vm_path; yajl_val _residual; } runtime_spec_schema_config_windows_hyperv; void free_runtime_spec_schema_config_windows_hyperv (runtime_spec_schema_config_windows_hyperv *ptr); runtime_spec_schema_config_windows_hyperv *make_runtime_spec_schema_config_windows_hyperv (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_windows_hyperv (yajl_gen g, const runtime_spec_schema_config_windows_hyperv *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char **layer_folders; size_t layer_folders_len; runtime_spec_schema_defs_windows_device **devices; size_t devices_len; runtime_spec_schema_config_windows_resources *resources; runtime_spec_schema_config_windows_network *network; runtime_spec_schema_config_windows_credential_spec *credential_spec; bool servicing; bool ignore_flushes_during_boot; runtime_spec_schema_config_windows_hyperv *hyperv; yajl_val _residual; unsigned int servicing_present : 1; unsigned int ignore_flushes_during_boot_present : 1; } runtime_spec_schema_config_windows; void free_runtime_spec_schema_config_windows (runtime_spec_schema_config_windows *ptr); runtime_spec_schema_config_windows *make_runtime_spec_schema_config_windows (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_config_windows (yajl_gen g, const runtime_spec_schema_config_windows *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_defs.h0000644000000000000000000000437214656670200022470 0ustar0000000000000000// Generated from defs.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_DEFS_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_DEFS_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *path; char **args; size_t args_len; char **env; size_t env_len; int timeout; yajl_val _residual; unsigned int timeout_present : 1; } runtime_spec_schema_defs_hook; void free_runtime_spec_schema_defs_hook (runtime_spec_schema_defs_hook *ptr); runtime_spec_schema_defs_hook *make_runtime_spec_schema_defs_hook (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_hook (yajl_gen g, const runtime_spec_schema_defs_hook *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { uint32_t container_id; uint32_t host_id; uint32_t size; yajl_val _residual; unsigned int container_id_present : 1; unsigned int host_id_present : 1; unsigned int size_present : 1; } runtime_spec_schema_defs_id_mapping; void free_runtime_spec_schema_defs_id_mapping (runtime_spec_schema_defs_id_mapping *ptr); runtime_spec_schema_defs_id_mapping *make_runtime_spec_schema_defs_id_mapping (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_id_mapping (yajl_gen g, const runtime_spec_schema_defs_id_mapping *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *source; char *destination; char **options; size_t options_len; char *type; runtime_spec_schema_defs_id_mapping **uid_mappings; size_t uid_mappings_len; runtime_spec_schema_defs_id_mapping **gid_mappings; size_t gid_mappings_len; yajl_val _residual; } runtime_spec_schema_defs_mount; void free_runtime_spec_schema_defs_mount (runtime_spec_schema_defs_mount *ptr); runtime_spec_schema_defs_mount *make_runtime_spec_schema_defs_mount (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_mount (yajl_gen g, const runtime_spec_schema_defs_mount *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_defs_linux.h0000644000000000000000000002142014656670200023700 0ustar0000000000000000// Generated from defs-linux.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_DEFS_LINUX_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_DEFS_LINUX_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/runtime_spec_schema_defs.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *domain; char **flags; size_t flags_len; yajl_val _residual; } runtime_spec_schema_defs_linux_personality; void free_runtime_spec_schema_defs_linux_personality (runtime_spec_schema_defs_linux_personality *ptr); runtime_spec_schema_defs_linux_personality *make_runtime_spec_schema_defs_linux_personality (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_personality (yajl_gen g, const runtime_spec_schema_defs_linux_personality *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { uint32_t index; uint64_t value; uint64_t value_two; char *op; yajl_val _residual; unsigned int index_present : 1; unsigned int value_present : 1; unsigned int value_two_present : 1; } runtime_spec_schema_defs_linux_syscall_arg; void free_runtime_spec_schema_defs_linux_syscall_arg (runtime_spec_schema_defs_linux_syscall_arg *ptr); runtime_spec_schema_defs_linux_syscall_arg *make_runtime_spec_schema_defs_linux_syscall_arg (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_syscall_arg (yajl_gen g, const runtime_spec_schema_defs_linux_syscall_arg *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char **names; size_t names_len; char *action; uint32_t errno_ret; runtime_spec_schema_defs_linux_syscall_arg **args; size_t args_len; yajl_val _residual; unsigned int errno_ret_present : 1; } runtime_spec_schema_defs_linux_syscall; void free_runtime_spec_schema_defs_linux_syscall (runtime_spec_schema_defs_linux_syscall *ptr); runtime_spec_schema_defs_linux_syscall *make_runtime_spec_schema_defs_linux_syscall (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_syscall (yajl_gen g, const runtime_spec_schema_defs_linux_syscall *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *type; char *path; int file_mode; int64_t major; int64_t minor; uid_t uid; gid_t gid; yajl_val _residual; unsigned int file_mode_present : 1; unsigned int major_present : 1; unsigned int minor_present : 1; unsigned int uid_present : 1; unsigned int gid_present : 1; } runtime_spec_schema_defs_linux_device; void free_runtime_spec_schema_defs_linux_device (runtime_spec_schema_defs_linux_device *ptr); runtime_spec_schema_defs_linux_device *make_runtime_spec_schema_defs_linux_device (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_device (yajl_gen g, const runtime_spec_schema_defs_linux_device *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { int64_t major; int64_t minor; yajl_val _residual; unsigned int major_present : 1; unsigned int minor_present : 1; } runtime_spec_schema_defs_linux_block_io_device; void free_runtime_spec_schema_defs_linux_block_io_device (runtime_spec_schema_defs_linux_block_io_device *ptr); runtime_spec_schema_defs_linux_block_io_device *make_runtime_spec_schema_defs_linux_block_io_device (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_block_io_device (yajl_gen g, const runtime_spec_schema_defs_linux_block_io_device *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { int64_t major; int64_t minor; uint16_t weight; uint16_t leaf_weight; yajl_val _residual; unsigned int major_present : 1; unsigned int minor_present : 1; unsigned int weight_present : 1; unsigned int leaf_weight_present : 1; } runtime_spec_schema_defs_linux_block_io_device_weight; void free_runtime_spec_schema_defs_linux_block_io_device_weight (runtime_spec_schema_defs_linux_block_io_device_weight *ptr); runtime_spec_schema_defs_linux_block_io_device_weight *make_runtime_spec_schema_defs_linux_block_io_device_weight (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_block_io_device_weight (yajl_gen g, const runtime_spec_schema_defs_linux_block_io_device_weight *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { int64_t major; int64_t minor; uint64_t rate; yajl_val _residual; unsigned int major_present : 1; unsigned int minor_present : 1; unsigned int rate_present : 1; } runtime_spec_schema_defs_linux_block_io_device_throttle; void free_runtime_spec_schema_defs_linux_block_io_device_throttle (runtime_spec_schema_defs_linux_block_io_device_throttle *ptr); runtime_spec_schema_defs_linux_block_io_device_throttle *make_runtime_spec_schema_defs_linux_block_io_device_throttle (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_block_io_device_throttle (yajl_gen g, const runtime_spec_schema_defs_linux_block_io_device_throttle *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { bool allow; char *type; int64_t major; int64_t minor; char *access; yajl_val _residual; unsigned int allow_present : 1; unsigned int major_present : 1; unsigned int minor_present : 1; } runtime_spec_schema_defs_linux_device_cgroup; void free_runtime_spec_schema_defs_linux_device_cgroup (runtime_spec_schema_defs_linux_device_cgroup *ptr); runtime_spec_schema_defs_linux_device_cgroup *make_runtime_spec_schema_defs_linux_device_cgroup (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_device_cgroup (yajl_gen g, const runtime_spec_schema_defs_linux_device_cgroup *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *name; uint32_t priority; yajl_val _residual; unsigned int priority_present : 1; } runtime_spec_schema_defs_linux_network_interface_priority; void free_runtime_spec_schema_defs_linux_network_interface_priority (runtime_spec_schema_defs_linux_network_interface_priority *ptr); runtime_spec_schema_defs_linux_network_interface_priority *make_runtime_spec_schema_defs_linux_network_interface_priority (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_network_interface_priority (yajl_gen g, const runtime_spec_schema_defs_linux_network_interface_priority *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { uint32_t hca_handles; uint32_t hca_objects; yajl_val _residual; unsigned int hca_handles_present : 1; unsigned int hca_objects_present : 1; } runtime_spec_schema_defs_linux_rdma; void free_runtime_spec_schema_defs_linux_rdma (runtime_spec_schema_defs_linux_rdma *ptr); runtime_spec_schema_defs_linux_rdma *make_runtime_spec_schema_defs_linux_rdma (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_rdma (yajl_gen g, const runtime_spec_schema_defs_linux_rdma *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char *type; char *path; yajl_val _residual; } runtime_spec_schema_defs_linux_namespace_reference; void free_runtime_spec_schema_defs_linux_namespace_reference (runtime_spec_schema_defs_linux_namespace_reference *ptr); runtime_spec_schema_defs_linux_namespace_reference *make_runtime_spec_schema_defs_linux_namespace_reference (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_namespace_reference (yajl_gen g, const runtime_spec_schema_defs_linux_namespace_reference *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { int64_t secs; uint32_t nanosecs; yajl_val _residual; unsigned int secs_present : 1; unsigned int nanosecs_present : 1; } runtime_spec_schema_defs_linux_time_offsets; void free_runtime_spec_schema_defs_linux_time_offsets (runtime_spec_schema_defs_linux_time_offsets *ptr); runtime_spec_schema_defs_linux_time_offsets *make_runtime_spec_schema_defs_linux_time_offsets (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_linux_time_offsets (yajl_gen g, const runtime_spec_schema_defs_linux_time_offsets *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_defs_zos.h0000644000000000000000000000216314656670200023357 0ustar0000000000000000// Generated from defs-zos.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_DEFS_ZOS_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_DEFS_ZOS_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/runtime_spec_schema_defs.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *path; char *type; int64_t major; int64_t minor; int file_mode; uid_t uid; gid_t gid; yajl_val _residual; unsigned int major_present : 1; unsigned int minor_present : 1; unsigned int file_mode_present : 1; unsigned int uid_present : 1; unsigned int gid_present : 1; } runtime_spec_schema_defs_zos_device; void free_runtime_spec_schema_defs_zos_device (runtime_spec_schema_defs_zos_device *ptr); runtime_spec_schema_defs_zos_device *make_runtime_spec_schema_defs_zos_device (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_zos_device (yajl_gen g, const runtime_spec_schema_defs_zos_device *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_defs_vm.h0000644000000000000000000000044214656670200023164 0ustar0000000000000000// Generated from defs-vm.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_DEFS_VM_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_DEFS_VM_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_defs_windows.h0000644000000000000000000000153514656670200024240 0ustar0000000000000000// Generated from defs-windows.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_DEFS_WINDOWS_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_DEFS_WINDOWS_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *id; char *id_type; yajl_val _residual; } runtime_spec_schema_defs_windows_device; void free_runtime_spec_schema_defs_windows_device (runtime_spec_schema_defs_windows_device *ptr); runtime_spec_schema_defs_windows_device *make_runtime_spec_schema_defs_windows_device (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_defs_windows_device (yajl_gen g, const runtime_spec_schema_defs_windows_device *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_state_schema.h0000644000000000000000000000311014656670200024174 0ustar0000000000000000// Generated from state-schema.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_STATE_SCHEMA_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_STATE_SCHEMA_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/runtime_spec_schema_defs.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *oci_version; char *id; char *status; int pid; char *bundle; json_map_string_string *annotations; yajl_val _residual; unsigned int pid_present : 1; } runtime_spec_schema_state_schema; void free_runtime_spec_schema_state_schema (runtime_spec_schema_state_schema *ptr); runtime_spec_schema_state_schema *make_runtime_spec_schema_state_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_state_schema (yajl_gen g, const runtime_spec_schema_state_schema *ptr, const struct parser_context *ctx, parser_error *err); runtime_spec_schema_state_schema *runtime_spec_schema_state_schema_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); runtime_spec_schema_state_schema *runtime_spec_schema_state_schema_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); runtime_spec_schema_state_schema *runtime_spec_schema_state_schema_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *runtime_spec_schema_state_schema_generate_json(const runtime_spec_schema_state_schema *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_features_linux.h0000644000000000000000000001404514656670200024602 0ustar0000000000000000// Generated from features-linux.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_FEATURES_LINUX_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_FEATURES_LINUX_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/runtime_spec_schema_defs_linux.h" #ifdef __cplusplus extern "C" { #endif typedef struct { bool v1; bool v2; bool systemd; bool systemd_user; bool rdma; yajl_val _residual; unsigned int v1_present : 1; unsigned int v2_present : 1; unsigned int systemd_present : 1; unsigned int systemd_user_present : 1; unsigned int rdma_present : 1; } runtime_spec_schema_features_linux_cgroup; void free_runtime_spec_schema_features_linux_cgroup (runtime_spec_schema_features_linux_cgroup *ptr); runtime_spec_schema_features_linux_cgroup *make_runtime_spec_schema_features_linux_cgroup (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_features_linux_cgroup (yajl_gen g, const runtime_spec_schema_features_linux_cgroup *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { bool enabled; char **actions; size_t actions_len; char **operators; size_t operators_len; char **archs; size_t archs_len; char **known_flags; size_t known_flags_len; char **supported_flags; size_t supported_flags_len; yajl_val _residual; unsigned int enabled_present : 1; } runtime_spec_schema_features_linux_seccomp; void free_runtime_spec_schema_features_linux_seccomp (runtime_spec_schema_features_linux_seccomp *ptr); runtime_spec_schema_features_linux_seccomp *make_runtime_spec_schema_features_linux_seccomp (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_features_linux_seccomp (yajl_gen g, const runtime_spec_schema_features_linux_seccomp *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { bool enabled; yajl_val _residual; unsigned int enabled_present : 1; } runtime_spec_schema_features_linux_apparmor; void free_runtime_spec_schema_features_linux_apparmor (runtime_spec_schema_features_linux_apparmor *ptr); runtime_spec_schema_features_linux_apparmor *make_runtime_spec_schema_features_linux_apparmor (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_features_linux_apparmor (yajl_gen g, const runtime_spec_schema_features_linux_apparmor *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { bool enabled; yajl_val _residual; unsigned int enabled_present : 1; } runtime_spec_schema_features_linux_selinux; void free_runtime_spec_schema_features_linux_selinux (runtime_spec_schema_features_linux_selinux *ptr); runtime_spec_schema_features_linux_selinux *make_runtime_spec_schema_features_linux_selinux (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_features_linux_selinux (yajl_gen g, const runtime_spec_schema_features_linux_selinux *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { bool enabled; yajl_val _residual; unsigned int enabled_present : 1; } runtime_spec_schema_features_linux_intel_rdt; void free_runtime_spec_schema_features_linux_intel_rdt (runtime_spec_schema_features_linux_intel_rdt *ptr); runtime_spec_schema_features_linux_intel_rdt *make_runtime_spec_schema_features_linux_intel_rdt (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_features_linux_intel_rdt (yajl_gen g, const runtime_spec_schema_features_linux_intel_rdt *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { bool enabled; yajl_val _residual; unsigned int enabled_present : 1; } runtime_spec_schema_features_linux_mount_extensions_idmap; void free_runtime_spec_schema_features_linux_mount_extensions_idmap (runtime_spec_schema_features_linux_mount_extensions_idmap *ptr); runtime_spec_schema_features_linux_mount_extensions_idmap *make_runtime_spec_schema_features_linux_mount_extensions_idmap (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_features_linux_mount_extensions_idmap (yajl_gen g, const runtime_spec_schema_features_linux_mount_extensions_idmap *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { runtime_spec_schema_features_linux_mount_extensions_idmap *idmap; yajl_val _residual; } runtime_spec_schema_features_linux_mount_extensions; void free_runtime_spec_schema_features_linux_mount_extensions (runtime_spec_schema_features_linux_mount_extensions *ptr); runtime_spec_schema_features_linux_mount_extensions *make_runtime_spec_schema_features_linux_mount_extensions (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_features_linux_mount_extensions (yajl_gen g, const runtime_spec_schema_features_linux_mount_extensions *ptr, const struct parser_context *ctx, parser_error *err); typedef struct { char **namespaces; size_t namespaces_len; char **capabilities; size_t capabilities_len; runtime_spec_schema_features_linux_cgroup *cgroup; runtime_spec_schema_features_linux_seccomp *seccomp; runtime_spec_schema_features_linux_apparmor *apparmor; runtime_spec_schema_features_linux_selinux *selinux; runtime_spec_schema_features_linux_intel_rdt *intel_rdt; runtime_spec_schema_features_linux_mount_extensions *mount_extensions; yajl_val _residual; } runtime_spec_schema_features_linux; void free_runtime_spec_schema_features_linux (runtime_spec_schema_features_linux *ptr); runtime_spec_schema_features_linux *make_runtime_spec_schema_features_linux (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_features_linux (yajl_gen g, const runtime_spec_schema_features_linux *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_features_schema.h0000644000000000000000000000363714656670200024710 0ustar0000000000000000// Generated from features-schema.json. Do not edit! #ifndef RUNTIME_SPEC_SCHEMA_FEATURES_SCHEMA_SCHEMA_H #define RUNTIME_SPEC_SCHEMA_FEATURES_SCHEMA_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/runtime_spec_schema_defs.h" #include "ocispec/runtime_spec_schema_features_linux.h" #include "ocispec/runtime_spec_schema_defs_linux.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *oci_version_min; char *oci_version_max; char **hooks; size_t hooks_len; char **mount_options; size_t mount_options_len; json_map_string_string *annotations; char **potentially_unsafe_config_annotations; size_t potentially_unsafe_config_annotations_len; runtime_spec_schema_features_linux *linux; yajl_val _residual; } runtime_spec_schema_features_schema; void free_runtime_spec_schema_features_schema (runtime_spec_schema_features_schema *ptr); runtime_spec_schema_features_schema *make_runtime_spec_schema_features_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_runtime_spec_schema_features_schema (yajl_gen g, const runtime_spec_schema_features_schema *ptr, const struct parser_context *ctx, parser_error *err); runtime_spec_schema_features_schema *runtime_spec_schema_features_schema_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); runtime_spec_schema_features_schema *runtime_spec_schema_features_schema_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); runtime_spec_schema_features_schema *runtime_spec_schema_features_schema_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *runtime_spec_schema_features_schema_generate_json(const runtime_spec_schema_features_schema *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/image_manifest_items_image_manifest_items_schema.h0000644000000000000000000000373314656670200027374 0ustar0000000000000000// Generated from image-manifest-items-schema.json. Do not edit! #ifndef IMAGE_MANIFEST_ITEMS_IMAGE_MANIFEST_ITEMS_SCHEMA_SCHEMA_H #define IMAGE_MANIFEST_ITEMS_IMAGE_MANIFEST_ITEMS_SCHEMA_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *config; char **layers; size_t layers_len; char **repo_tags; size_t repo_tags_len; char *parent; } image_manifest_items_image_manifest_items_schema_element; void free_image_manifest_items_image_manifest_items_schema_element (image_manifest_items_image_manifest_items_schema_element *ptr); image_manifest_items_image_manifest_items_schema_element *make_image_manifest_items_image_manifest_items_schema_element (yajl_val tree, const struct parser_context *ctx, parser_error *err); typedef struct { image_manifest_items_image_manifest_items_schema_element **items; size_t len; } image_manifest_items_image_manifest_items_schema_container; void free_image_manifest_items_image_manifest_items_schema_container (image_manifest_items_image_manifest_items_schema_container *ptr); image_manifest_items_image_manifest_items_schema_container *image_manifest_items_image_manifest_items_schema_container_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); image_manifest_items_image_manifest_items_schema_container *image_manifest_items_image_manifest_items_schema_container_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); image_manifest_items_image_manifest_items_schema_container *image_manifest_items_image_manifest_items_schema_container_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *image_manifest_items_image_manifest_items_schema_container_generate_json(const image_manifest_items_image_manifest_items_schema_container *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/basic_test_double_array_item.h0000644000000000000000000000267014656670200023337 0ustar0000000000000000// Generated from test_double_array_item.json. Do not edit! #ifndef BASIC_TEST_DOUBLE_ARRAY_ITEM_SCHEMA_H #define BASIC_TEST_DOUBLE_ARRAY_ITEM_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char *item1; int32_t item2; bool item3; yajl_val _residual; unsigned int item2_present : 1; unsigned int item3_present : 1; } basic_test_double_array_item; void free_basic_test_double_array_item (basic_test_double_array_item *ptr); basic_test_double_array_item *make_basic_test_double_array_item (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_basic_test_double_array_item (yajl_gen g, const basic_test_double_array_item *ptr, const struct parser_context *ctx, parser_error *err); basic_test_double_array_item *basic_test_double_array_item_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); basic_test_double_array_item *basic_test_double_array_item_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); basic_test_double_array_item *basic_test_double_array_item_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *basic_test_double_array_item_generate_json(const basic_test_double_array_item *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/basic_test_double_array.h0000644000000000000000000000424114656670200022315 0ustar0000000000000000// Generated from test_double_array.json. Do not edit! #ifndef BASIC_TEST_DOUBLE_ARRAY_SCHEMA_H #define BASIC_TEST_DOUBLE_ARRAY_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/basic_test_double_array_item.h" #ifdef __cplusplus extern "C" { #endif typedef struct { bool first; char *second; unsigned int first_present : 1; } basic_test_double_array_objectarrays_element; void free_basic_test_double_array_objectarrays_element (basic_test_double_array_objectarrays_element *ptr); basic_test_double_array_objectarrays_element *make_basic_test_double_array_objectarrays_element (yajl_val tree, const struct parser_context *ctx, parser_error *err); typedef struct { char ***strarrays; size_t *strarrays_item_lens; size_t strarrays_len; int32_t **intarrays; size_t *intarrays_item_lens; size_t intarrays_len; bool **boolarrays; size_t *boolarrays_item_lens; size_t boolarrays_len; basic_test_double_array_objectarrays_element ***objectarrays; size_t *objectarrays_item_lens; size_t objectarrays_len; basic_test_double_array_item ***refobjarrays; size_t *refobjarrays_item_lens; size_t refobjarrays_len; yajl_val _residual; } basic_test_double_array; void free_basic_test_double_array (basic_test_double_array *ptr); basic_test_double_array *make_basic_test_double_array (yajl_val tree, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_basic_test_double_array (yajl_gen g, const basic_test_double_array *ptr, const struct parser_context *ctx, parser_error *err); basic_test_double_array *basic_test_double_array_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); basic_test_double_array *basic_test_double_array_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); basic_test_double_array *basic_test_double_array_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *basic_test_double_array_generate_json(const basic_test_double_array *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/basic_test_top_array_int.h0000644000000000000000000000212614656670200022517 0ustar0000000000000000// Generated from test_top_array_int.json. Do not edit! #ifndef BASIC_TEST_TOP_ARRAY_INT_SCHEMA_H #define BASIC_TEST_TOP_ARRAY_INT_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { int32_t *items; size_t len; } basic_test_top_array_int_container; void free_basic_test_top_array_int_container (basic_test_top_array_int_container *ptr); basic_test_top_array_int_container *basic_test_top_array_int_container_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); basic_test_top_array_int_container *basic_test_top_array_int_container_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); basic_test_top_array_int_container *basic_test_top_array_int_container_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *basic_test_top_array_int_container_generate_json(const basic_test_top_array_int_container *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/basic_test_top_array_string.h0000644000000000000000000000217614656670200023240 0ustar0000000000000000// Generated from test_top_array_string.json. Do not edit! #ifndef BASIC_TEST_TOP_ARRAY_STRING_SCHEMA_H #define BASIC_TEST_TOP_ARRAY_STRING_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char **items; size_t len; } basic_test_top_array_string_container; void free_basic_test_top_array_string_container (basic_test_top_array_string_container *ptr); basic_test_top_array_string_container *basic_test_top_array_string_container_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); basic_test_top_array_string_container *basic_test_top_array_string_container_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); basic_test_top_array_string_container *basic_test_top_array_string_container_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *basic_test_top_array_string_container_generate_json(const basic_test_top_array_string_container *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/basic_test_top_double_array_int.h0000644000000000000000000000232414656670200024051 0ustar0000000000000000// Generated from test_top_double_array_int.json. Do not edit! #ifndef BASIC_TEST_TOP_DOUBLE_ARRAY_INT_SCHEMA_H #define BASIC_TEST_TOP_DOUBLE_ARRAY_INT_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { int32_t **items; size_t *subitem_lens; size_t len; } basic_test_top_double_array_int_container; void free_basic_test_top_double_array_int_container (basic_test_top_double_array_int_container *ptr); basic_test_top_double_array_int_container *basic_test_top_double_array_int_container_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); basic_test_top_double_array_int_container *basic_test_top_double_array_int_container_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); basic_test_top_double_array_int_container *basic_test_top_double_array_int_container_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *basic_test_top_double_array_int_container_generate_json(const basic_test_top_double_array_int_container *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/basic_test_top_double_array_obj.h0000644000000000000000000000326014656670200024031 0ustar0000000000000000// Generated from test_top_double_array_obj.json. Do not edit! #ifndef BASIC_TEST_TOP_DOUBLE_ARRAY_OBJ_SCHEMA_H #define BASIC_TEST_TOP_DOUBLE_ARRAY_OBJ_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { bool first; int32_t second; char *third; unsigned int first_present : 1; unsigned int second_present : 1; } basic_test_top_double_array_obj_element; void free_basic_test_top_double_array_obj_element (basic_test_top_double_array_obj_element *ptr); basic_test_top_double_array_obj_element *make_basic_test_top_double_array_obj_element (yajl_val tree, const struct parser_context *ctx, parser_error *err); typedef struct { basic_test_top_double_array_obj_element ***items; size_t *subitem_lens; size_t len; } basic_test_top_double_array_obj_container; void free_basic_test_top_double_array_obj_container (basic_test_top_double_array_obj_container *ptr); basic_test_top_double_array_obj_container *basic_test_top_double_array_obj_container_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); basic_test_top_double_array_obj_container *basic_test_top_double_array_obj_container_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); basic_test_top_double_array_obj_container *basic_test_top_double_array_obj_container_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *basic_test_top_double_array_obj_container_generate_json(const basic_test_top_double_array_obj_container *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/basic_test_top_double_array_refobj.h0000644000000000000000000000250614656670200024530 0ustar0000000000000000// Generated from test_top_double_array_refobj.json. Do not edit! #ifndef BASIC_TEST_TOP_DOUBLE_ARRAY_REFOBJ_SCHEMA_H #define BASIC_TEST_TOP_DOUBLE_ARRAY_REFOBJ_SCHEMA_H #include #include #include "ocispec/json_common.h" #include "ocispec/basic_test_double_array_item.h" #ifdef __cplusplus extern "C" { #endif typedef struct { basic_test_double_array_item ***items; size_t *subitem_lens; size_t len; } basic_test_top_double_array_refobj_container; void free_basic_test_top_double_array_refobj_container (basic_test_top_double_array_refobj_container *ptr); basic_test_top_double_array_refobj_container *basic_test_top_double_array_refobj_container_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); basic_test_top_double_array_refobj_container *basic_test_top_double_array_refobj_container_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); basic_test_top_double_array_refobj_container *basic_test_top_double_array_refobj_container_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *basic_test_top_double_array_refobj_container_generate_json(const basic_test_top_double_array_refobj_container *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/basic_test_top_double_array_string.h0000644000000000000000000000237414656670200024572 0ustar0000000000000000// Generated from test_top_double_array_string.json. Do not edit! #ifndef BASIC_TEST_TOP_DOUBLE_ARRAY_STRING_SCHEMA_H #define BASIC_TEST_TOP_DOUBLE_ARRAY_STRING_SCHEMA_H #include #include #include "ocispec/json_common.h" #ifdef __cplusplus extern "C" { #endif typedef struct { char ***items; size_t *subitem_lens; size_t len; } basic_test_top_double_array_string_container; void free_basic_test_top_double_array_string_container (basic_test_top_double_array_string_container *ptr); basic_test_top_double_array_string_container *basic_test_top_double_array_string_container_parse_file(const char *filename, const struct parser_context *ctx, parser_error *err); basic_test_top_double_array_string_container *basic_test_top_double_array_string_container_parse_file_stream(FILE *stream, const struct parser_context *ctx, parser_error *err); basic_test_top_double_array_string_container *basic_test_top_double_array_string_container_parse_data(const char *jsondata, const struct parser_context *ctx, parser_error *err); char *basic_test_top_double_array_string_container_generate_json(const basic_test_top_double_array_string_container *ptr, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/json_common.h0000644000000000000000000001712714416051456017775 0ustar0000000000000000#ifndef _JSON_COMMON_H #define _JSON_COMMON_H #include #include #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif #undef linux #ifdef __MUSL__ #undef stdin #undef stdout #undef stderr #define stdin stdin #define stdout stdout #define stderr stderr #endif // options to report error if there is unknown key found in json #define OPT_PARSE_STRICT 0x01 // options to generate all key and value #define OPT_GEN_KEY_VALUE 0x02 // options to generate simplify(no indent) json string #define OPT_GEN_SIMPLIFY 0x04 // options to keep all keys and values, even do not known #define OPT_PARSE_FULLKEY 0x08 // options not to validate utf8 data #define OPT_GEN_NO_VALIDATE_UTF8 0x10 #define define_cleaner_function(type, cleaner) \ static inline void cleaner##_function (type *ptr) \ { \ if (*ptr) \ cleaner (*ptr); \ } #define __auto_cleanup(cleaner) __attribute__ ((__cleanup__ (cleaner##_function))) static inline void ptr_free_function (void *p) { free (*(void **) p); } #define __auto_free __auto_cleanup (ptr_free) #define move_ptr(ptr) \ ({ \ typeof (ptr) moved_ptr = (ptr); \ (ptr) = NULL; \ moved_ptr; \ }) #define GEN_SET_ERROR_AND_RETURN(stat, err) \ { \ if (*(err) == NULL) \ { \ if (asprintf (err, "%s: %s: %d: error generating json, errcode: %u", __FILE__, __func__, __LINE__, stat) < 0) \ { \ *(err) = strdup ("error allocating memory"); \ } \ } \ return stat; \ } typedef char *parser_error; struct parser_context { unsigned int options; FILE *errfile; }; yajl_gen_status gen_yajl_object_residual (yajl_val obj, yajl_gen g, parser_error *err); yajl_gen_status map_uint (void *ctx, long long unsigned int num); yajl_gen_status map_int (void *ctx, long long int num); bool json_gen_init (yajl_gen *g, const struct parser_context *ctx); yajl_val get_val (yajl_val tree, const char *name, yajl_type type); char *safe_strdup (const char *src); void *safe_malloc (size_t size); int common_safe_double (const char *numstr, double *converted); int common_safe_uint8 (const char *numstr, uint8_t *converted); int common_safe_uint16 (const char *numstr, uint16_t *converted); int common_safe_uint32 (const char *numstr, uint32_t *converted); int common_safe_uint64 (const char *numstr, uint64_t *converted); int common_safe_uint (const char *numstr, unsigned int *converted); int common_safe_int8 (const char *numstr, int8_t *converted); int common_safe_int16 (const char *numstr, int16_t *converted); int common_safe_int32 (const char *numstr, int32_t *converted); int common_safe_int64 (const char *numstr, int64_t *converted); int common_safe_int (const char *numstr, int *converted); typedef struct { int *keys; int *values; size_t len; } json_map_int_int; void free_json_map_int_int (json_map_int_int *map); json_map_int_int *make_json_map_int_int (yajl_val src, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_json_map_int_int (void *ctx, const json_map_int_int *map, const struct parser_context *ptx, parser_error *err); int append_json_map_int_int (json_map_int_int *map, int key, int val); typedef struct { int *keys; bool *values; size_t len; } json_map_int_bool; void free_json_map_int_bool (json_map_int_bool *map); json_map_int_bool *make_json_map_int_bool (yajl_val src, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_json_map_int_bool (void *ctx, const json_map_int_bool *map, const struct parser_context *ptx, parser_error *err); int append_json_map_int_bool (json_map_int_bool *map, int key, bool val); typedef struct { int *keys; char **values; size_t len; } json_map_int_string; void free_json_map_int_string (json_map_int_string *map); json_map_int_string *make_json_map_int_string (yajl_val src, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_json_map_int_string (void *ctx, const json_map_int_string *map, const struct parser_context *ptx, parser_error *err); int append_json_map_int_string (json_map_int_string *map, int key, const char *val); typedef struct { char **keys; int *values; size_t len; } json_map_string_int; void free_json_map_string_int (json_map_string_int *map); json_map_string_int *make_json_map_string_int (yajl_val src, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_json_map_string_int (void *ctx, const json_map_string_int *map, const struct parser_context *ptx, parser_error *err); int append_json_map_string_int (json_map_string_int *map, const char *key, int val); typedef struct { char **keys; bool *values; size_t len; } json_map_string_bool; void free_json_map_string_bool (json_map_string_bool *map); json_map_string_bool *make_json_map_string_bool (yajl_val src, const struct parser_context *ctx, parser_error *err); typedef struct { char **keys; int64_t *values; size_t len; } json_map_string_int64; void free_json_map_string_int64 (json_map_string_int64 *map); json_map_string_int64 *make_json_map_string_int64 (yajl_val src, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_json_map_string_int64 (void *ctx, const json_map_string_int64 *map, const struct parser_context *ptx, parser_error *err); int append_json_map_string_int64 (json_map_string_int64 *map, const char *key, int64_t val); yajl_gen_status gen_json_map_string_bool (void *ctx, const json_map_string_bool *map, const struct parser_context *ptx, parser_error *err); int append_json_map_string_bool (json_map_string_bool *map, const char *key, bool val); typedef struct { char **keys; char **values; size_t len; } json_map_string_string; void free_json_map_string_string (json_map_string_string *map); json_map_string_string *make_json_map_string_string (yajl_val src, const struct parser_context *ctx, parser_error *err); yajl_gen_status gen_json_map_string_string (void *ctx, const json_map_string_string *map, const struct parser_context *ptx, parser_error *err); int append_json_map_string_string (json_map_string_string *map, const char *key, const char *val); char *json_marshal_string (const char *str, size_t length, const struct parser_context *ctx, parser_error *err); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/ocispec/read-file.h0000644000000000000000000000142214332154664017275 0ustar0000000000000000/* Copyright 2017 Giuseppe Scrivano Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #ifndef READ_FILE_H #define READ_FILE_H #include #include extern char *fread_file (FILE *stream, size_t *length); extern char *read_file (const char *path, size_t *length); #endif crun-1.16.1/libocispec/src/ocispec/image_spec_schema_config_schema.c0000644000000000000000000014441314656670200023727 0ustar0000000000000000/* Generated from config-schema.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/image_spec_schema_config_schema.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (image_spec_schema_config_schema_config *, free_image_spec_schema_config_schema_config) image_spec_schema_config_schema_config * make_image_spec_schema_config_schema_config (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_config_schema_config) image_spec_schema_config_schema_config *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "User", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->user = strdup (str ? str : ""); if (ret->user == NULL) return NULL; } } while (0); ret->exposed_ports = make_image_spec_schema_defs_map_string_object (get_val (tree, "ExposedPorts", yajl_t_object), ctx, err); if (ret->exposed_ports == NULL && *err != 0) return NULL; do { yajl_val tmp = get_val (tree, "Env", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->env_len = len; ret->env = calloc (len + 1, sizeof (*ret->env)); if (ret->env == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->env[i] = strdup (str ? str : ""); if (ret->env[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "Entrypoint", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->entrypoint_len = len; ret->entrypoint = calloc (len + 1, sizeof (*ret->entrypoint)); if (ret->entrypoint == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->entrypoint[i] = strdup (str ? str : ""); if (ret->entrypoint[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "Cmd", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->cmd_len = len; ret->cmd = calloc (len + 1, sizeof (*ret->cmd)); if (ret->cmd == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->cmd[i] = strdup (str ? str : ""); if (ret->cmd[i] == NULL) return NULL; } } } } while (0); ret->volumes = make_image_spec_schema_defs_map_string_object (get_val (tree, "Volumes", yajl_t_object), ctx, err); if (ret->volumes == NULL && *err != 0) return NULL; do { yajl_val val = get_val (tree, "WorkingDir", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->working_dir = strdup (str ? str : ""); if (ret->working_dir == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "Labels", yajl_t_object); if (tmp != NULL) { ret->labels = make_json_map_string_string (tmp, ctx, err); if (ret->labels == NULL) { char *new_error = NULL; if (asprintf (&new_error, "Value error for key 'Labels': %s", *err ? *err : "null") < 0) new_error = strdup ("error allocating memory"); free (*err); *err = new_error; return NULL; } } } while (0); do { yajl_val val = get_val (tree, "StopSignal", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->stop_signal = strdup (str ? str : ""); if (ret->stop_signal == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "ArgsEscaped", yajl_t_true); if (val != NULL) { ret->args_escaped = YAJL_IS_TRUE(val); ret->args_escaped_present = 1; } else { val = get_val (tree, "ArgsEscaped", yajl_t_false); if (val != NULL) { ret->args_escaped = 0; ret->args_escaped_present = 1; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "User") && strcmp (tree->u.object.keys[i], "ExposedPorts") && strcmp (tree->u.object.keys[i], "Env") && strcmp (tree->u.object.keys[i], "Entrypoint") && strcmp (tree->u.object.keys[i], "Cmd") && strcmp (tree->u.object.keys[i], "Volumes") && strcmp (tree->u.object.keys[i], "WorkingDir") && strcmp (tree->u.object.keys[i], "Labels") && strcmp (tree->u.object.keys[i], "StopSignal") && strcmp (tree->u.object.keys[i], "ArgsEscaped")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_image_spec_schema_config_schema_config (image_spec_schema_config_schema_config *ptr) { if (ptr == NULL) return; free (ptr->user); ptr->user = NULL; free_image_spec_schema_defs_map_string_object (ptr->exposed_ports); ptr->exposed_ports = NULL; if (ptr->env != NULL) { size_t i; for (i = 0; i < ptr->env_len; i++) { if (ptr->env[i] != NULL) { free (ptr->env[i]); ptr->env[i] = NULL; } } free (ptr->env); ptr->env = NULL; } if (ptr->entrypoint != NULL) { size_t i; for (i = 0; i < ptr->entrypoint_len; i++) { if (ptr->entrypoint[i] != NULL) { free (ptr->entrypoint[i]); ptr->entrypoint[i] = NULL; } } free (ptr->entrypoint); ptr->entrypoint = NULL; } if (ptr->cmd != NULL) { size_t i; for (i = 0; i < ptr->cmd_len; i++) { if (ptr->cmd[i] != NULL) { free (ptr->cmd[i]); ptr->cmd[i] = NULL; } } free (ptr->cmd); ptr->cmd = NULL; } free_image_spec_schema_defs_map_string_object (ptr->volumes); ptr->volumes = NULL; free (ptr->working_dir); ptr->working_dir = NULL; free_json_map_string_string (ptr->labels); ptr->labels = NULL; free (ptr->stop_signal); ptr->stop_signal = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_image_spec_schema_config_schema_config (yajl_gen g, const image_spec_schema_config_schema_config *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->user != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("User"), 4 /* strlen ("User") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->user != NULL) str = ptr->user; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->exposed_ports != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("ExposedPorts"), 12 /* strlen ("ExposedPorts") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_image_spec_schema_defs_map_string_object (g, ptr != NULL ? ptr->exposed_ports : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->env != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("Env"), 3 /* strlen ("Env") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->env != NULL) len = ptr->env_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->env[i]), strlen (ptr->env[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->entrypoint != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("Entrypoint"), 10 /* strlen ("Entrypoint") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->entrypoint != NULL) len = ptr->entrypoint_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->entrypoint[i]), strlen (ptr->entrypoint[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->cmd != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("Cmd"), 3 /* strlen ("Cmd") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->cmd != NULL) len = ptr->cmd_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->cmd[i]), strlen (ptr->cmd[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->volumes != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("Volumes"), 7 /* strlen ("Volumes") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_image_spec_schema_defs_map_string_object (g, ptr != NULL ? ptr->volumes : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->working_dir != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("WorkingDir"), 10 /* strlen ("WorkingDir") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->working_dir != NULL) str = ptr->working_dir; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->labels != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("labels"), 6 /* strlen ("labels") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_json_map_string_string (g, ptr ? ptr->labels : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->stop_signal != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("StopSignal"), 10 /* strlen ("StopSignal") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->stop_signal != NULL) str = ptr->stop_signal; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->args_escaped_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("ArgsEscaped"), 11 /* strlen ("ArgsEscaped") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->args_escaped) b = ptr->args_escaped; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (image_spec_schema_config_schema_rootfs *, free_image_spec_schema_config_schema_rootfs) image_spec_schema_config_schema_rootfs * make_image_spec_schema_config_schema_rootfs (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_config_schema_rootfs) image_spec_schema_config_schema_rootfs *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "diff_ids", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->diff_ids_len = len; ret->diff_ids = calloc (len + 1, sizeof (*ret->diff_ids)); if (ret->diff_ids == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->diff_ids[i] = strdup (str ? str : ""); if (ret->diff_ids[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "type", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->type = strdup (str ? str : ""); if (ret->type == NULL) return NULL; } } while (0); if (ret->diff_ids == NULL) { if (asprintf (err, "Required field '%s' not present", "diff_ids") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->type == NULL) { if (asprintf (err, "Required field '%s' not present", "type") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "diff_ids") && strcmp (tree->u.object.keys[i], "type")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_image_spec_schema_config_schema_rootfs (image_spec_schema_config_schema_rootfs *ptr) { if (ptr == NULL) return; if (ptr->diff_ids != NULL) { size_t i; for (i = 0; i < ptr->diff_ids_len; i++) { if (ptr->diff_ids[i] != NULL) { free (ptr->diff_ids[i]); ptr->diff_ids[i] = NULL; } } free (ptr->diff_ids); ptr->diff_ids = NULL; } free (ptr->type); ptr->type = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_image_spec_schema_config_schema_rootfs (yajl_gen g, const image_spec_schema_config_schema_rootfs *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->diff_ids != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("diff_ids"), 8 /* strlen ("diff_ids") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->diff_ids != NULL) len = ptr->diff_ids_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->diff_ids[i]), strlen (ptr->diff_ids[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("type"), 4 /* strlen ("type") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->type != NULL) str = ptr->type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (image_spec_schema_config_schema_history_element *, free_image_spec_schema_config_schema_history_element) image_spec_schema_config_schema_history_element * make_image_spec_schema_config_schema_history_element (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_config_schema_history_element) image_spec_schema_config_schema_history_element *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "created", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->created = strdup (str ? str : ""); if (ret->created == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "author", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->author = strdup (str ? str : ""); if (ret->author == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "created_by", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->created_by = strdup (str ? str : ""); if (ret->created_by == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "comment", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->comment = strdup (str ? str : ""); if (ret->comment == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "empty_layer", yajl_t_true); if (val != NULL) { ret->empty_layer = YAJL_IS_TRUE(val); ret->empty_layer_present = 1; } else { val = get_val (tree, "empty_layer", yajl_t_false); if (val != NULL) { ret->empty_layer = 0; ret->empty_layer_present = 1; } } } while (0); return move_ptr (ret); } void free_image_spec_schema_config_schema_history_element (image_spec_schema_config_schema_history_element *ptr) { if (ptr == NULL) return; free (ptr->created); ptr->created = NULL; free (ptr->author); ptr->author = NULL; free (ptr->created_by); ptr->created_by = NULL; free (ptr->comment); ptr->comment = NULL; free (ptr); } yajl_gen_status gen_image_spec_schema_config_schema_history_element (yajl_gen g, const image_spec_schema_config_schema_history_element *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->created != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("created"), 7 /* strlen ("created") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->created != NULL) str = ptr->created; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->author != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("author"), 6 /* strlen ("author") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->author != NULL) str = ptr->author; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->created_by != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("created_by"), 10 /* strlen ("created_by") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->created_by != NULL) str = ptr->created_by; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->comment != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("comment"), 7 /* strlen ("comment") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->comment != NULL) str = ptr->comment; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->empty_layer_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("empty_layer"), 11 /* strlen ("empty_layer") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->empty_layer) b = ptr->empty_layer; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (image_spec_schema_config_schema *, free_image_spec_schema_config_schema) image_spec_schema_config_schema * make_image_spec_schema_config_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_config_schema) image_spec_schema_config_schema *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "created", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->created = strdup (str ? str : ""); if (ret->created == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "author", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->author = strdup (str ? str : ""); if (ret->author == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "architecture", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->architecture = strdup (str ? str : ""); if (ret->architecture == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "variant", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->variant = strdup (str ? str : ""); if (ret->variant == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "os", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->os = strdup (str ? str : ""); if (ret->os == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "os.version", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->os_version = strdup (str ? str : ""); if (ret->os_version == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "os.features", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->os_features_len = len; ret->os_features = calloc (len + 1, sizeof (*ret->os_features)); if (ret->os_features == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->os_features[i] = strdup (str ? str : ""); if (ret->os_features[i] == NULL) return NULL; } } } } while (0); ret->config = make_image_spec_schema_config_schema_config (get_val (tree, "config", yajl_t_object), ctx, err); if (ret->config == NULL && *err != 0) return NULL; ret->rootfs = make_image_spec_schema_config_schema_rootfs (get_val (tree, "rootfs", yajl_t_object), ctx, err); if (ret->rootfs == NULL && *err != 0) return NULL; do { yajl_val tmp = get_val (tree, "history", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->history_len = len; ret->history = calloc (len + 1, sizeof (*ret->history)); if (ret->history == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->history[i] = make_image_spec_schema_config_schema_history_element (val, ctx, err); if (ret->history[i] == NULL) return NULL; } } } while (0); if (ret->architecture == NULL) { if (asprintf (err, "Required field '%s' not present", "architecture") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->os == NULL) { if (asprintf (err, "Required field '%s' not present", "os") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->rootfs == NULL) { if (asprintf (err, "Required field '%s' not present", "rootfs") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "created") && strcmp (tree->u.object.keys[i], "author") && strcmp (tree->u.object.keys[i], "architecture") && strcmp (tree->u.object.keys[i], "variant") && strcmp (tree->u.object.keys[i], "os") && strcmp (tree->u.object.keys[i], "os.version") && strcmp (tree->u.object.keys[i], "os.features") && strcmp (tree->u.object.keys[i], "config") && strcmp (tree->u.object.keys[i], "rootfs") && strcmp (tree->u.object.keys[i], "history")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_image_spec_schema_config_schema (image_spec_schema_config_schema *ptr) { if (ptr == NULL) return; free (ptr->created); ptr->created = NULL; free (ptr->author); ptr->author = NULL; free (ptr->architecture); ptr->architecture = NULL; free (ptr->variant); ptr->variant = NULL; free (ptr->os); ptr->os = NULL; free (ptr->os_version); ptr->os_version = NULL; if (ptr->os_features != NULL) { size_t i; for (i = 0; i < ptr->os_features_len; i++) { if (ptr->os_features[i] != NULL) { free (ptr->os_features[i]); ptr->os_features[i] = NULL; } } free (ptr->os_features); ptr->os_features = NULL; } if (ptr->config != NULL) { free_image_spec_schema_config_schema_config (ptr->config); ptr->config = NULL; } if (ptr->rootfs != NULL) { free_image_spec_schema_config_schema_rootfs (ptr->rootfs); ptr->rootfs = NULL; } if (ptr->history != NULL) { size_t i; for (i = 0; i < ptr->history_len; i++) { if (ptr->history[i] != NULL) { free_image_spec_schema_config_schema_history_element (ptr->history[i]); ptr->history[i] = NULL; } } free (ptr->history); ptr->history = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_image_spec_schema_config_schema (yajl_gen g, const image_spec_schema_config_schema *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->created != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("created"), 7 /* strlen ("created") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->created != NULL) str = ptr->created; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->author != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("author"), 6 /* strlen ("author") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->author != NULL) str = ptr->author; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->architecture != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("architecture"), 12 /* strlen ("architecture") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->architecture != NULL) str = ptr->architecture; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->variant != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("variant"), 7 /* strlen ("variant") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->variant != NULL) str = ptr->variant; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->os != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("os"), 2 /* strlen ("os") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->os != NULL) str = ptr->os; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->os_version != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("os.version"), 10 /* strlen ("os.version") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->os_version != NULL) str = ptr->os_version; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->os_features != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("os.features"), 11 /* strlen ("os.features") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->os_features != NULL) len = ptr->os_features_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->os_features[i]), strlen (ptr->os_features[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->config != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("config"), 6 /* strlen ("config") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_image_spec_schema_config_schema_config (g, ptr != NULL ? ptr->config : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->rootfs != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("rootfs"), 6 /* strlen ("rootfs") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_image_spec_schema_config_schema_rootfs (g, ptr != NULL ? ptr->rootfs : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->history != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("history"), 7 /* strlen ("history") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->history != NULL) len = ptr->history_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_image_spec_schema_config_schema_history_element (g, ptr->history[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } image_spec_schema_config_schema * image_spec_schema_config_schema_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { image_spec_schema_config_schema *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = image_spec_schema_config_schema_parse_data (content, ctx, err);return ptr; } image_spec_schema_config_schema * image_spec_schema_config_schema_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {image_spec_schema_config_schema *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = image_spec_schema_config_schema_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) image_spec_schema_config_schema * image_spec_schema_config_schema_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { image_spec_schema_config_schema *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_image_spec_schema_config_schema (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * image_spec_schema_config_schema_generate_json (const image_spec_schema_config_schema *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_image_spec_schema_config_schema (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/image_spec_schema_content_descriptor.c0000644000000000000000000004025614656670200025052 0ustar0000000000000000/* Generated from content-descriptor.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/image_spec_schema_content_descriptor.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (image_spec_schema_content_descriptor *, free_image_spec_schema_content_descriptor) image_spec_schema_content_descriptor * make_image_spec_schema_content_descriptor (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_content_descriptor) image_spec_schema_content_descriptor *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "mediaType", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->media_type = strdup (str ? str : ""); if (ret->media_type == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "size", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->size); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'size': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->size_present = 1; } } while (0); do { yajl_val val = get_val (tree, "digest", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->digest = strdup (str ? str : ""); if (ret->digest == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "urls", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->urls_len = len; ret->urls = calloc (len + 1, sizeof (*ret->urls)); if (ret->urls == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->urls[i] = strdup (str ? str : ""); if (ret->urls[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "data", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->data = strdup (str ? str : ""); if (ret->data == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "artifactType", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->artifact_type = strdup (str ? str : ""); if (ret->artifact_type == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "annotations", yajl_t_object); if (tmp != NULL) { ret->annotations = make_json_map_string_string (tmp, ctx, err); if (ret->annotations == NULL) { char *new_error = NULL; if (asprintf (&new_error, "Value error for key 'annotations': %s", *err ? *err : "null") < 0) new_error = strdup ("error allocating memory"); free (*err); *err = new_error; return NULL; } } } while (0); if (ret->media_type == NULL) { if (asprintf (err, "Required field '%s' not present", "mediaType") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->digest == NULL) { if (asprintf (err, "Required field '%s' not present", "digest") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "mediaType") && strcmp (tree->u.object.keys[i], "size") && strcmp (tree->u.object.keys[i], "digest") && strcmp (tree->u.object.keys[i], "urls") && strcmp (tree->u.object.keys[i], "data") && strcmp (tree->u.object.keys[i], "artifactType") && strcmp (tree->u.object.keys[i], "annotations")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_image_spec_schema_content_descriptor (image_spec_schema_content_descriptor *ptr) { if (ptr == NULL) return; free (ptr->media_type); ptr->media_type = NULL; free (ptr->digest); ptr->digest = NULL; if (ptr->urls != NULL) { size_t i; for (i = 0; i < ptr->urls_len; i++) { if (ptr->urls[i] != NULL) { free (ptr->urls[i]); ptr->urls[i] = NULL; } } free (ptr->urls); ptr->urls = NULL; } free (ptr->data); ptr->data = NULL; free (ptr->artifact_type); ptr->artifact_type = NULL; free_json_map_string_string (ptr->annotations); ptr->annotations = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_image_spec_schema_content_descriptor (yajl_gen g, const image_spec_schema_content_descriptor *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->media_type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("mediaType"), 9 /* strlen ("mediaType") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->media_type != NULL) str = ptr->media_type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->size_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("size"), 4 /* strlen ("size") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->size) num = (long long int)ptr->size; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->digest != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("digest"), 6 /* strlen ("digest") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->digest != NULL) str = ptr->digest; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->urls != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("urls"), 4 /* strlen ("urls") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->urls != NULL) len = ptr->urls_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->urls[i]), strlen (ptr->urls[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->data != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("data"), 4 /* strlen ("data") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->data != NULL) str = ptr->data; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->artifact_type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("artifactType"), 12 /* strlen ("artifactType") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->artifact_type != NULL) str = ptr->artifact_type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->annotations != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("annotations"), 11 /* strlen ("annotations") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_json_map_string_string (g, ptr ? ptr->annotations : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } image_spec_schema_content_descriptor * image_spec_schema_content_descriptor_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { image_spec_schema_content_descriptor *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = image_spec_schema_content_descriptor_parse_data (content, ctx, err);return ptr; } image_spec_schema_content_descriptor * image_spec_schema_content_descriptor_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {image_spec_schema_content_descriptor *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = image_spec_schema_content_descriptor_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) image_spec_schema_content_descriptor * image_spec_schema_content_descriptor_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { image_spec_schema_content_descriptor *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_image_spec_schema_content_descriptor (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * image_spec_schema_content_descriptor_generate_json (const image_spec_schema_content_descriptor *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_image_spec_schema_content_descriptor (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/image_spec_schema_defs.c0000644000000000000000000001265714656670200022067 0ustar0000000000000000/* Generated from defs.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/image_spec_schema_defs.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (image_spec_schema_defs_map_string_object_element *, free_image_spec_schema_defs_map_string_object_element) image_spec_schema_defs_map_string_object_element * make_image_spec_schema_defs_map_string_object_element (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_defs_map_string_object_element) image_spec_schema_defs_map_string_object_element *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; return move_ptr (ret); } void free_image_spec_schema_defs_map_string_object_element (image_spec_schema_defs_map_string_object_element *ptr) { if (ptr == NULL) return; free (ptr); } yajl_gen_status gen_image_spec_schema_defs_map_string_object_element (yajl_gen g, const image_spec_schema_defs_map_string_object_element *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ if (!(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); return yajl_gen_status_ok; } define_cleaner_function (image_spec_schema_defs_map_string_object *, free_image_spec_schema_defs_map_string_object) image_spec_schema_defs_map_string_object * make_image_spec_schema_defs_map_string_object (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_defs_map_string_object) image_spec_schema_defs_map_string_object *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; if (YAJL_GET_OBJECT (tree) != NULL) { size_t i; size_t len = YAJL_GET_OBJECT_NO_CHECK (tree)->len; const char **keys = YAJL_GET_OBJECT_NO_CHECK (tree)->keys; yajl_val *values = YAJL_GET_OBJECT_NO_CHECK (tree)->values; ret->len = len; ret->keys = calloc (len + 1, sizeof (*ret->keys)); if (ret->keys == NULL) return NULL; ret->values = calloc (len + 1, sizeof (*ret->values)); if (ret->values == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val; const char *tmpkey = keys[i]; ret->keys[i] = strdup (tmpkey ? tmpkey : ""); if (ret->keys[i] == NULL) return NULL; val = values[i]; ret->values[i] = make_image_spec_schema_defs_map_string_object_element (val, ctx, err); if (ret->values[i] == NULL) return NULL; } } return move_ptr (ret); } void free_image_spec_schema_defs_map_string_object (image_spec_schema_defs_map_string_object *ptr) { if (ptr == NULL) return; if (ptr->keys != NULL && ptr->values != NULL) { size_t i; for (i = 0; i < ptr->len; i++) { free (ptr->keys[i]); ptr->keys[i] = NULL; free_image_spec_schema_defs_map_string_object_element (ptr->values[i]); ptr->values[i] = NULL; } free (ptr->keys); ptr->keys = NULL; free (ptr->values); ptr->values = NULL; } free (ptr); } yajl_gen_status gen_image_spec_schema_defs_map_string_object (yajl_gen g, const image_spec_schema_defs_map_string_object *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ size_t len = 0, i; if (ptr != NULL) len = ptr->len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (len || (ptr != NULL && ptr->keys != NULL && ptr->values != NULL)) { for (i = 0; i < len; i++) { char *str = ptr->keys[i] ? ptr->keys[i] : ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)str, strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_image_spec_schema_defs_map_string_object_element (g, ptr->values[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); return yajl_gen_status_ok; } crun-1.16.1/libocispec/src/ocispec/image_spec_schema_defs_descriptor.c0000644000000000000000000000047414656670200024317 0ustar0000000000000000/* Generated from defs-descriptor.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/image_spec_schema_defs_descriptor.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) crun-1.16.1/libocispec/src/ocispec/image_spec_schema_image_index_schema.c0000644000000000000000000010502514656670200024727 0ustar0000000000000000/* Generated from image-index-schema.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/image_spec_schema_image_index_schema.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (image_spec_schema_image_index_schema_manifests_platform *, free_image_spec_schema_image_index_schema_manifests_platform) image_spec_schema_image_index_schema_manifests_platform * make_image_spec_schema_image_index_schema_manifests_platform (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_image_index_schema_manifests_platform) image_spec_schema_image_index_schema_manifests_platform *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "architecture", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->architecture = strdup (str ? str : ""); if (ret->architecture == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "os", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->os = strdup (str ? str : ""); if (ret->os == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "os.version", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->os_version = strdup (str ? str : ""); if (ret->os_version == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "os.features", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->os_features_len = len; ret->os_features = calloc (len + 1, sizeof (*ret->os_features)); if (ret->os_features == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->os_features[i] = strdup (str ? str : ""); if (ret->os_features[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "variant", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->variant = strdup (str ? str : ""); if (ret->variant == NULL) return NULL; } } while (0); if (ret->architecture == NULL) { if (asprintf (err, "Required field '%s' not present", "architecture") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->os == NULL) { if (asprintf (err, "Required field '%s' not present", "os") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "architecture") && strcmp (tree->u.object.keys[i], "os") && strcmp (tree->u.object.keys[i], "os.version") && strcmp (tree->u.object.keys[i], "os.features") && strcmp (tree->u.object.keys[i], "variant")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_image_spec_schema_image_index_schema_manifests_platform (image_spec_schema_image_index_schema_manifests_platform *ptr) { if (ptr == NULL) return; free (ptr->architecture); ptr->architecture = NULL; free (ptr->os); ptr->os = NULL; free (ptr->os_version); ptr->os_version = NULL; if (ptr->os_features != NULL) { size_t i; for (i = 0; i < ptr->os_features_len; i++) { if (ptr->os_features[i] != NULL) { free (ptr->os_features[i]); ptr->os_features[i] = NULL; } } free (ptr->os_features); ptr->os_features = NULL; } free (ptr->variant); ptr->variant = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_image_spec_schema_image_index_schema_manifests_platform (yajl_gen g, const image_spec_schema_image_index_schema_manifests_platform *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->architecture != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("architecture"), 12 /* strlen ("architecture") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->architecture != NULL) str = ptr->architecture; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->os != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("os"), 2 /* strlen ("os") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->os != NULL) str = ptr->os; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->os_version != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("os.version"), 10 /* strlen ("os.version") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->os_version != NULL) str = ptr->os_version; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->os_features != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("os.features"), 11 /* strlen ("os.features") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->os_features != NULL) len = ptr->os_features_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->os_features[i]), strlen (ptr->os_features[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->variant != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("variant"), 7 /* strlen ("variant") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->variant != NULL) str = ptr->variant; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (image_spec_schema_image_index_schema_manifests_element *, free_image_spec_schema_image_index_schema_manifests_element) image_spec_schema_image_index_schema_manifests_element * make_image_spec_schema_image_index_schema_manifests_element (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_image_index_schema_manifests_element) image_spec_schema_image_index_schema_manifests_element *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "mediaType", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->media_type = strdup (str ? str : ""); if (ret->media_type == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "size", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->size); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'size': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->size_present = 1; } } while (0); do { yajl_val val = get_val (tree, "digest", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->digest = strdup (str ? str : ""); if (ret->digest == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "urls", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->urls_len = len; ret->urls = calloc (len + 1, sizeof (*ret->urls)); if (ret->urls == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->urls[i] = strdup (str ? str : ""); if (ret->urls[i] == NULL) return NULL; } } } } while (0); ret->platform = make_image_spec_schema_image_index_schema_manifests_platform (get_val (tree, "platform", yajl_t_object), ctx, err); if (ret->platform == NULL && *err != 0) return NULL; do { yajl_val tmp = get_val (tree, "annotations", yajl_t_object); if (tmp != NULL) { ret->annotations = make_json_map_string_string (tmp, ctx, err); if (ret->annotations == NULL) { char *new_error = NULL; if (asprintf (&new_error, "Value error for key 'annotations': %s", *err ? *err : "null") < 0) new_error = strdup ("error allocating memory"); free (*err); *err = new_error; return NULL; } } } while (0); if (ret->media_type == NULL) { if (asprintf (err, "Required field '%s' not present", "mediaType") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->digest == NULL) { if (asprintf (err, "Required field '%s' not present", "digest") < 0) *err = strdup ("error allocating memory"); return NULL; } return move_ptr (ret); } void free_image_spec_schema_image_index_schema_manifests_element (image_spec_schema_image_index_schema_manifests_element *ptr) { if (ptr == NULL) return; free (ptr->media_type); ptr->media_type = NULL; free (ptr->digest); ptr->digest = NULL; if (ptr->urls != NULL) { size_t i; for (i = 0; i < ptr->urls_len; i++) { if (ptr->urls[i] != NULL) { free (ptr->urls[i]); ptr->urls[i] = NULL; } } free (ptr->urls); ptr->urls = NULL; } if (ptr->platform != NULL) { free_image_spec_schema_image_index_schema_manifests_platform (ptr->platform); ptr->platform = NULL; } free_json_map_string_string (ptr->annotations); ptr->annotations = NULL; free (ptr); } yajl_gen_status gen_image_spec_schema_image_index_schema_manifests_element (yajl_gen g, const image_spec_schema_image_index_schema_manifests_element *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->media_type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("mediaType"), 9 /* strlen ("mediaType") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->media_type != NULL) str = ptr->media_type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->size_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("size"), 4 /* strlen ("size") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->size) num = (long long int)ptr->size; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->digest != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("digest"), 6 /* strlen ("digest") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->digest != NULL) str = ptr->digest; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->urls != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("urls"), 4 /* strlen ("urls") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->urls != NULL) len = ptr->urls_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->urls[i]), strlen (ptr->urls[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->platform != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("platform"), 8 /* strlen ("platform") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_image_spec_schema_image_index_schema_manifests_platform (g, ptr != NULL ? ptr->platform : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->annotations != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("annotations"), 11 /* strlen ("annotations") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_json_map_string_string (g, ptr ? ptr->annotations : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (image_spec_schema_image_index_schema *, free_image_spec_schema_image_index_schema) image_spec_schema_image_index_schema * make_image_spec_schema_image_index_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_image_index_schema) image_spec_schema_image_index_schema *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "schemaVersion", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int (YAJL_GET_NUMBER (val), (int *)&ret->schema_version); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'integer' for key 'schemaVersion': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->schema_version_present = 1; } } while (0); do { yajl_val val = get_val (tree, "mediaType", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->media_type = strdup (str ? str : ""); if (ret->media_type == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "artifactType", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->artifact_type = strdup (str ? str : ""); if (ret->artifact_type == NULL) return NULL; } } while (0); ret->subject = make_image_spec_schema_content_descriptor (get_val (tree, "subject", yajl_t_object), ctx, err); if (ret->subject == NULL && *err != 0) return NULL; do { yajl_val tmp = get_val (tree, "manifests", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->manifests_len = len; ret->manifests = calloc (len + 1, sizeof (*ret->manifests)); if (ret->manifests == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->manifests[i] = make_image_spec_schema_image_index_schema_manifests_element (val, ctx, err); if (ret->manifests[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "annotations", yajl_t_object); if (tmp != NULL) { ret->annotations = make_json_map_string_string (tmp, ctx, err); if (ret->annotations == NULL) { char *new_error = NULL; if (asprintf (&new_error, "Value error for key 'annotations': %s", *err ? *err : "null") < 0) new_error = strdup ("error allocating memory"); free (*err); *err = new_error; return NULL; } } } while (0); if (ret->manifests == NULL) { if (asprintf (err, "Required field '%s' not present", "manifests") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "schemaVersion") && strcmp (tree->u.object.keys[i], "mediaType") && strcmp (tree->u.object.keys[i], "artifactType") && strcmp (tree->u.object.keys[i], "subject") && strcmp (tree->u.object.keys[i], "manifests") && strcmp (tree->u.object.keys[i], "annotations")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_image_spec_schema_image_index_schema (image_spec_schema_image_index_schema *ptr) { if (ptr == NULL) return; free (ptr->media_type); ptr->media_type = NULL; free (ptr->artifact_type); ptr->artifact_type = NULL; if (ptr->subject != NULL) { free_image_spec_schema_content_descriptor (ptr->subject); ptr->subject = NULL; } if (ptr->manifests != NULL) { size_t i; for (i = 0; i < ptr->manifests_len; i++) { if (ptr->manifests[i] != NULL) { free_image_spec_schema_image_index_schema_manifests_element (ptr->manifests[i]); ptr->manifests[i] = NULL; } } free (ptr->manifests); ptr->manifests = NULL; } free_json_map_string_string (ptr->annotations); ptr->annotations = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_image_spec_schema_image_index_schema (yajl_gen g, const image_spec_schema_image_index_schema *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->schema_version_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("schemaVersion"), 13 /* strlen ("schemaVersion") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->schema_version) num = (long long int)ptr->schema_version; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->media_type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("mediaType"), 9 /* strlen ("mediaType") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->media_type != NULL) str = ptr->media_type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->artifact_type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("artifactType"), 12 /* strlen ("artifactType") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->artifact_type != NULL) str = ptr->artifact_type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->subject != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("subject"), 7 /* strlen ("subject") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_image_spec_schema_content_descriptor (g, ptr != NULL ? ptr->subject : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->manifests != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("manifests"), 9 /* strlen ("manifests") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->manifests != NULL) len = ptr->manifests_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_image_spec_schema_image_index_schema_manifests_element (g, ptr->manifests[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->annotations != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("annotations"), 11 /* strlen ("annotations") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_json_map_string_string (g, ptr ? ptr->annotations : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } image_spec_schema_image_index_schema * image_spec_schema_image_index_schema_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { image_spec_schema_image_index_schema *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = image_spec_schema_image_index_schema_parse_data (content, ctx, err);return ptr; } image_spec_schema_image_index_schema * image_spec_schema_image_index_schema_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {image_spec_schema_image_index_schema *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = image_spec_schema_image_index_schema_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) image_spec_schema_image_index_schema * image_spec_schema_image_index_schema_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { image_spec_schema_image_index_schema *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_image_spec_schema_image_index_schema (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * image_spec_schema_image_index_schema_generate_json (const image_spec_schema_image_index_schema *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_image_spec_schema_image_index_schema (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/image_spec_schema_image_layout_schema.c0000644000000000000000000002041514656670200025134 0ustar0000000000000000/* Generated from image-layout-schema.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/image_spec_schema_image_layout_schema.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (image_spec_schema_image_layout_schema *, free_image_spec_schema_image_layout_schema) image_spec_schema_image_layout_schema * make_image_spec_schema_image_layout_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_image_layout_schema) image_spec_schema_image_layout_schema *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "imageLayoutVersion", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->image_layout_version = strdup (str ? str : ""); if (ret->image_layout_version == NULL) return NULL; } } while (0); if (ret->image_layout_version == NULL) { if (asprintf (err, "Required field '%s' not present", "imageLayoutVersion") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "imageLayoutVersion")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_image_spec_schema_image_layout_schema (image_spec_schema_image_layout_schema *ptr) { if (ptr == NULL) return; free (ptr->image_layout_version); ptr->image_layout_version = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_image_spec_schema_image_layout_schema (yajl_gen g, const image_spec_schema_image_layout_schema *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->image_layout_version != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("imageLayoutVersion"), 18 /* strlen ("imageLayoutVersion") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->image_layout_version != NULL) str = ptr->image_layout_version; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } image_spec_schema_image_layout_schema * image_spec_schema_image_layout_schema_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { image_spec_schema_image_layout_schema *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = image_spec_schema_image_layout_schema_parse_data (content, ctx, err);return ptr; } image_spec_schema_image_layout_schema * image_spec_schema_image_layout_schema_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {image_spec_schema_image_layout_schema *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = image_spec_schema_image_layout_schema_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) image_spec_schema_image_layout_schema * image_spec_schema_image_layout_schema_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { image_spec_schema_image_layout_schema *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_image_spec_schema_image_layout_schema (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * image_spec_schema_image_layout_schema_generate_json (const image_spec_schema_image_layout_schema *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_image_spec_schema_image_layout_schema (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/image_spec_schema_image_manifest_schema.c0000644000000000000000000004006714656670200025432 0ustar0000000000000000/* Generated from image-manifest-schema.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/image_spec_schema_image_manifest_schema.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (image_spec_schema_image_manifest_schema *, free_image_spec_schema_image_manifest_schema) image_spec_schema_image_manifest_schema * make_image_spec_schema_image_manifest_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_spec_schema_image_manifest_schema) image_spec_schema_image_manifest_schema *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "schemaVersion", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int (YAJL_GET_NUMBER (val), (int *)&ret->schema_version); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'integer' for key 'schemaVersion': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->schema_version_present = 1; } } while (0); do { yajl_val val = get_val (tree, "mediaType", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->media_type = strdup (str ? str : ""); if (ret->media_type == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "artifactType", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->artifact_type = strdup (str ? str : ""); if (ret->artifact_type == NULL) return NULL; } } while (0); ret->config = make_image_spec_schema_content_descriptor (get_val (tree, "config", yajl_t_object), ctx, err); if (ret->config == NULL && *err != 0) return NULL; ret->subject = make_image_spec_schema_content_descriptor (get_val (tree, "subject", yajl_t_object), ctx, err); if (ret->subject == NULL && *err != 0) return NULL; do { yajl_val tmp = get_val (tree, "layers", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->layers_len = len; ret->layers = calloc (len + 1, sizeof (*ret->layers)); if (ret->layers == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->layers[i] = make_image_spec_schema_content_descriptor (val, ctx, err); if (ret->layers[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "annotations", yajl_t_object); if (tmp != NULL) { ret->annotations = make_json_map_string_string (tmp, ctx, err); if (ret->annotations == NULL) { char *new_error = NULL; if (asprintf (&new_error, "Value error for key 'annotations': %s", *err ? *err : "null") < 0) new_error = strdup ("error allocating memory"); free (*err); *err = new_error; return NULL; } } } while (0); if (ret->config == NULL) { if (asprintf (err, "Required field '%s' not present", "config") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->layers == NULL) { if (asprintf (err, "Required field '%s' not present", "layers") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "schemaVersion") && strcmp (tree->u.object.keys[i], "mediaType") && strcmp (tree->u.object.keys[i], "artifactType") && strcmp (tree->u.object.keys[i], "config") && strcmp (tree->u.object.keys[i], "subject") && strcmp (tree->u.object.keys[i], "layers") && strcmp (tree->u.object.keys[i], "annotations")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_image_spec_schema_image_manifest_schema (image_spec_schema_image_manifest_schema *ptr) { if (ptr == NULL) return; free (ptr->media_type); ptr->media_type = NULL; free (ptr->artifact_type); ptr->artifact_type = NULL; if (ptr->config != NULL) { free_image_spec_schema_content_descriptor (ptr->config); ptr->config = NULL; } if (ptr->subject != NULL) { free_image_spec_schema_content_descriptor (ptr->subject); ptr->subject = NULL; } if (ptr->layers != NULL) { size_t i; for (i = 0; i < ptr->layers_len; i++) { if (ptr->layers[i] != NULL) { free_image_spec_schema_content_descriptor (ptr->layers[i]); ptr->layers[i] = NULL; } } free (ptr->layers); ptr->layers = NULL; } free_json_map_string_string (ptr->annotations); ptr->annotations = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_image_spec_schema_image_manifest_schema (yajl_gen g, const image_spec_schema_image_manifest_schema *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->schema_version_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("schemaVersion"), 13 /* strlen ("schemaVersion") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->schema_version) num = (long long int)ptr->schema_version; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->media_type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("mediaType"), 9 /* strlen ("mediaType") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->media_type != NULL) str = ptr->media_type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->artifact_type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("artifactType"), 12 /* strlen ("artifactType") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->artifact_type != NULL) str = ptr->artifact_type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->config != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("config"), 6 /* strlen ("config") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_image_spec_schema_content_descriptor (g, ptr != NULL ? ptr->config : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->subject != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("subject"), 7 /* strlen ("subject") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_image_spec_schema_content_descriptor (g, ptr != NULL ? ptr->subject : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->layers != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("layers"), 6 /* strlen ("layers") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->layers != NULL) len = ptr->layers_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_image_spec_schema_content_descriptor (g, ptr->layers[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->annotations != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("annotations"), 11 /* strlen ("annotations") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_json_map_string_string (g, ptr ? ptr->annotations : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } image_spec_schema_image_manifest_schema * image_spec_schema_image_manifest_schema_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { image_spec_schema_image_manifest_schema *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = image_spec_schema_image_manifest_schema_parse_data (content, ctx, err);return ptr; } image_spec_schema_image_manifest_schema * image_spec_schema_image_manifest_schema_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {image_spec_schema_image_manifest_schema *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = image_spec_schema_image_manifest_schema_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) image_spec_schema_image_manifest_schema * image_spec_schema_image_manifest_schema_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { image_spec_schema_image_manifest_schema *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_image_spec_schema_image_manifest_schema (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * image_spec_schema_image_manifest_schema_generate_json (const image_spec_schema_image_manifest_schema *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_image_spec_schema_image_manifest_schema (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_linux.c0000644000000000000000000041716514656670200024236 0ustar0000000000000000/* Generated from config-linux.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_config_linux.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_config_linux_resources_pids *, free_runtime_spec_schema_config_linux_resources_pids) runtime_spec_schema_config_linux_resources_pids * make_runtime_spec_schema_config_linux_resources_pids (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux_resources_pids) runtime_spec_schema_config_linux_resources_pids *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "limit", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->limit); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'limit': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->limit_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "limit")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_linux_resources_pids (runtime_spec_schema_config_linux_resources_pids *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux_resources_pids (yajl_gen g, const runtime_spec_schema_config_linux_resources_pids *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->limit_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("limit"), 5 /* strlen ("limit") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->limit) num = (long long int)ptr->limit; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_linux_resources_block_io *, free_runtime_spec_schema_config_linux_resources_block_io) runtime_spec_schema_config_linux_resources_block_io * make_runtime_spec_schema_config_linux_resources_block_io (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux_resources_block_io) runtime_spec_schema_config_linux_resources_block_io *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "weight", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint16 (YAJL_GET_NUMBER (val), &ret->weight); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint16' for key 'weight': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->weight_present = 1; } } while (0); do { yajl_val val = get_val (tree, "leafWeight", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint16 (YAJL_GET_NUMBER (val), &ret->leaf_weight); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint16' for key 'leafWeight': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->leaf_weight_present = 1; } } while (0); do { yajl_val tmp = get_val (tree, "throttleReadBpsDevice", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->throttle_read_bps_device_len = len; ret->throttle_read_bps_device = calloc (len + 1, sizeof (*ret->throttle_read_bps_device)); if (ret->throttle_read_bps_device == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->throttle_read_bps_device[i] = make_runtime_spec_schema_defs_linux_block_io_device_throttle (val, ctx, err); if (ret->throttle_read_bps_device[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "throttleWriteBpsDevice", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->throttle_write_bps_device_len = len; ret->throttle_write_bps_device = calloc (len + 1, sizeof (*ret->throttle_write_bps_device)); if (ret->throttle_write_bps_device == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->throttle_write_bps_device[i] = make_runtime_spec_schema_defs_linux_block_io_device_throttle (val, ctx, err); if (ret->throttle_write_bps_device[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "throttleReadIOPSDevice", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->throttle_read_iops_device_len = len; ret->throttle_read_iops_device = calloc (len + 1, sizeof (*ret->throttle_read_iops_device)); if (ret->throttle_read_iops_device == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->throttle_read_iops_device[i] = make_runtime_spec_schema_defs_linux_block_io_device_throttle (val, ctx, err); if (ret->throttle_read_iops_device[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "throttleWriteIOPSDevice", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->throttle_write_iops_device_len = len; ret->throttle_write_iops_device = calloc (len + 1, sizeof (*ret->throttle_write_iops_device)); if (ret->throttle_write_iops_device == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->throttle_write_iops_device[i] = make_runtime_spec_schema_defs_linux_block_io_device_throttle (val, ctx, err); if (ret->throttle_write_iops_device[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "weightDevice", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->weight_device_len = len; ret->weight_device = calloc (len + 1, sizeof (*ret->weight_device)); if (ret->weight_device == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->weight_device[i] = make_runtime_spec_schema_defs_linux_block_io_device_weight (val, ctx, err); if (ret->weight_device[i] == NULL) return NULL; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "weight") && strcmp (tree->u.object.keys[i], "leafWeight") && strcmp (tree->u.object.keys[i], "throttleReadBpsDevice") && strcmp (tree->u.object.keys[i], "throttleWriteBpsDevice") && strcmp (tree->u.object.keys[i], "throttleReadIOPSDevice") && strcmp (tree->u.object.keys[i], "throttleWriteIOPSDevice") && strcmp (tree->u.object.keys[i], "weightDevice")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_linux_resources_block_io (runtime_spec_schema_config_linux_resources_block_io *ptr) { if (ptr == NULL) return; if (ptr->throttle_read_bps_device != NULL) { size_t i; for (i = 0; i < ptr->throttle_read_bps_device_len; i++) { if (ptr->throttle_read_bps_device[i] != NULL) { free_runtime_spec_schema_defs_linux_block_io_device_throttle (ptr->throttle_read_bps_device[i]); ptr->throttle_read_bps_device[i] = NULL; } } free (ptr->throttle_read_bps_device); ptr->throttle_read_bps_device = NULL; } if (ptr->throttle_write_bps_device != NULL) { size_t i; for (i = 0; i < ptr->throttle_write_bps_device_len; i++) { if (ptr->throttle_write_bps_device[i] != NULL) { free_runtime_spec_schema_defs_linux_block_io_device_throttle (ptr->throttle_write_bps_device[i]); ptr->throttle_write_bps_device[i] = NULL; } } free (ptr->throttle_write_bps_device); ptr->throttle_write_bps_device = NULL; } if (ptr->throttle_read_iops_device != NULL) { size_t i; for (i = 0; i < ptr->throttle_read_iops_device_len; i++) { if (ptr->throttle_read_iops_device[i] != NULL) { free_runtime_spec_schema_defs_linux_block_io_device_throttle (ptr->throttle_read_iops_device[i]); ptr->throttle_read_iops_device[i] = NULL; } } free (ptr->throttle_read_iops_device); ptr->throttle_read_iops_device = NULL; } if (ptr->throttle_write_iops_device != NULL) { size_t i; for (i = 0; i < ptr->throttle_write_iops_device_len; i++) { if (ptr->throttle_write_iops_device[i] != NULL) { free_runtime_spec_schema_defs_linux_block_io_device_throttle (ptr->throttle_write_iops_device[i]); ptr->throttle_write_iops_device[i] = NULL; } } free (ptr->throttle_write_iops_device); ptr->throttle_write_iops_device = NULL; } if (ptr->weight_device != NULL) { size_t i; for (i = 0; i < ptr->weight_device_len; i++) { if (ptr->weight_device[i] != NULL) { free_runtime_spec_schema_defs_linux_block_io_device_weight (ptr->weight_device[i]); ptr->weight_device[i] = NULL; } } free (ptr->weight_device); ptr->weight_device = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux_resources_block_io (yajl_gen g, const runtime_spec_schema_config_linux_resources_block_io *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->weight_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("weight"), 6 /* strlen ("weight") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->weight) num = (long long unsigned int)ptr->weight; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->leaf_weight_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("leafWeight"), 10 /* strlen ("leafWeight") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->leaf_weight) num = (long long unsigned int)ptr->leaf_weight; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->throttle_read_bps_device != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("throttleReadBpsDevice"), 21 /* strlen ("throttleReadBpsDevice") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->throttle_read_bps_device != NULL) len = ptr->throttle_read_bps_device_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_linux_block_io_device_throttle (g, ptr->throttle_read_bps_device[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->throttle_write_bps_device != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("throttleWriteBpsDevice"), 22 /* strlen ("throttleWriteBpsDevice") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->throttle_write_bps_device != NULL) len = ptr->throttle_write_bps_device_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_linux_block_io_device_throttle (g, ptr->throttle_write_bps_device[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->throttle_read_iops_device != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("throttleReadIOPSDevice"), 22 /* strlen ("throttleReadIOPSDevice") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->throttle_read_iops_device != NULL) len = ptr->throttle_read_iops_device_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_linux_block_io_device_throttle (g, ptr->throttle_read_iops_device[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->throttle_write_iops_device != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("throttleWriteIOPSDevice"), 23 /* strlen ("throttleWriteIOPSDevice") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->throttle_write_iops_device != NULL) len = ptr->throttle_write_iops_device_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_linux_block_io_device_throttle (g, ptr->throttle_write_iops_device[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->weight_device != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("weightDevice"), 12 /* strlen ("weightDevice") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->weight_device != NULL) len = ptr->weight_device_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_linux_block_io_device_weight (g, ptr->weight_device[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_linux_resources_cpu *, free_runtime_spec_schema_config_linux_resources_cpu) runtime_spec_schema_config_linux_resources_cpu * make_runtime_spec_schema_config_linux_resources_cpu (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux_resources_cpu) runtime_spec_schema_config_linux_resources_cpu *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "cpus", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->cpus = strdup (str ? str : ""); if (ret->cpus == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "mems", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->mems = strdup (str ? str : ""); if (ret->mems == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "period", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->period); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'period': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->period_present = 1; } } while (0); do { yajl_val val = get_val (tree, "quota", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->quota); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'quota': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->quota_present = 1; } } while (0); do { yajl_val val = get_val (tree, "burst", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->burst); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'burst': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->burst_present = 1; } } while (0); do { yajl_val val = get_val (tree, "realtimePeriod", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->realtime_period); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'realtimePeriod': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->realtime_period_present = 1; } } while (0); do { yajl_val val = get_val (tree, "realtimeRuntime", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->realtime_runtime); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'realtimeRuntime': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->realtime_runtime_present = 1; } } while (0); do { yajl_val val = get_val (tree, "shares", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->shares); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'shares': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->shares_present = 1; } } while (0); do { yajl_val val = get_val (tree, "idle", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->idle); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'idle': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->idle_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "cpus") && strcmp (tree->u.object.keys[i], "mems") && strcmp (tree->u.object.keys[i], "period") && strcmp (tree->u.object.keys[i], "quota") && strcmp (tree->u.object.keys[i], "burst") && strcmp (tree->u.object.keys[i], "realtimePeriod") && strcmp (tree->u.object.keys[i], "realtimeRuntime") && strcmp (tree->u.object.keys[i], "shares") && strcmp (tree->u.object.keys[i], "idle")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_linux_resources_cpu (runtime_spec_schema_config_linux_resources_cpu *ptr) { if (ptr == NULL) return; free (ptr->cpus); ptr->cpus = NULL; free (ptr->mems); ptr->mems = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux_resources_cpu (yajl_gen g, const runtime_spec_schema_config_linux_resources_cpu *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->cpus != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("cpus"), 4 /* strlen ("cpus") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->cpus != NULL) str = ptr->cpus; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->mems != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("mems"), 4 /* strlen ("mems") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->mems != NULL) str = ptr->mems; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->period_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("period"), 6 /* strlen ("period") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->period) num = (long long unsigned int)ptr->period; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->quota_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("quota"), 5 /* strlen ("quota") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->quota) num = (long long int)ptr->quota; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->burst_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("burst"), 5 /* strlen ("burst") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->burst) num = (long long unsigned int)ptr->burst; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->realtime_period_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("realtimePeriod"), 14 /* strlen ("realtimePeriod") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->realtime_period) num = (long long unsigned int)ptr->realtime_period; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->realtime_runtime_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("realtimeRuntime"), 15 /* strlen ("realtimeRuntime") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->realtime_runtime) num = (long long int)ptr->realtime_runtime; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->shares_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("shares"), 6 /* strlen ("shares") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->shares) num = (long long unsigned int)ptr->shares; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->idle_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("idle"), 4 /* strlen ("idle") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->idle) num = (long long int)ptr->idle; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_linux_resources_hugepage_limits_element *, free_runtime_spec_schema_config_linux_resources_hugepage_limits_element) runtime_spec_schema_config_linux_resources_hugepage_limits_element * make_runtime_spec_schema_config_linux_resources_hugepage_limits_element (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux_resources_hugepage_limits_element) runtime_spec_schema_config_linux_resources_hugepage_limits_element *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "pageSize", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->page_size = strdup (str ? str : ""); if (ret->page_size == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "limit", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->limit); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'limit': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->limit_present = 1; } } while (0); if (ret->page_size == NULL) { if (asprintf (err, "Required field '%s' not present", "pageSize") < 0) *err = strdup ("error allocating memory"); return NULL; } return move_ptr (ret); } void free_runtime_spec_schema_config_linux_resources_hugepage_limits_element (runtime_spec_schema_config_linux_resources_hugepage_limits_element *ptr) { if (ptr == NULL) return; free (ptr->page_size); ptr->page_size = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux_resources_hugepage_limits_element (yajl_gen g, const runtime_spec_schema_config_linux_resources_hugepage_limits_element *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->page_size != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("pageSize"), 8 /* strlen ("pageSize") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->page_size != NULL) str = ptr->page_size; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->limit_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("limit"), 5 /* strlen ("limit") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->limit) num = (long long unsigned int)ptr->limit; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_linux_resources_memory *, free_runtime_spec_schema_config_linux_resources_memory) runtime_spec_schema_config_linux_resources_memory * make_runtime_spec_schema_config_linux_resources_memory (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux_resources_memory) runtime_spec_schema_config_linux_resources_memory *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "kernel", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->kernel); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'kernel': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->kernel_present = 1; } } while (0); do { yajl_val val = get_val (tree, "kernelTCP", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->kernel_tcp); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'kernelTCP': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->kernel_tcp_present = 1; } } while (0); do { yajl_val val = get_val (tree, "limit", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->limit); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'limit': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->limit_present = 1; } } while (0); do { yajl_val val = get_val (tree, "reservation", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->reservation); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'reservation': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->reservation_present = 1; } } while (0); do { yajl_val val = get_val (tree, "swap", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->swap); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'swap': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->swap_present = 1; } } while (0); do { yajl_val val = get_val (tree, "swappiness", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->swappiness); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'swappiness': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->swappiness_present = 1; } } while (0); do { yajl_val val = get_val (tree, "disableOOMKiller", yajl_t_true); if (val != NULL) { ret->disable_oom_killer = YAJL_IS_TRUE(val); ret->disable_oom_killer_present = 1; } else { val = get_val (tree, "disableOOMKiller", yajl_t_false); if (val != NULL) { ret->disable_oom_killer = 0; ret->disable_oom_killer_present = 1; } } } while (0); do { yajl_val val = get_val (tree, "useHierarchy", yajl_t_true); if (val != NULL) { ret->use_hierarchy = YAJL_IS_TRUE(val); ret->use_hierarchy_present = 1; } else { val = get_val (tree, "useHierarchy", yajl_t_false); if (val != NULL) { ret->use_hierarchy = 0; ret->use_hierarchy_present = 1; } } } while (0); do { yajl_val val = get_val (tree, "checkBeforeUpdate", yajl_t_true); if (val != NULL) { ret->check_before_update = YAJL_IS_TRUE(val); ret->check_before_update_present = 1; } else { val = get_val (tree, "checkBeforeUpdate", yajl_t_false); if (val != NULL) { ret->check_before_update = 0; ret->check_before_update_present = 1; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "kernel") && strcmp (tree->u.object.keys[i], "kernelTCP") && strcmp (tree->u.object.keys[i], "limit") && strcmp (tree->u.object.keys[i], "reservation") && strcmp (tree->u.object.keys[i], "swap") && strcmp (tree->u.object.keys[i], "swappiness") && strcmp (tree->u.object.keys[i], "disableOOMKiller") && strcmp (tree->u.object.keys[i], "useHierarchy") && strcmp (tree->u.object.keys[i], "checkBeforeUpdate")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_linux_resources_memory (runtime_spec_schema_config_linux_resources_memory *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux_resources_memory (yajl_gen g, const runtime_spec_schema_config_linux_resources_memory *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->kernel_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("kernel"), 6 /* strlen ("kernel") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->kernel) num = (long long int)ptr->kernel; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->kernel_tcp_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("kernelTCP"), 9 /* strlen ("kernelTCP") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->kernel_tcp) num = (long long int)ptr->kernel_tcp; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->limit_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("limit"), 5 /* strlen ("limit") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->limit) num = (long long int)ptr->limit; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->reservation_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("reservation"), 11 /* strlen ("reservation") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->reservation) num = (long long int)ptr->reservation; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->swap_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("swap"), 4 /* strlen ("swap") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->swap) num = (long long int)ptr->swap; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->swappiness_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("swappiness"), 10 /* strlen ("swappiness") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->swappiness) num = (long long unsigned int)ptr->swappiness; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->disable_oom_killer_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("disableOOMKiller"), 16 /* strlen ("disableOOMKiller") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->disable_oom_killer) b = ptr->disable_oom_killer; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->use_hierarchy_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("useHierarchy"), 12 /* strlen ("useHierarchy") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->use_hierarchy) b = ptr->use_hierarchy; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->check_before_update_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("checkBeforeUpdate"), 17 /* strlen ("checkBeforeUpdate") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->check_before_update) b = ptr->check_before_update; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_linux_resources_network *, free_runtime_spec_schema_config_linux_resources_network) runtime_spec_schema_config_linux_resources_network * make_runtime_spec_schema_config_linux_resources_network (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux_resources_network) runtime_spec_schema_config_linux_resources_network *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "classID", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->class_id); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'classID': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->class_id_present = 1; } } while (0); do { yajl_val tmp = get_val (tree, "priorities", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->priorities_len = len; ret->priorities = calloc (len + 1, sizeof (*ret->priorities)); if (ret->priorities == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->priorities[i] = make_runtime_spec_schema_defs_linux_network_interface_priority (val, ctx, err); if (ret->priorities[i] == NULL) return NULL; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "classID") && strcmp (tree->u.object.keys[i], "priorities")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_linux_resources_network (runtime_spec_schema_config_linux_resources_network *ptr) { if (ptr == NULL) return; if (ptr->priorities != NULL) { size_t i; for (i = 0; i < ptr->priorities_len; i++) { if (ptr->priorities[i] != NULL) { free_runtime_spec_schema_defs_linux_network_interface_priority (ptr->priorities[i]); ptr->priorities[i] = NULL; } } free (ptr->priorities); ptr->priorities = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux_resources_network (yajl_gen g, const runtime_spec_schema_config_linux_resources_network *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->class_id_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("classID"), 7 /* strlen ("classID") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->class_id) num = (long long unsigned int)ptr->class_id; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->priorities != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("priorities"), 10 /* strlen ("priorities") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->priorities != NULL) len = ptr->priorities_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_linux_network_interface_priority (g, ptr->priorities[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_linux_resources_rdma *, free_runtime_spec_schema_config_linux_resources_rdma) runtime_spec_schema_config_linux_resources_rdma * make_runtime_spec_schema_config_linux_resources_rdma (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux_resources_rdma) runtime_spec_schema_config_linux_resources_rdma *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; return move_ptr (ret); } void free_runtime_spec_schema_config_linux_resources_rdma (runtime_spec_schema_config_linux_resources_rdma *ptr) { if (ptr == NULL) return; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux_resources_rdma (yajl_gen g, const runtime_spec_schema_config_linux_resources_rdma *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ if (!(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_linux_resources *, free_runtime_spec_schema_config_linux_resources) runtime_spec_schema_config_linux_resources * make_runtime_spec_schema_config_linux_resources (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux_resources) runtime_spec_schema_config_linux_resources *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "unified", yajl_t_object); if (tmp != NULL) { ret->unified = make_json_map_string_string (tmp, ctx, err); if (ret->unified == NULL) { char *new_error = NULL; if (asprintf (&new_error, "Value error for key 'unified': %s", *err ? *err : "null") < 0) new_error = strdup ("error allocating memory"); free (*err); *err = new_error; return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "devices", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->devices_len = len; ret->devices = calloc (len + 1, sizeof (*ret->devices)); if (ret->devices == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->devices[i] = make_runtime_spec_schema_defs_linux_device_cgroup (val, ctx, err); if (ret->devices[i] == NULL) return NULL; } } } while (0); ret->pids = make_runtime_spec_schema_config_linux_resources_pids (get_val (tree, "pids", yajl_t_object), ctx, err); if (ret->pids == NULL && *err != 0) return NULL; ret->block_io = make_runtime_spec_schema_config_linux_resources_block_io (get_val (tree, "blockIO", yajl_t_object), ctx, err); if (ret->block_io == NULL && *err != 0) return NULL; ret->cpu = make_runtime_spec_schema_config_linux_resources_cpu (get_val (tree, "cpu", yajl_t_object), ctx, err); if (ret->cpu == NULL && *err != 0) return NULL; do { yajl_val tmp = get_val (tree, "hugepageLimits", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->hugepage_limits_len = len; ret->hugepage_limits = calloc (len + 1, sizeof (*ret->hugepage_limits)); if (ret->hugepage_limits == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->hugepage_limits[i] = make_runtime_spec_schema_config_linux_resources_hugepage_limits_element (val, ctx, err); if (ret->hugepage_limits[i] == NULL) return NULL; } } } while (0); ret->memory = make_runtime_spec_schema_config_linux_resources_memory (get_val (tree, "memory", yajl_t_object), ctx, err); if (ret->memory == NULL && *err != 0) return NULL; ret->network = make_runtime_spec_schema_config_linux_resources_network (get_val (tree, "network", yajl_t_object), ctx, err); if (ret->network == NULL && *err != 0) return NULL; ret->rdma = make_runtime_spec_schema_config_linux_resources_rdma (get_val (tree, "rdma", yajl_t_object), ctx, err); if (ret->rdma == NULL && *err != 0) return NULL; if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "unified") && strcmp (tree->u.object.keys[i], "devices") && strcmp (tree->u.object.keys[i], "pids") && strcmp (tree->u.object.keys[i], "blockIO") && strcmp (tree->u.object.keys[i], "cpu") && strcmp (tree->u.object.keys[i], "hugepageLimits") && strcmp (tree->u.object.keys[i], "memory") && strcmp (tree->u.object.keys[i], "network") && strcmp (tree->u.object.keys[i], "rdma")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_linux_resources (runtime_spec_schema_config_linux_resources *ptr) { if (ptr == NULL) return; free_json_map_string_string (ptr->unified); ptr->unified = NULL; if (ptr->devices != NULL) { size_t i; for (i = 0; i < ptr->devices_len; i++) { if (ptr->devices[i] != NULL) { free_runtime_spec_schema_defs_linux_device_cgroup (ptr->devices[i]); ptr->devices[i] = NULL; } } free (ptr->devices); ptr->devices = NULL; } if (ptr->pids != NULL) { free_runtime_spec_schema_config_linux_resources_pids (ptr->pids); ptr->pids = NULL; } if (ptr->block_io != NULL) { free_runtime_spec_schema_config_linux_resources_block_io (ptr->block_io); ptr->block_io = NULL; } if (ptr->cpu != NULL) { free_runtime_spec_schema_config_linux_resources_cpu (ptr->cpu); ptr->cpu = NULL; } if (ptr->hugepage_limits != NULL) { size_t i; for (i = 0; i < ptr->hugepage_limits_len; i++) { if (ptr->hugepage_limits[i] != NULL) { free_runtime_spec_schema_config_linux_resources_hugepage_limits_element (ptr->hugepage_limits[i]); ptr->hugepage_limits[i] = NULL; } } free (ptr->hugepage_limits); ptr->hugepage_limits = NULL; } if (ptr->memory != NULL) { free_runtime_spec_schema_config_linux_resources_memory (ptr->memory); ptr->memory = NULL; } if (ptr->network != NULL) { free_runtime_spec_schema_config_linux_resources_network (ptr->network); ptr->network = NULL; } if (ptr->rdma != NULL) { free_runtime_spec_schema_config_linux_resources_rdma (ptr->rdma); ptr->rdma = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux_resources (yajl_gen g, const runtime_spec_schema_config_linux_resources *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->unified != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("unified"), 7 /* strlen ("unified") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_json_map_string_string (g, ptr ? ptr->unified : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->devices != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("devices"), 7 /* strlen ("devices") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->devices != NULL) len = ptr->devices_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_linux_device_cgroup (g, ptr->devices[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->pids != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("pids"), 4 /* strlen ("pids") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_linux_resources_pids (g, ptr != NULL ? ptr->pids : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->block_io != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("blockIO"), 7 /* strlen ("blockIO") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_linux_resources_block_io (g, ptr != NULL ? ptr->block_io : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->cpu != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("cpu"), 3 /* strlen ("cpu") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_linux_resources_cpu (g, ptr != NULL ? ptr->cpu : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->hugepage_limits != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("hugepageLimits"), 14 /* strlen ("hugepageLimits") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->hugepage_limits != NULL) len = ptr->hugepage_limits_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_config_linux_resources_hugepage_limits_element (g, ptr->hugepage_limits[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->memory != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("memory"), 6 /* strlen ("memory") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_linux_resources_memory (g, ptr != NULL ? ptr->memory : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->network != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("network"), 7 /* strlen ("network") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_linux_resources_network (g, ptr != NULL ? ptr->network : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->rdma != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("rdma"), 4 /* strlen ("rdma") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_linux_resources_rdma (g, ptr != NULL ? ptr->rdma : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_linux_seccomp *, free_runtime_spec_schema_config_linux_seccomp) runtime_spec_schema_config_linux_seccomp * make_runtime_spec_schema_config_linux_seccomp (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux_seccomp) runtime_spec_schema_config_linux_seccomp *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "defaultAction", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->default_action = strdup (str ? str : ""); if (ret->default_action == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "defaultErrnoRet", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->default_errno_ret); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'defaultErrnoRet': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->default_errno_ret_present = 1; } } while (0); do { yajl_val tmp = get_val (tree, "flags", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->flags_len = len; ret->flags = calloc (len + 1, sizeof (*ret->flags)); if (ret->flags == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->flags[i] = strdup (str ? str : ""); if (ret->flags[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "listenerPath", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->listener_path = strdup (str ? str : ""); if (ret->listener_path == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "listenerMetadata", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->listener_metadata = strdup (str ? str : ""); if (ret->listener_metadata == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "architectures", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->architectures_len = len; ret->architectures = calloc (len + 1, sizeof (*ret->architectures)); if (ret->architectures == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->architectures[i] = strdup (str ? str : ""); if (ret->architectures[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "syscalls", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->syscalls_len = len; ret->syscalls = calloc (len + 1, sizeof (*ret->syscalls)); if (ret->syscalls == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->syscalls[i] = make_runtime_spec_schema_defs_linux_syscall (val, ctx, err); if (ret->syscalls[i] == NULL) return NULL; } } } while (0); if (ret->default_action == NULL) { if (asprintf (err, "Required field '%s' not present", "defaultAction") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "defaultAction") && strcmp (tree->u.object.keys[i], "defaultErrnoRet") && strcmp (tree->u.object.keys[i], "flags") && strcmp (tree->u.object.keys[i], "listenerPath") && strcmp (tree->u.object.keys[i], "listenerMetadata") && strcmp (tree->u.object.keys[i], "architectures") && strcmp (tree->u.object.keys[i], "syscalls")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_linux_seccomp (runtime_spec_schema_config_linux_seccomp *ptr) { if (ptr == NULL) return; free (ptr->default_action); ptr->default_action = NULL; if (ptr->flags != NULL) { size_t i; for (i = 0; i < ptr->flags_len; i++) { if (ptr->flags[i] != NULL) { free (ptr->flags[i]); ptr->flags[i] = NULL; } } free (ptr->flags); ptr->flags = NULL; } free (ptr->listener_path); ptr->listener_path = NULL; free (ptr->listener_metadata); ptr->listener_metadata = NULL; if (ptr->architectures != NULL) { size_t i; for (i = 0; i < ptr->architectures_len; i++) { if (ptr->architectures[i] != NULL) { free (ptr->architectures[i]); ptr->architectures[i] = NULL; } } free (ptr->architectures); ptr->architectures = NULL; } if (ptr->syscalls != NULL) { size_t i; for (i = 0; i < ptr->syscalls_len; i++) { if (ptr->syscalls[i] != NULL) { free_runtime_spec_schema_defs_linux_syscall (ptr->syscalls[i]); ptr->syscalls[i] = NULL; } } free (ptr->syscalls); ptr->syscalls = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux_seccomp (yajl_gen g, const runtime_spec_schema_config_linux_seccomp *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->default_action != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("defaultAction"), 13 /* strlen ("defaultAction") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->default_action != NULL) str = ptr->default_action; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->default_errno_ret_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("defaultErrnoRet"), 15 /* strlen ("defaultErrnoRet") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->default_errno_ret) num = (long long unsigned int)ptr->default_errno_ret; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->flags != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("flags"), 5 /* strlen ("flags") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->flags != NULL) len = ptr->flags_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->flags[i]), strlen (ptr->flags[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->listener_path != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("listenerPath"), 12 /* strlen ("listenerPath") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->listener_path != NULL) str = ptr->listener_path; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->listener_metadata != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("listenerMetadata"), 16 /* strlen ("listenerMetadata") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->listener_metadata != NULL) str = ptr->listener_metadata; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->architectures != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("architectures"), 13 /* strlen ("architectures") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->architectures != NULL) len = ptr->architectures_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->architectures[i]), strlen (ptr->architectures[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->syscalls != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("syscalls"), 8 /* strlen ("syscalls") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->syscalls != NULL) len = ptr->syscalls_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_linux_syscall (g, ptr->syscalls[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_linux_intel_rdt *, free_runtime_spec_schema_config_linux_intel_rdt) runtime_spec_schema_config_linux_intel_rdt * make_runtime_spec_schema_config_linux_intel_rdt (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux_intel_rdt) runtime_spec_schema_config_linux_intel_rdt *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "closID", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->clos_id = strdup (str ? str : ""); if (ret->clos_id == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "l3CacheSchema", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->l3cache_schema = strdup (str ? str : ""); if (ret->l3cache_schema == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "memBwSchema", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->mem_bw_schema = strdup (str ? str : ""); if (ret->mem_bw_schema == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "enableCMT", yajl_t_true); if (val != NULL) { ret->enable_cmt = YAJL_IS_TRUE(val); ret->enable_cmt_present = 1; } else { val = get_val (tree, "enableCMT", yajl_t_false); if (val != NULL) { ret->enable_cmt = 0; ret->enable_cmt_present = 1; } } } while (0); do { yajl_val val = get_val (tree, "enableMBM", yajl_t_true); if (val != NULL) { ret->enable_mbm = YAJL_IS_TRUE(val); ret->enable_mbm_present = 1; } else { val = get_val (tree, "enableMBM", yajl_t_false); if (val != NULL) { ret->enable_mbm = 0; ret->enable_mbm_present = 1; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "closID") && strcmp (tree->u.object.keys[i], "l3CacheSchema") && strcmp (tree->u.object.keys[i], "memBwSchema") && strcmp (tree->u.object.keys[i], "enableCMT") && strcmp (tree->u.object.keys[i], "enableMBM")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_linux_intel_rdt (runtime_spec_schema_config_linux_intel_rdt *ptr) { if (ptr == NULL) return; free (ptr->clos_id); ptr->clos_id = NULL; free (ptr->l3cache_schema); ptr->l3cache_schema = NULL; free (ptr->mem_bw_schema); ptr->mem_bw_schema = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux_intel_rdt (yajl_gen g, const runtime_spec_schema_config_linux_intel_rdt *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->clos_id != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("closID"), 6 /* strlen ("closID") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->clos_id != NULL) str = ptr->clos_id; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->l3cache_schema != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("l3CacheSchema"), 13 /* strlen ("l3CacheSchema") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->l3cache_schema != NULL) str = ptr->l3cache_schema; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->mem_bw_schema != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("memBwSchema"), 11 /* strlen ("memBwSchema") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->mem_bw_schema != NULL) str = ptr->mem_bw_schema; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->enable_cmt_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("enableCMT"), 9 /* strlen ("enableCMT") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->enable_cmt) b = ptr->enable_cmt; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->enable_mbm_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("enableMBM"), 9 /* strlen ("enableMBM") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->enable_mbm) b = ptr->enable_mbm; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_linux_time_offsets *, free_runtime_spec_schema_config_linux_time_offsets) runtime_spec_schema_config_linux_time_offsets * make_runtime_spec_schema_config_linux_time_offsets (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux_time_offsets) runtime_spec_schema_config_linux_time_offsets *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; ret->boottime = make_runtime_spec_schema_defs_linux_time_offsets (get_val (tree, "boottime", yajl_t_object), ctx, err); if (ret->boottime == NULL && *err != 0) return NULL; ret->monotonic = make_runtime_spec_schema_defs_linux_time_offsets (get_val (tree, "monotonic", yajl_t_object), ctx, err); if (ret->monotonic == NULL && *err != 0) return NULL; if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "boottime") && strcmp (tree->u.object.keys[i], "monotonic")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_linux_time_offsets (runtime_spec_schema_config_linux_time_offsets *ptr) { if (ptr == NULL) return; if (ptr->boottime != NULL) { free_runtime_spec_schema_defs_linux_time_offsets (ptr->boottime); ptr->boottime = NULL; } if (ptr->monotonic != NULL) { free_runtime_spec_schema_defs_linux_time_offsets (ptr->monotonic); ptr->monotonic = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux_time_offsets (yajl_gen g, const runtime_spec_schema_config_linux_time_offsets *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->boottime != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("boottime"), 8 /* strlen ("boottime") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_defs_linux_time_offsets (g, ptr != NULL ? ptr->boottime : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->monotonic != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("monotonic"), 9 /* strlen ("monotonic") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_defs_linux_time_offsets (g, ptr != NULL ? ptr->monotonic : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_linux *, free_runtime_spec_schema_config_linux) runtime_spec_schema_config_linux * make_runtime_spec_schema_config_linux (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_linux) runtime_spec_schema_config_linux *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "devices", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->devices_len = len; ret->devices = calloc (len + 1, sizeof (*ret->devices)); if (ret->devices == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->devices[i] = make_runtime_spec_schema_defs_linux_device (val, ctx, err); if (ret->devices[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "uidMappings", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->uid_mappings_len = len; ret->uid_mappings = calloc (len + 1, sizeof (*ret->uid_mappings)); if (ret->uid_mappings == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->uid_mappings[i] = make_runtime_spec_schema_defs_id_mapping (val, ctx, err); if (ret->uid_mappings[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "gidMappings", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->gid_mappings_len = len; ret->gid_mappings = calloc (len + 1, sizeof (*ret->gid_mappings)); if (ret->gid_mappings == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->gid_mappings[i] = make_runtime_spec_schema_defs_id_mapping (val, ctx, err); if (ret->gid_mappings[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "namespaces", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->namespaces_len = len; ret->namespaces = calloc (len + 1, sizeof (*ret->namespaces)); if (ret->namespaces == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->namespaces[i] = make_runtime_spec_schema_defs_linux_namespace_reference (val, ctx, err); if (ret->namespaces[i] == NULL) return NULL; } } } while (0); ret->resources = make_runtime_spec_schema_config_linux_resources (get_val (tree, "resources", yajl_t_object), ctx, err); if (ret->resources == NULL && *err != 0) return NULL; do { yajl_val val = get_val (tree, "cgroupsPath", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->cgroups_path = strdup (str ? str : ""); if (ret->cgroups_path == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "rootfsPropagation", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->rootfs_propagation = strdup (str ? str : ""); if (ret->rootfs_propagation == NULL) return NULL; } } while (0); ret->seccomp = make_runtime_spec_schema_config_linux_seccomp (get_val (tree, "seccomp", yajl_t_object), ctx, err); if (ret->seccomp == NULL && *err != 0) return NULL; do { yajl_val tmp = get_val (tree, "sysctl", yajl_t_object); if (tmp != NULL) { ret->sysctl = make_json_map_string_string (tmp, ctx, err); if (ret->sysctl == NULL) { char *new_error = NULL; if (asprintf (&new_error, "Value error for key 'sysctl': %s", *err ? *err : "null") < 0) new_error = strdup ("error allocating memory"); free (*err); *err = new_error; return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "maskedPaths", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->masked_paths_len = len; ret->masked_paths = calloc (len + 1, sizeof (*ret->masked_paths)); if (ret->masked_paths == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->masked_paths[i] = strdup (str ? str : ""); if (ret->masked_paths[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "readonlyPaths", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->readonly_paths_len = len; ret->readonly_paths = calloc (len + 1, sizeof (*ret->readonly_paths)); if (ret->readonly_paths == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->readonly_paths[i] = strdup (str ? str : ""); if (ret->readonly_paths[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "mountLabel", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->mount_label = strdup (str ? str : ""); if (ret->mount_label == NULL) return NULL; } } while (0); ret->intel_rdt = make_runtime_spec_schema_config_linux_intel_rdt (get_val (tree, "intelRdt", yajl_t_object), ctx, err); if (ret->intel_rdt == NULL && *err != 0) return NULL; ret->personality = make_runtime_spec_schema_defs_linux_personality (get_val (tree, "personality", yajl_t_object), ctx, err); if (ret->personality == NULL && *err != 0) return NULL; ret->time_offsets = make_runtime_spec_schema_config_linux_time_offsets (get_val (tree, "timeOffsets", yajl_t_object), ctx, err); if (ret->time_offsets == NULL && *err != 0) return NULL; if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "devices") && strcmp (tree->u.object.keys[i], "uidMappings") && strcmp (tree->u.object.keys[i], "gidMappings") && strcmp (tree->u.object.keys[i], "namespaces") && strcmp (tree->u.object.keys[i], "resources") && strcmp (tree->u.object.keys[i], "cgroupsPath") && strcmp (tree->u.object.keys[i], "rootfsPropagation") && strcmp (tree->u.object.keys[i], "seccomp") && strcmp (tree->u.object.keys[i], "sysctl") && strcmp (tree->u.object.keys[i], "maskedPaths") && strcmp (tree->u.object.keys[i], "readonlyPaths") && strcmp (tree->u.object.keys[i], "mountLabel") && strcmp (tree->u.object.keys[i], "intelRdt") && strcmp (tree->u.object.keys[i], "personality") && strcmp (tree->u.object.keys[i], "timeOffsets")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_linux (runtime_spec_schema_config_linux *ptr) { if (ptr == NULL) return; if (ptr->devices != NULL) { size_t i; for (i = 0; i < ptr->devices_len; i++) { if (ptr->devices[i] != NULL) { free_runtime_spec_schema_defs_linux_device (ptr->devices[i]); ptr->devices[i] = NULL; } } free (ptr->devices); ptr->devices = NULL; } if (ptr->uid_mappings != NULL) { size_t i; for (i = 0; i < ptr->uid_mappings_len; i++) { if (ptr->uid_mappings[i] != NULL) { free_runtime_spec_schema_defs_id_mapping (ptr->uid_mappings[i]); ptr->uid_mappings[i] = NULL; } } free (ptr->uid_mappings); ptr->uid_mappings = NULL; } if (ptr->gid_mappings != NULL) { size_t i; for (i = 0; i < ptr->gid_mappings_len; i++) { if (ptr->gid_mappings[i] != NULL) { free_runtime_spec_schema_defs_id_mapping (ptr->gid_mappings[i]); ptr->gid_mappings[i] = NULL; } } free (ptr->gid_mappings); ptr->gid_mappings = NULL; } if (ptr->namespaces != NULL) { size_t i; for (i = 0; i < ptr->namespaces_len; i++) { if (ptr->namespaces[i] != NULL) { free_runtime_spec_schema_defs_linux_namespace_reference (ptr->namespaces[i]); ptr->namespaces[i] = NULL; } } free (ptr->namespaces); ptr->namespaces = NULL; } if (ptr->resources != NULL) { free_runtime_spec_schema_config_linux_resources (ptr->resources); ptr->resources = NULL; } free (ptr->cgroups_path); ptr->cgroups_path = NULL; free (ptr->rootfs_propagation); ptr->rootfs_propagation = NULL; if (ptr->seccomp != NULL) { free_runtime_spec_schema_config_linux_seccomp (ptr->seccomp); ptr->seccomp = NULL; } free_json_map_string_string (ptr->sysctl); ptr->sysctl = NULL; if (ptr->masked_paths != NULL) { size_t i; for (i = 0; i < ptr->masked_paths_len; i++) { if (ptr->masked_paths[i] != NULL) { free (ptr->masked_paths[i]); ptr->masked_paths[i] = NULL; } } free (ptr->masked_paths); ptr->masked_paths = NULL; } if (ptr->readonly_paths != NULL) { size_t i; for (i = 0; i < ptr->readonly_paths_len; i++) { if (ptr->readonly_paths[i] != NULL) { free (ptr->readonly_paths[i]); ptr->readonly_paths[i] = NULL; } } free (ptr->readonly_paths); ptr->readonly_paths = NULL; } free (ptr->mount_label); ptr->mount_label = NULL; if (ptr->intel_rdt != NULL) { free_runtime_spec_schema_config_linux_intel_rdt (ptr->intel_rdt); ptr->intel_rdt = NULL; } if (ptr->personality != NULL) { free_runtime_spec_schema_defs_linux_personality (ptr->personality); ptr->personality = NULL; } if (ptr->time_offsets != NULL) { free_runtime_spec_schema_config_linux_time_offsets (ptr->time_offsets); ptr->time_offsets = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_linux (yajl_gen g, const runtime_spec_schema_config_linux *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->devices != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("devices"), 7 /* strlen ("devices") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->devices != NULL) len = ptr->devices_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_linux_device (g, ptr->devices[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->uid_mappings != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("uidMappings"), 11 /* strlen ("uidMappings") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->uid_mappings != NULL) len = ptr->uid_mappings_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_id_mapping (g, ptr->uid_mappings[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->gid_mappings != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("gidMappings"), 11 /* strlen ("gidMappings") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->gid_mappings != NULL) len = ptr->gid_mappings_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_id_mapping (g, ptr->gid_mappings[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->namespaces != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("namespaces"), 10 /* strlen ("namespaces") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->namespaces != NULL) len = ptr->namespaces_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_linux_namespace_reference (g, ptr->namespaces[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->resources != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("resources"), 9 /* strlen ("resources") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_linux_resources (g, ptr != NULL ? ptr->resources : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->cgroups_path != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("cgroupsPath"), 11 /* strlen ("cgroupsPath") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->cgroups_path != NULL) str = ptr->cgroups_path; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->rootfs_propagation != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("rootfsPropagation"), 17 /* strlen ("rootfsPropagation") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->rootfs_propagation != NULL) str = ptr->rootfs_propagation; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->seccomp != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("seccomp"), 7 /* strlen ("seccomp") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_linux_seccomp (g, ptr != NULL ? ptr->seccomp : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->sysctl != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("sysctl"), 6 /* strlen ("sysctl") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_json_map_string_string (g, ptr ? ptr->sysctl : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->masked_paths != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("maskedPaths"), 11 /* strlen ("maskedPaths") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->masked_paths != NULL) len = ptr->masked_paths_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->masked_paths[i]), strlen (ptr->masked_paths[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->readonly_paths != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("readonlyPaths"), 13 /* strlen ("readonlyPaths") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->readonly_paths != NULL) len = ptr->readonly_paths_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->readonly_paths[i]), strlen (ptr->readonly_paths[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->mount_label != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("mountLabel"), 10 /* strlen ("mountLabel") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->mount_label != NULL) str = ptr->mount_label; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->intel_rdt != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("intelRdt"), 8 /* strlen ("intelRdt") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_linux_intel_rdt (g, ptr != NULL ? ptr->intel_rdt : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->personality != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("personality"), 11 /* strlen ("personality") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_defs_linux_personality (g, ptr != NULL ? ptr->personality : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->time_offsets != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("timeOffsets"), 11 /* strlen ("timeOffsets") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_linux_time_offsets (g, ptr != NULL ? ptr->time_offsets : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_zos.c0000644000000000000000000001324414656670200023700 0ustar0000000000000000/* Generated from config-zos.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_config_zos.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_config_zos *, free_runtime_spec_schema_config_zos) runtime_spec_schema_config_zos * make_runtime_spec_schema_config_zos (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_zos) runtime_spec_schema_config_zos *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "devices", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->devices_len = len; ret->devices = calloc (len + 1, sizeof (*ret->devices)); if (ret->devices == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->devices[i] = make_runtime_spec_schema_defs_zos_device (val, ctx, err); if (ret->devices[i] == NULL) return NULL; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "devices")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_zos (runtime_spec_schema_config_zos *ptr) { if (ptr == NULL) return; if (ptr->devices != NULL) { size_t i; for (i = 0; i < ptr->devices_len; i++) { if (ptr->devices[i] != NULL) { free_runtime_spec_schema_defs_zos_device (ptr->devices[i]); ptr->devices[i] = NULL; } } free (ptr->devices); ptr->devices = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_zos (yajl_gen g, const runtime_spec_schema_config_zos *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->devices != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("devices"), 7 /* strlen ("devices") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->devices != NULL) len = ptr->devices_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_zos_device (g, ptr->devices[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_schema.c0000644000000000000000000036462214656670200024336 0ustar0000000000000000/* Generated from config-schema.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_config_schema.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_config_schema_hooks *, free_runtime_spec_schema_config_schema_hooks) runtime_spec_schema_config_schema_hooks * make_runtime_spec_schema_config_schema_hooks (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_schema_hooks) runtime_spec_schema_config_schema_hooks *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "prestart", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->prestart_len = len; ret->prestart = calloc (len + 1, sizeof (*ret->prestart)); if (ret->prestart == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->prestart[i] = make_runtime_spec_schema_defs_hook (val, ctx, err); if (ret->prestart[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "createRuntime", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->create_runtime_len = len; ret->create_runtime = calloc (len + 1, sizeof (*ret->create_runtime)); if (ret->create_runtime == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->create_runtime[i] = make_runtime_spec_schema_defs_hook (val, ctx, err); if (ret->create_runtime[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "createContainer", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->create_container_len = len; ret->create_container = calloc (len + 1, sizeof (*ret->create_container)); if (ret->create_container == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->create_container[i] = make_runtime_spec_schema_defs_hook (val, ctx, err); if (ret->create_container[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "startContainer", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->start_container_len = len; ret->start_container = calloc (len + 1, sizeof (*ret->start_container)); if (ret->start_container == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->start_container[i] = make_runtime_spec_schema_defs_hook (val, ctx, err); if (ret->start_container[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "poststart", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->poststart_len = len; ret->poststart = calloc (len + 1, sizeof (*ret->poststart)); if (ret->poststart == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->poststart[i] = make_runtime_spec_schema_defs_hook (val, ctx, err); if (ret->poststart[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "poststop", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->poststop_len = len; ret->poststop = calloc (len + 1, sizeof (*ret->poststop)); if (ret->poststop == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->poststop[i] = make_runtime_spec_schema_defs_hook (val, ctx, err); if (ret->poststop[i] == NULL) return NULL; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "prestart") && strcmp (tree->u.object.keys[i], "createRuntime") && strcmp (tree->u.object.keys[i], "createContainer") && strcmp (tree->u.object.keys[i], "startContainer") && strcmp (tree->u.object.keys[i], "poststart") && strcmp (tree->u.object.keys[i], "poststop")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_schema_hooks (runtime_spec_schema_config_schema_hooks *ptr) { if (ptr == NULL) return; if (ptr->prestart != NULL) { size_t i; for (i = 0; i < ptr->prestart_len; i++) { if (ptr->prestart[i] != NULL) { free_runtime_spec_schema_defs_hook (ptr->prestart[i]); ptr->prestart[i] = NULL; } } free (ptr->prestart); ptr->prestart = NULL; } if (ptr->create_runtime != NULL) { size_t i; for (i = 0; i < ptr->create_runtime_len; i++) { if (ptr->create_runtime[i] != NULL) { free_runtime_spec_schema_defs_hook (ptr->create_runtime[i]); ptr->create_runtime[i] = NULL; } } free (ptr->create_runtime); ptr->create_runtime = NULL; } if (ptr->create_container != NULL) { size_t i; for (i = 0; i < ptr->create_container_len; i++) { if (ptr->create_container[i] != NULL) { free_runtime_spec_schema_defs_hook (ptr->create_container[i]); ptr->create_container[i] = NULL; } } free (ptr->create_container); ptr->create_container = NULL; } if (ptr->start_container != NULL) { size_t i; for (i = 0; i < ptr->start_container_len; i++) { if (ptr->start_container[i] != NULL) { free_runtime_spec_schema_defs_hook (ptr->start_container[i]); ptr->start_container[i] = NULL; } } free (ptr->start_container); ptr->start_container = NULL; } if (ptr->poststart != NULL) { size_t i; for (i = 0; i < ptr->poststart_len; i++) { if (ptr->poststart[i] != NULL) { free_runtime_spec_schema_defs_hook (ptr->poststart[i]); ptr->poststart[i] = NULL; } } free (ptr->poststart); ptr->poststart = NULL; } if (ptr->poststop != NULL) { size_t i; for (i = 0; i < ptr->poststop_len; i++) { if (ptr->poststop[i] != NULL) { free_runtime_spec_schema_defs_hook (ptr->poststop[i]); ptr->poststop[i] = NULL; } } free (ptr->poststop); ptr->poststop = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_schema_hooks (yajl_gen g, const runtime_spec_schema_config_schema_hooks *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->prestart != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("prestart"), 8 /* strlen ("prestart") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->prestart != NULL) len = ptr->prestart_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_hook (g, ptr->prestart[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->create_runtime != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("createRuntime"), 13 /* strlen ("createRuntime") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->create_runtime != NULL) len = ptr->create_runtime_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_hook (g, ptr->create_runtime[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->create_container != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("createContainer"), 15 /* strlen ("createContainer") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->create_container != NULL) len = ptr->create_container_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_hook (g, ptr->create_container[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->start_container != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("startContainer"), 14 /* strlen ("startContainer") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->start_container != NULL) len = ptr->start_container_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_hook (g, ptr->start_container[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->poststart != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("poststart"), 9 /* strlen ("poststart") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->poststart != NULL) len = ptr->poststart_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_hook (g, ptr->poststart[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->poststop != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("poststop"), 8 /* strlen ("poststop") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->poststop != NULL) len = ptr->poststop_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_hook (g, ptr->poststop[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_schema_root *, free_runtime_spec_schema_config_schema_root) runtime_spec_schema_config_schema_root * make_runtime_spec_schema_config_schema_root (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_schema_root) runtime_spec_schema_config_schema_root *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "path", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->path = strdup (str ? str : ""); if (ret->path == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "readonly", yajl_t_true); if (val != NULL) { ret->readonly = YAJL_IS_TRUE(val); ret->readonly_present = 1; } else { val = get_val (tree, "readonly", yajl_t_false); if (val != NULL) { ret->readonly = 0; ret->readonly_present = 1; } } } while (0); if (ret->path == NULL) { if (asprintf (err, "Required field '%s' not present", "path") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "path") && strcmp (tree->u.object.keys[i], "readonly")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_schema_root (runtime_spec_schema_config_schema_root *ptr) { if (ptr == NULL) return; free (ptr->path); ptr->path = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_schema_root (yajl_gen g, const runtime_spec_schema_config_schema_root *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->path != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("path"), 4 /* strlen ("path") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->path != NULL) str = ptr->path; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->readonly_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("readonly"), 8 /* strlen ("readonly") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->readonly) b = ptr->readonly; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_schema_process_console_size *, free_runtime_spec_schema_config_schema_process_console_size) runtime_spec_schema_config_schema_process_console_size * make_runtime_spec_schema_config_schema_process_console_size (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_schema_process_console_size) runtime_spec_schema_config_schema_process_console_size *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "height", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->height); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'height': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->height_present = 1; } } while (0); do { yajl_val val = get_val (tree, "width", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->width); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'width': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->width_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "height") && strcmp (tree->u.object.keys[i], "width")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_schema_process_console_size (runtime_spec_schema_config_schema_process_console_size *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_schema_process_console_size (yajl_gen g, const runtime_spec_schema_config_schema_process_console_size *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->height_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("height"), 6 /* strlen ("height") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->height) num = (long long unsigned int)ptr->height; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->width_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("width"), 5 /* strlen ("width") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->width) num = (long long unsigned int)ptr->width; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_schema_process_user *, free_runtime_spec_schema_config_schema_process_user) runtime_spec_schema_config_schema_process_user * make_runtime_spec_schema_config_schema_process_user (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_schema_process_user) runtime_spec_schema_config_schema_process_user *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "uid", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint (YAJL_GET_NUMBER (val), (unsigned int *)&ret->uid); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'UID' for key 'uid': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->uid_present = 1; } } while (0); do { yajl_val val = get_val (tree, "gid", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint (YAJL_GET_NUMBER (val), (unsigned int *)&ret->gid); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'GID' for key 'gid': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->gid_present = 1; } } while (0); do { yajl_val val = get_val (tree, "umask", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->umask); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'umask': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->umask_present = 1; } } while (0); do { yajl_val tmp = get_val (tree, "additionalGids", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->additional_gids_len = len; ret->additional_gids = calloc (len + 1, sizeof (*ret->additional_gids)); if (ret->additional_gids == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint (YAJL_GET_NUMBER (val), (unsigned int *)&ret->additional_gids[i]); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'GID' for key 'additionalGids': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } } } } } while (0); do { yajl_val val = get_val (tree, "username", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->username = strdup (str ? str : ""); if (ret->username == NULL) return NULL; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "uid") && strcmp (tree->u.object.keys[i], "gid") && strcmp (tree->u.object.keys[i], "umask") && strcmp (tree->u.object.keys[i], "additionalGids") && strcmp (tree->u.object.keys[i], "username")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_schema_process_user (runtime_spec_schema_config_schema_process_user *ptr) { if (ptr == NULL) return; { free (ptr->additional_gids); ptr->additional_gids = NULL; } free (ptr->username); ptr->username = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_schema_process_user (yajl_gen g, const runtime_spec_schema_config_schema_process_user *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->uid_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("uid"), 3 /* strlen ("uid") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->uid) num = (long long unsigned int)ptr->uid; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->gid_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("gid"), 3 /* strlen ("gid") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->gid) num = (long long unsigned int)ptr->gid; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->umask_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("umask"), 5 /* strlen ("umask") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->umask) num = (long long unsigned int)ptr->umask; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->additional_gids != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("additionalGids"), 14 /* strlen ("additionalGids") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->additional_gids != NULL) len = ptr->additional_gids_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = map_uint (g, ptr->additional_gids[i]); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->username != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("username"), 8 /* strlen ("username") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->username != NULL) str = ptr->username; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_schema_process_capabilities *, free_runtime_spec_schema_config_schema_process_capabilities) runtime_spec_schema_config_schema_process_capabilities * make_runtime_spec_schema_config_schema_process_capabilities (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_schema_process_capabilities) runtime_spec_schema_config_schema_process_capabilities *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "bounding", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->bounding_len = len; ret->bounding = calloc (len + 1, sizeof (*ret->bounding)); if (ret->bounding == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->bounding[i] = strdup (str ? str : ""); if (ret->bounding[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "permitted", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->permitted_len = len; ret->permitted = calloc (len + 1, sizeof (*ret->permitted)); if (ret->permitted == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->permitted[i] = strdup (str ? str : ""); if (ret->permitted[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "effective", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->effective_len = len; ret->effective = calloc (len + 1, sizeof (*ret->effective)); if (ret->effective == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->effective[i] = strdup (str ? str : ""); if (ret->effective[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "inheritable", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->inheritable_len = len; ret->inheritable = calloc (len + 1, sizeof (*ret->inheritable)); if (ret->inheritable == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->inheritable[i] = strdup (str ? str : ""); if (ret->inheritable[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "ambient", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->ambient_len = len; ret->ambient = calloc (len + 1, sizeof (*ret->ambient)); if (ret->ambient == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->ambient[i] = strdup (str ? str : ""); if (ret->ambient[i] == NULL) return NULL; } } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "bounding") && strcmp (tree->u.object.keys[i], "permitted") && strcmp (tree->u.object.keys[i], "effective") && strcmp (tree->u.object.keys[i], "inheritable") && strcmp (tree->u.object.keys[i], "ambient")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_schema_process_capabilities (runtime_spec_schema_config_schema_process_capabilities *ptr) { if (ptr == NULL) return; if (ptr->bounding != NULL) { size_t i; for (i = 0; i < ptr->bounding_len; i++) { if (ptr->bounding[i] != NULL) { free (ptr->bounding[i]); ptr->bounding[i] = NULL; } } free (ptr->bounding); ptr->bounding = NULL; } if (ptr->permitted != NULL) { size_t i; for (i = 0; i < ptr->permitted_len; i++) { if (ptr->permitted[i] != NULL) { free (ptr->permitted[i]); ptr->permitted[i] = NULL; } } free (ptr->permitted); ptr->permitted = NULL; } if (ptr->effective != NULL) { size_t i; for (i = 0; i < ptr->effective_len; i++) { if (ptr->effective[i] != NULL) { free (ptr->effective[i]); ptr->effective[i] = NULL; } } free (ptr->effective); ptr->effective = NULL; } if (ptr->inheritable != NULL) { size_t i; for (i = 0; i < ptr->inheritable_len; i++) { if (ptr->inheritable[i] != NULL) { free (ptr->inheritable[i]); ptr->inheritable[i] = NULL; } } free (ptr->inheritable); ptr->inheritable = NULL; } if (ptr->ambient != NULL) { size_t i; for (i = 0; i < ptr->ambient_len; i++) { if (ptr->ambient[i] != NULL) { free (ptr->ambient[i]); ptr->ambient[i] = NULL; } } free (ptr->ambient); ptr->ambient = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_schema_process_capabilities (yajl_gen g, const runtime_spec_schema_config_schema_process_capabilities *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->bounding != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("bounding"), 8 /* strlen ("bounding") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->bounding != NULL) len = ptr->bounding_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->bounding[i]), strlen (ptr->bounding[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->permitted != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("permitted"), 9 /* strlen ("permitted") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->permitted != NULL) len = ptr->permitted_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->permitted[i]), strlen (ptr->permitted[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->effective != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("effective"), 9 /* strlen ("effective") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->effective != NULL) len = ptr->effective_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->effective[i]), strlen (ptr->effective[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->inheritable != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("inheritable"), 11 /* strlen ("inheritable") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->inheritable != NULL) len = ptr->inheritable_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->inheritable[i]), strlen (ptr->inheritable[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->ambient != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("ambient"), 7 /* strlen ("ambient") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->ambient != NULL) len = ptr->ambient_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->ambient[i]), strlen (ptr->ambient[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_schema_process_io_priority *, free_runtime_spec_schema_config_schema_process_io_priority) runtime_spec_schema_config_schema_process_io_priority * make_runtime_spec_schema_config_schema_process_io_priority (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_schema_process_io_priority) runtime_spec_schema_config_schema_process_io_priority *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "class", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->_class = strdup (str ? str : ""); if (ret->_class == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "priority", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int32 (YAJL_GET_NUMBER (val), &ret->priority); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int32' for key 'priority': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->priority_present = 1; } } while (0); if (ret->_class == NULL) { if (asprintf (err, "Required field '%s' not present", "class") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "class") && strcmp (tree->u.object.keys[i], "priority")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_schema_process_io_priority (runtime_spec_schema_config_schema_process_io_priority *ptr) { if (ptr == NULL) return; free (ptr->_class); ptr->_class = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_schema_process_io_priority (yajl_gen g, const runtime_spec_schema_config_schema_process_io_priority *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->_class != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("class"), 5 /* strlen ("class") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->_class != NULL) str = ptr->_class; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->priority_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("priority"), 8 /* strlen ("priority") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->priority) num = (long long int)ptr->priority; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_schema_process_scheduler *, free_runtime_spec_schema_config_schema_process_scheduler) runtime_spec_schema_config_schema_process_scheduler * make_runtime_spec_schema_config_schema_process_scheduler (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_schema_process_scheduler) runtime_spec_schema_config_schema_process_scheduler *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "policy", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->policy = strdup (str ? str : ""); if (ret->policy == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "nice", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int32 (YAJL_GET_NUMBER (val), &ret->nice); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int32' for key 'nice': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->nice_present = 1; } } while (0); do { yajl_val val = get_val (tree, "priority", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int32 (YAJL_GET_NUMBER (val), &ret->priority); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int32' for key 'priority': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->priority_present = 1; } } while (0); do { yajl_val tmp = get_val (tree, "flags", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->flags_len = len; ret->flags = calloc (len + 1, sizeof (*ret->flags)); if (ret->flags == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->flags[i] = strdup (str ? str : ""); if (ret->flags[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "runtime", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->runtime); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'runtime': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->runtime_present = 1; } } while (0); do { yajl_val val = get_val (tree, "deadline", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->deadline); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'deadline': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->deadline_present = 1; } } while (0); do { yajl_val val = get_val (tree, "period", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->period); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'period': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->period_present = 1; } } while (0); if (ret->policy == NULL) { if (asprintf (err, "Required field '%s' not present", "policy") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "policy") && strcmp (tree->u.object.keys[i], "nice") && strcmp (tree->u.object.keys[i], "priority") && strcmp (tree->u.object.keys[i], "flags") && strcmp (tree->u.object.keys[i], "runtime") && strcmp (tree->u.object.keys[i], "deadline") && strcmp (tree->u.object.keys[i], "period")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_schema_process_scheduler (runtime_spec_schema_config_schema_process_scheduler *ptr) { if (ptr == NULL) return; free (ptr->policy); ptr->policy = NULL; if (ptr->flags != NULL) { size_t i; for (i = 0; i < ptr->flags_len; i++) { if (ptr->flags[i] != NULL) { free (ptr->flags[i]); ptr->flags[i] = NULL; } } free (ptr->flags); ptr->flags = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_schema_process_scheduler (yajl_gen g, const runtime_spec_schema_config_schema_process_scheduler *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->policy != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("policy"), 6 /* strlen ("policy") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->policy != NULL) str = ptr->policy; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->nice_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("nice"), 4 /* strlen ("nice") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->nice) num = (long long int)ptr->nice; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->priority_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("priority"), 8 /* strlen ("priority") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->priority) num = (long long int)ptr->priority; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->flags != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("flags"), 5 /* strlen ("flags") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->flags != NULL) len = ptr->flags_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->flags[i]), strlen (ptr->flags[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->runtime_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("runtime"), 7 /* strlen ("runtime") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->runtime) num = (long long unsigned int)ptr->runtime; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->deadline_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("deadline"), 8 /* strlen ("deadline") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->deadline) num = (long long unsigned int)ptr->deadline; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->period_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("period"), 6 /* strlen ("period") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->period) num = (long long unsigned int)ptr->period; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_schema_process_rlimits_element *, free_runtime_spec_schema_config_schema_process_rlimits_element) runtime_spec_schema_config_schema_process_rlimits_element * make_runtime_spec_schema_config_schema_process_rlimits_element (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_schema_process_rlimits_element) runtime_spec_schema_config_schema_process_rlimits_element *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "hard", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->hard); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'hard': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->hard_present = 1; } } while (0); do { yajl_val val = get_val (tree, "soft", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->soft); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'soft': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->soft_present = 1; } } while (0); do { yajl_val val = get_val (tree, "type", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->type = strdup (str ? str : ""); if (ret->type == NULL) return NULL; } } while (0); if (ret->type == NULL) { if (asprintf (err, "Required field '%s' not present", "type") < 0) *err = strdup ("error allocating memory"); return NULL; } return move_ptr (ret); } void free_runtime_spec_schema_config_schema_process_rlimits_element (runtime_spec_schema_config_schema_process_rlimits_element *ptr) { if (ptr == NULL) return; free (ptr->type); ptr->type = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_schema_process_rlimits_element (yajl_gen g, const runtime_spec_schema_config_schema_process_rlimits_element *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->hard_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("hard"), 4 /* strlen ("hard") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->hard) num = (long long unsigned int)ptr->hard; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->soft_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("soft"), 4 /* strlen ("soft") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->soft) num = (long long unsigned int)ptr->soft; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("type"), 4 /* strlen ("type") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->type != NULL) str = ptr->type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_schema_process *, free_runtime_spec_schema_config_schema_process) runtime_spec_schema_config_schema_process * make_runtime_spec_schema_config_schema_process (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_schema_process) runtime_spec_schema_config_schema_process *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "args", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->args_len = len; ret->args = calloc (len + 1, sizeof (*ret->args)); if (ret->args == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->args[i] = strdup (str ? str : ""); if (ret->args[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "commandLine", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->command_line = strdup (str ? str : ""); if (ret->command_line == NULL) return NULL; } } while (0); ret->console_size = make_runtime_spec_schema_config_schema_process_console_size (get_val (tree, "consoleSize", yajl_t_object), ctx, err); if (ret->console_size == NULL && *err != 0) return NULL; do { yajl_val val = get_val (tree, "cwd", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->cwd = strdup (str ? str : ""); if (ret->cwd == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "env", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->env_len = len; ret->env = calloc (len + 1, sizeof (*ret->env)); if (ret->env == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->env[i] = strdup (str ? str : ""); if (ret->env[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "terminal", yajl_t_true); if (val != NULL) { ret->terminal = YAJL_IS_TRUE(val); ret->terminal_present = 1; } else { val = get_val (tree, "terminal", yajl_t_false); if (val != NULL) { ret->terminal = 0; ret->terminal_present = 1; } } } while (0); ret->user = make_runtime_spec_schema_config_schema_process_user (get_val (tree, "user", yajl_t_object), ctx, err); if (ret->user == NULL && *err != 0) return NULL; ret->capabilities = make_runtime_spec_schema_config_schema_process_capabilities (get_val (tree, "capabilities", yajl_t_object), ctx, err); if (ret->capabilities == NULL && *err != 0) return NULL; do { yajl_val val = get_val (tree, "apparmorProfile", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->apparmor_profile = strdup (str ? str : ""); if (ret->apparmor_profile == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "oomScoreAdj", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int (YAJL_GET_NUMBER (val), (int *)&ret->oom_score_adj); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'integer' for key 'oomScoreAdj': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->oom_score_adj_present = 1; } } while (0); do { yajl_val val = get_val (tree, "selinuxLabel", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->selinux_label = strdup (str ? str : ""); if (ret->selinux_label == NULL) return NULL; } } while (0); ret->io_priority = make_runtime_spec_schema_config_schema_process_io_priority (get_val (tree, "ioPriority", yajl_t_object), ctx, err); if (ret->io_priority == NULL && *err != 0) return NULL; do { yajl_val val = get_val (tree, "noNewPrivileges", yajl_t_true); if (val != NULL) { ret->no_new_privileges = YAJL_IS_TRUE(val); ret->no_new_privileges_present = 1; } else { val = get_val (tree, "noNewPrivileges", yajl_t_false); if (val != NULL) { ret->no_new_privileges = 0; ret->no_new_privileges_present = 1; } } } while (0); ret->scheduler = make_runtime_spec_schema_config_schema_process_scheduler (get_val (tree, "scheduler", yajl_t_object), ctx, err); if (ret->scheduler == NULL && *err != 0) return NULL; do { yajl_val tmp = get_val (tree, "rlimits", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->rlimits_len = len; ret->rlimits = calloc (len + 1, sizeof (*ret->rlimits)); if (ret->rlimits == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->rlimits[i] = make_runtime_spec_schema_config_schema_process_rlimits_element (val, ctx, err); if (ret->rlimits[i] == NULL) return NULL; } } } while (0); if (ret->cwd == NULL) { if (asprintf (err, "Required field '%s' not present", "cwd") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "args") && strcmp (tree->u.object.keys[i], "commandLine") && strcmp (tree->u.object.keys[i], "consoleSize") && strcmp (tree->u.object.keys[i], "cwd") && strcmp (tree->u.object.keys[i], "env") && strcmp (tree->u.object.keys[i], "terminal") && strcmp (tree->u.object.keys[i], "user") && strcmp (tree->u.object.keys[i], "capabilities") && strcmp (tree->u.object.keys[i], "apparmorProfile") && strcmp (tree->u.object.keys[i], "oomScoreAdj") && strcmp (tree->u.object.keys[i], "selinuxLabel") && strcmp (tree->u.object.keys[i], "ioPriority") && strcmp (tree->u.object.keys[i], "noNewPrivileges") && strcmp (tree->u.object.keys[i], "scheduler") && strcmp (tree->u.object.keys[i], "rlimits")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_schema_process (runtime_spec_schema_config_schema_process *ptr) { if (ptr == NULL) return; if (ptr->args != NULL) { size_t i; for (i = 0; i < ptr->args_len; i++) { if (ptr->args[i] != NULL) { free (ptr->args[i]); ptr->args[i] = NULL; } } free (ptr->args); ptr->args = NULL; } free (ptr->command_line); ptr->command_line = NULL; if (ptr->console_size != NULL) { free_runtime_spec_schema_config_schema_process_console_size (ptr->console_size); ptr->console_size = NULL; } free (ptr->cwd); ptr->cwd = NULL; if (ptr->env != NULL) { size_t i; for (i = 0; i < ptr->env_len; i++) { if (ptr->env[i] != NULL) { free (ptr->env[i]); ptr->env[i] = NULL; } } free (ptr->env); ptr->env = NULL; } if (ptr->user != NULL) { free_runtime_spec_schema_config_schema_process_user (ptr->user); ptr->user = NULL; } if (ptr->capabilities != NULL) { free_runtime_spec_schema_config_schema_process_capabilities (ptr->capabilities); ptr->capabilities = NULL; } free (ptr->apparmor_profile); ptr->apparmor_profile = NULL; free (ptr->selinux_label); ptr->selinux_label = NULL; if (ptr->io_priority != NULL) { free_runtime_spec_schema_config_schema_process_io_priority (ptr->io_priority); ptr->io_priority = NULL; } if (ptr->scheduler != NULL) { free_runtime_spec_schema_config_schema_process_scheduler (ptr->scheduler); ptr->scheduler = NULL; } if (ptr->rlimits != NULL) { size_t i; for (i = 0; i < ptr->rlimits_len; i++) { if (ptr->rlimits[i] != NULL) { free_runtime_spec_schema_config_schema_process_rlimits_element (ptr->rlimits[i]); ptr->rlimits[i] = NULL; } } free (ptr->rlimits); ptr->rlimits = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_schema_process (yajl_gen g, const runtime_spec_schema_config_schema_process *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->args != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("args"), 4 /* strlen ("args") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->args != NULL) len = ptr->args_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->args[i]), strlen (ptr->args[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->command_line != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("commandLine"), 11 /* strlen ("commandLine") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->command_line != NULL) str = ptr->command_line; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->console_size != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("consoleSize"), 11 /* strlen ("consoleSize") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_schema_process_console_size (g, ptr != NULL ? ptr->console_size : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->cwd != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("cwd"), 3 /* strlen ("cwd") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->cwd != NULL) str = ptr->cwd; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->env != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("env"), 3 /* strlen ("env") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->env != NULL) len = ptr->env_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->env[i]), strlen (ptr->env[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->terminal_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("terminal"), 8 /* strlen ("terminal") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->terminal) b = ptr->terminal; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->user != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("user"), 4 /* strlen ("user") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_schema_process_user (g, ptr != NULL ? ptr->user : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->capabilities != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("capabilities"), 12 /* strlen ("capabilities") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_schema_process_capabilities (g, ptr != NULL ? ptr->capabilities : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->apparmor_profile != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("apparmorProfile"), 15 /* strlen ("apparmorProfile") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->apparmor_profile != NULL) str = ptr->apparmor_profile; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->oom_score_adj_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("oomScoreAdj"), 11 /* strlen ("oomScoreAdj") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->oom_score_adj) num = (long long int)ptr->oom_score_adj; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->selinux_label != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("selinuxLabel"), 12 /* strlen ("selinuxLabel") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->selinux_label != NULL) str = ptr->selinux_label; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->io_priority != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("ioPriority"), 10 /* strlen ("ioPriority") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_schema_process_io_priority (g, ptr != NULL ? ptr->io_priority : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->no_new_privileges_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("noNewPrivileges"), 15 /* strlen ("noNewPrivileges") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->no_new_privileges) b = ptr->no_new_privileges; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->scheduler != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("scheduler"), 9 /* strlen ("scheduler") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_schema_process_scheduler (g, ptr != NULL ? ptr->scheduler : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->rlimits != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("rlimits"), 7 /* strlen ("rlimits") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->rlimits != NULL) len = ptr->rlimits_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_config_schema_process_rlimits_element (g, ptr->rlimits[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_schema *, free_runtime_spec_schema_config_schema) runtime_spec_schema_config_schema * make_runtime_spec_schema_config_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_schema) runtime_spec_schema_config_schema *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "ociVersion", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->oci_version = strdup (str ? str : ""); if (ret->oci_version == NULL) return NULL; } } while (0); ret->hooks = make_runtime_spec_schema_config_schema_hooks (get_val (tree, "hooks", yajl_t_object), ctx, err); if (ret->hooks == NULL && *err != 0) return NULL; do { yajl_val tmp = get_val (tree, "annotations", yajl_t_object); if (tmp != NULL) { ret->annotations = make_json_map_string_string (tmp, ctx, err); if (ret->annotations == NULL) { char *new_error = NULL; if (asprintf (&new_error, "Value error for key 'annotations': %s", *err ? *err : "null") < 0) new_error = strdup ("error allocating memory"); free (*err); *err = new_error; return NULL; } } } while (0); do { yajl_val val = get_val (tree, "hostname", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->hostname = strdup (str ? str : ""); if (ret->hostname == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "domainname", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->domainname = strdup (str ? str : ""); if (ret->domainname == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "mounts", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->mounts_len = len; ret->mounts = calloc (len + 1, sizeof (*ret->mounts)); if (ret->mounts == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->mounts[i] = make_runtime_spec_schema_defs_mount (val, ctx, err); if (ret->mounts[i] == NULL) return NULL; } } } while (0); ret->root = make_runtime_spec_schema_config_schema_root (get_val (tree, "root", yajl_t_object), ctx, err); if (ret->root == NULL && *err != 0) return NULL; ret->process = make_runtime_spec_schema_config_schema_process (get_val (tree, "process", yajl_t_object), ctx, err); if (ret->process == NULL && *err != 0) return NULL; ret->linux = make_runtime_spec_schema_config_linux (get_val (tree, "linux", yajl_t_object), ctx, err); if (ret->linux == NULL && *err != 0) return NULL; ret->solaris = make_runtime_spec_schema_config_solaris (get_val (tree, "solaris", yajl_t_object), ctx, err); if (ret->solaris == NULL && *err != 0) return NULL; ret->windows = make_runtime_spec_schema_config_windows (get_val (tree, "windows", yajl_t_object), ctx, err); if (ret->windows == NULL && *err != 0) return NULL; ret->vm = make_runtime_spec_schema_config_vm (get_val (tree, "vm", yajl_t_object), ctx, err); if (ret->vm == NULL && *err != 0) return NULL; ret->zos = make_runtime_spec_schema_config_zos (get_val (tree, "zos", yajl_t_object), ctx, err); if (ret->zos == NULL && *err != 0) return NULL; if (ret->oci_version == NULL) { if (asprintf (err, "Required field '%s' not present", "ociVersion") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "ociVersion") && strcmp (tree->u.object.keys[i], "hooks") && strcmp (tree->u.object.keys[i], "annotations") && strcmp (tree->u.object.keys[i], "hostname") && strcmp (tree->u.object.keys[i], "domainname") && strcmp (tree->u.object.keys[i], "mounts") && strcmp (tree->u.object.keys[i], "root") && strcmp (tree->u.object.keys[i], "process") && strcmp (tree->u.object.keys[i], "linux") && strcmp (tree->u.object.keys[i], "solaris") && strcmp (tree->u.object.keys[i], "windows") && strcmp (tree->u.object.keys[i], "vm") && strcmp (tree->u.object.keys[i], "zos")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_schema (runtime_spec_schema_config_schema *ptr) { if (ptr == NULL) return; free (ptr->oci_version); ptr->oci_version = NULL; if (ptr->hooks != NULL) { free_runtime_spec_schema_config_schema_hooks (ptr->hooks); ptr->hooks = NULL; } free_json_map_string_string (ptr->annotations); ptr->annotations = NULL; free (ptr->hostname); ptr->hostname = NULL; free (ptr->domainname); ptr->domainname = NULL; if (ptr->mounts != NULL) { size_t i; for (i = 0; i < ptr->mounts_len; i++) { if (ptr->mounts[i] != NULL) { free_runtime_spec_schema_defs_mount (ptr->mounts[i]); ptr->mounts[i] = NULL; } } free (ptr->mounts); ptr->mounts = NULL; } if (ptr->root != NULL) { free_runtime_spec_schema_config_schema_root (ptr->root); ptr->root = NULL; } if (ptr->process != NULL) { free_runtime_spec_schema_config_schema_process (ptr->process); ptr->process = NULL; } if (ptr->linux != NULL) { free_runtime_spec_schema_config_linux (ptr->linux); ptr->linux = NULL; } if (ptr->solaris != NULL) { free_runtime_spec_schema_config_solaris (ptr->solaris); ptr->solaris = NULL; } if (ptr->windows != NULL) { free_runtime_spec_schema_config_windows (ptr->windows); ptr->windows = NULL; } if (ptr->vm != NULL) { free_runtime_spec_schema_config_vm (ptr->vm); ptr->vm = NULL; } if (ptr->zos != NULL) { free_runtime_spec_schema_config_zos (ptr->zos); ptr->zos = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_schema (yajl_gen g, const runtime_spec_schema_config_schema *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->oci_version != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("ociVersion"), 10 /* strlen ("ociVersion") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->oci_version != NULL) str = ptr->oci_version; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->hooks != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("hooks"), 5 /* strlen ("hooks") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_schema_hooks (g, ptr != NULL ? ptr->hooks : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->annotations != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("annotations"), 11 /* strlen ("annotations") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_json_map_string_string (g, ptr ? ptr->annotations : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->hostname != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("hostname"), 8 /* strlen ("hostname") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->hostname != NULL) str = ptr->hostname; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->domainname != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("domainname"), 10 /* strlen ("domainname") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->domainname != NULL) str = ptr->domainname; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->mounts != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("mounts"), 6 /* strlen ("mounts") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->mounts != NULL) len = ptr->mounts_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_mount (g, ptr->mounts[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->root != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("root"), 4 /* strlen ("root") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_schema_root (g, ptr != NULL ? ptr->root : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->process != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("process"), 7 /* strlen ("process") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_schema_process (g, ptr != NULL ? ptr->process : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->linux != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("linux"), 5 /* strlen ("linux") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_linux (g, ptr != NULL ? ptr->linux : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->solaris != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("solaris"), 7 /* strlen ("solaris") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_solaris (g, ptr != NULL ? ptr->solaris : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->windows != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("windows"), 7 /* strlen ("windows") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_windows (g, ptr != NULL ? ptr->windows : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->vm != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("vm"), 2 /* strlen ("vm") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_vm (g, ptr != NULL ? ptr->vm : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->zos != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("zos"), 3 /* strlen ("zos") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_zos (g, ptr != NULL ? ptr->zos : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } runtime_spec_schema_config_schema * runtime_spec_schema_config_schema_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { runtime_spec_schema_config_schema *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = runtime_spec_schema_config_schema_parse_data (content, ctx, err);return ptr; } runtime_spec_schema_config_schema * runtime_spec_schema_config_schema_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {runtime_spec_schema_config_schema *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = runtime_spec_schema_config_schema_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) runtime_spec_schema_config_schema * runtime_spec_schema_config_schema_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { runtime_spec_schema_config_schema *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_runtime_spec_schema_config_schema (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * runtime_spec_schema_config_schema_generate_json (const runtime_spec_schema_config_schema *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_runtime_spec_schema_config_schema (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_solaris.c0000644000000000000000000007042014656670200024540 0ustar0000000000000000/* Generated from config-solaris.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_config_solaris.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_config_solaris_capped_cpu *, free_runtime_spec_schema_config_solaris_capped_cpu) runtime_spec_schema_config_solaris_capped_cpu * make_runtime_spec_schema_config_solaris_capped_cpu (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_solaris_capped_cpu) runtime_spec_schema_config_solaris_capped_cpu *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "ncpus", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->ncpus = strdup (str ? str : ""); if (ret->ncpus == NULL) return NULL; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "ncpus")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_solaris_capped_cpu (runtime_spec_schema_config_solaris_capped_cpu *ptr) { if (ptr == NULL) return; free (ptr->ncpus); ptr->ncpus = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_solaris_capped_cpu (yajl_gen g, const runtime_spec_schema_config_solaris_capped_cpu *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->ncpus != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("ncpus"), 5 /* strlen ("ncpus") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->ncpus != NULL) str = ptr->ncpus; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_solaris_capped_memory *, free_runtime_spec_schema_config_solaris_capped_memory) runtime_spec_schema_config_solaris_capped_memory * make_runtime_spec_schema_config_solaris_capped_memory (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_solaris_capped_memory) runtime_spec_schema_config_solaris_capped_memory *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "physical", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->physical = strdup (str ? str : ""); if (ret->physical == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "swap", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->swap = strdup (str ? str : ""); if (ret->swap == NULL) return NULL; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "physical") && strcmp (tree->u.object.keys[i], "swap")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_solaris_capped_memory (runtime_spec_schema_config_solaris_capped_memory *ptr) { if (ptr == NULL) return; free (ptr->physical); ptr->physical = NULL; free (ptr->swap); ptr->swap = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_solaris_capped_memory (yajl_gen g, const runtime_spec_schema_config_solaris_capped_memory *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->physical != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("physical"), 8 /* strlen ("physical") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->physical != NULL) str = ptr->physical; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->swap != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("swap"), 4 /* strlen ("swap") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->swap != NULL) str = ptr->swap; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_solaris_anet_element *, free_runtime_spec_schema_config_solaris_anet_element) runtime_spec_schema_config_solaris_anet_element * make_runtime_spec_schema_config_solaris_anet_element (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_solaris_anet_element) runtime_spec_schema_config_solaris_anet_element *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "linkname", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->linkname = strdup (str ? str : ""); if (ret->linkname == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "lowerLink", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->lower_link = strdup (str ? str : ""); if (ret->lower_link == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "allowedAddress", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->allowed_address = strdup (str ? str : ""); if (ret->allowed_address == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "configureAllowedAddress", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->configure_allowed_address = strdup (str ? str : ""); if (ret->configure_allowed_address == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "defrouter", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->defrouter = strdup (str ? str : ""); if (ret->defrouter == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "macAddress", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->mac_address = strdup (str ? str : ""); if (ret->mac_address == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "linkProtection", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->link_protection = strdup (str ? str : ""); if (ret->link_protection == NULL) return NULL; } } while (0); return move_ptr (ret); } void free_runtime_spec_schema_config_solaris_anet_element (runtime_spec_schema_config_solaris_anet_element *ptr) { if (ptr == NULL) return; free (ptr->linkname); ptr->linkname = NULL; free (ptr->lower_link); ptr->lower_link = NULL; free (ptr->allowed_address); ptr->allowed_address = NULL; free (ptr->configure_allowed_address); ptr->configure_allowed_address = NULL; free (ptr->defrouter); ptr->defrouter = NULL; free (ptr->mac_address); ptr->mac_address = NULL; free (ptr->link_protection); ptr->link_protection = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_solaris_anet_element (yajl_gen g, const runtime_spec_schema_config_solaris_anet_element *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->linkname != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("linkname"), 8 /* strlen ("linkname") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->linkname != NULL) str = ptr->linkname; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->lower_link != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("lowerLink"), 9 /* strlen ("lowerLink") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->lower_link != NULL) str = ptr->lower_link; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->allowed_address != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("allowedAddress"), 14 /* strlen ("allowedAddress") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->allowed_address != NULL) str = ptr->allowed_address; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->configure_allowed_address != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("configureAllowedAddress"), 23 /* strlen ("configureAllowedAddress") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->configure_allowed_address != NULL) str = ptr->configure_allowed_address; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->defrouter != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("defrouter"), 9 /* strlen ("defrouter") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->defrouter != NULL) str = ptr->defrouter; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->mac_address != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("macAddress"), 10 /* strlen ("macAddress") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->mac_address != NULL) str = ptr->mac_address; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->link_protection != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("linkProtection"), 14 /* strlen ("linkProtection") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->link_protection != NULL) str = ptr->link_protection; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_solaris *, free_runtime_spec_schema_config_solaris) runtime_spec_schema_config_solaris * make_runtime_spec_schema_config_solaris (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_solaris) runtime_spec_schema_config_solaris *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "milestone", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->milestone = strdup (str ? str : ""); if (ret->milestone == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "limitpriv", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->limitpriv = strdup (str ? str : ""); if (ret->limitpriv == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "maxShmMemory", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->max_shm_memory = strdup (str ? str : ""); if (ret->max_shm_memory == NULL) return NULL; } } while (0); ret->capped_cpu = make_runtime_spec_schema_config_solaris_capped_cpu (get_val (tree, "cappedCPU", yajl_t_object), ctx, err); if (ret->capped_cpu == NULL && *err != 0) return NULL; ret->capped_memory = make_runtime_spec_schema_config_solaris_capped_memory (get_val (tree, "cappedMemory", yajl_t_object), ctx, err); if (ret->capped_memory == NULL && *err != 0) return NULL; do { yajl_val tmp = get_val (tree, "anet", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->anet_len = len; ret->anet = calloc (len + 1, sizeof (*ret->anet)); if (ret->anet == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->anet[i] = make_runtime_spec_schema_config_solaris_anet_element (val, ctx, err); if (ret->anet[i] == NULL) return NULL; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "milestone") && strcmp (tree->u.object.keys[i], "limitpriv") && strcmp (tree->u.object.keys[i], "maxShmMemory") && strcmp (tree->u.object.keys[i], "cappedCPU") && strcmp (tree->u.object.keys[i], "cappedMemory") && strcmp (tree->u.object.keys[i], "anet")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_solaris (runtime_spec_schema_config_solaris *ptr) { if (ptr == NULL) return; free (ptr->milestone); ptr->milestone = NULL; free (ptr->limitpriv); ptr->limitpriv = NULL; free (ptr->max_shm_memory); ptr->max_shm_memory = NULL; if (ptr->capped_cpu != NULL) { free_runtime_spec_schema_config_solaris_capped_cpu (ptr->capped_cpu); ptr->capped_cpu = NULL; } if (ptr->capped_memory != NULL) { free_runtime_spec_schema_config_solaris_capped_memory (ptr->capped_memory); ptr->capped_memory = NULL; } if (ptr->anet != NULL) { size_t i; for (i = 0; i < ptr->anet_len; i++) { if (ptr->anet[i] != NULL) { free_runtime_spec_schema_config_solaris_anet_element (ptr->anet[i]); ptr->anet[i] = NULL; } } free (ptr->anet); ptr->anet = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_solaris (yajl_gen g, const runtime_spec_schema_config_solaris *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->milestone != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("milestone"), 9 /* strlen ("milestone") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->milestone != NULL) str = ptr->milestone; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->limitpriv != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("limitpriv"), 9 /* strlen ("limitpriv") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->limitpriv != NULL) str = ptr->limitpriv; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->max_shm_memory != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("maxShmMemory"), 12 /* strlen ("maxShmMemory") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->max_shm_memory != NULL) str = ptr->max_shm_memory; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->capped_cpu != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("cappedCPU"), 9 /* strlen ("cappedCPU") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_solaris_capped_cpu (g, ptr != NULL ? ptr->capped_cpu : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->capped_memory != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("cappedMemory"), 12 /* strlen ("cappedMemory") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_solaris_capped_memory (g, ptr != NULL ? ptr->capped_memory : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->anet != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("anet"), 4 /* strlen ("anet") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->anet != NULL) len = ptr->anet_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_config_solaris_anet_element (g, ptr->anet[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_vm.c0000644000000000000000000006376114656670200023520 0ustar0000000000000000/* Generated from config-vm.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_config_vm.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_config_vm_hypervisor *, free_runtime_spec_schema_config_vm_hypervisor) runtime_spec_schema_config_vm_hypervisor * make_runtime_spec_schema_config_vm_hypervisor (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_vm_hypervisor) runtime_spec_schema_config_vm_hypervisor *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "path", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->path = strdup (str ? str : ""); if (ret->path == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "parameters", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->parameters_len = len; ret->parameters = calloc (len + 1, sizeof (*ret->parameters)); if (ret->parameters == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->parameters[i] = strdup (str ? str : ""); if (ret->parameters[i] == NULL) return NULL; } } } } while (0); if (ret->path == NULL) { if (asprintf (err, "Required field '%s' not present", "path") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "path") && strcmp (tree->u.object.keys[i], "parameters")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_vm_hypervisor (runtime_spec_schema_config_vm_hypervisor *ptr) { if (ptr == NULL) return; free (ptr->path); ptr->path = NULL; if (ptr->parameters != NULL) { size_t i; for (i = 0; i < ptr->parameters_len; i++) { if (ptr->parameters[i] != NULL) { free (ptr->parameters[i]); ptr->parameters[i] = NULL; } } free (ptr->parameters); ptr->parameters = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_vm_hypervisor (yajl_gen g, const runtime_spec_schema_config_vm_hypervisor *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->path != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("path"), 4 /* strlen ("path") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->path != NULL) str = ptr->path; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->parameters != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("parameters"), 10 /* strlen ("parameters") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->parameters != NULL) len = ptr->parameters_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->parameters[i]), strlen (ptr->parameters[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_vm_kernel *, free_runtime_spec_schema_config_vm_kernel) runtime_spec_schema_config_vm_kernel * make_runtime_spec_schema_config_vm_kernel (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_vm_kernel) runtime_spec_schema_config_vm_kernel *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "path", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->path = strdup (str ? str : ""); if (ret->path == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "parameters", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->parameters_len = len; ret->parameters = calloc (len + 1, sizeof (*ret->parameters)); if (ret->parameters == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->parameters[i] = strdup (str ? str : ""); if (ret->parameters[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "initrd", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->initrd = strdup (str ? str : ""); if (ret->initrd == NULL) return NULL; } } while (0); if (ret->path == NULL) { if (asprintf (err, "Required field '%s' not present", "path") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "path") && strcmp (tree->u.object.keys[i], "parameters") && strcmp (tree->u.object.keys[i], "initrd")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_vm_kernel (runtime_spec_schema_config_vm_kernel *ptr) { if (ptr == NULL) return; free (ptr->path); ptr->path = NULL; if (ptr->parameters != NULL) { size_t i; for (i = 0; i < ptr->parameters_len; i++) { if (ptr->parameters[i] != NULL) { free (ptr->parameters[i]); ptr->parameters[i] = NULL; } } free (ptr->parameters); ptr->parameters = NULL; } free (ptr->initrd); ptr->initrd = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_vm_kernel (yajl_gen g, const runtime_spec_schema_config_vm_kernel *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->path != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("path"), 4 /* strlen ("path") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->path != NULL) str = ptr->path; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->parameters != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("parameters"), 10 /* strlen ("parameters") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->parameters != NULL) len = ptr->parameters_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->parameters[i]), strlen (ptr->parameters[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->initrd != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("initrd"), 6 /* strlen ("initrd") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->initrd != NULL) str = ptr->initrd; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_vm_image *, free_runtime_spec_schema_config_vm_image) runtime_spec_schema_config_vm_image * make_runtime_spec_schema_config_vm_image (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_vm_image) runtime_spec_schema_config_vm_image *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "path", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->path = strdup (str ? str : ""); if (ret->path == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "format", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->format = strdup (str ? str : ""); if (ret->format == NULL) return NULL; } } while (0); if (ret->path == NULL) { if (asprintf (err, "Required field '%s' not present", "path") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->format == NULL) { if (asprintf (err, "Required field '%s' not present", "format") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "path") && strcmp (tree->u.object.keys[i], "format")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_vm_image (runtime_spec_schema_config_vm_image *ptr) { if (ptr == NULL) return; free (ptr->path); ptr->path = NULL; free (ptr->format); ptr->format = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_vm_image (yajl_gen g, const runtime_spec_schema_config_vm_image *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->path != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("path"), 4 /* strlen ("path") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->path != NULL) str = ptr->path; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->format != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("format"), 6 /* strlen ("format") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->format != NULL) str = ptr->format; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_vm *, free_runtime_spec_schema_config_vm) runtime_spec_schema_config_vm * make_runtime_spec_schema_config_vm (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_vm) runtime_spec_schema_config_vm *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; ret->hypervisor = make_runtime_spec_schema_config_vm_hypervisor (get_val (tree, "hypervisor", yajl_t_object), ctx, err); if (ret->hypervisor == NULL && *err != 0) return NULL; ret->kernel = make_runtime_spec_schema_config_vm_kernel (get_val (tree, "kernel", yajl_t_object), ctx, err); if (ret->kernel == NULL && *err != 0) return NULL; ret->image = make_runtime_spec_schema_config_vm_image (get_val (tree, "image", yajl_t_object), ctx, err); if (ret->image == NULL && *err != 0) return NULL; if (ret->kernel == NULL) { if (asprintf (err, "Required field '%s' not present", "kernel") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "hypervisor") && strcmp (tree->u.object.keys[i], "kernel") && strcmp (tree->u.object.keys[i], "image")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_vm (runtime_spec_schema_config_vm *ptr) { if (ptr == NULL) return; if (ptr->hypervisor != NULL) { free_runtime_spec_schema_config_vm_hypervisor (ptr->hypervisor); ptr->hypervisor = NULL; } if (ptr->kernel != NULL) { free_runtime_spec_schema_config_vm_kernel (ptr->kernel); ptr->kernel = NULL; } if (ptr->image != NULL) { free_runtime_spec_schema_config_vm_image (ptr->image); ptr->image = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_vm (yajl_gen g, const runtime_spec_schema_config_vm *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->hypervisor != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("hypervisor"), 10 /* strlen ("hypervisor") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_vm_hypervisor (g, ptr != NULL ? ptr->hypervisor : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->kernel != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("kernel"), 6 /* strlen ("kernel") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_vm_kernel (g, ptr != NULL ? ptr->kernel : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->image != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("image"), 5 /* strlen ("image") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_vm_image (g, ptr != NULL ? ptr->image : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_config_windows.c0000644000000000000000000016160014656670200024557 0ustar0000000000000000/* Generated from config-windows.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_config_windows.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_config_windows_resources_memory *, free_runtime_spec_schema_config_windows_resources_memory) runtime_spec_schema_config_windows_resources_memory * make_runtime_spec_schema_config_windows_resources_memory (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_windows_resources_memory) runtime_spec_schema_config_windows_resources_memory *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "limit", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->limit); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'limit': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->limit_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "limit")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_windows_resources_memory (runtime_spec_schema_config_windows_resources_memory *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_windows_resources_memory (yajl_gen g, const runtime_spec_schema_config_windows_resources_memory *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->limit_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("limit"), 5 /* strlen ("limit") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->limit) num = (long long unsigned int)ptr->limit; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_windows_resources_cpu *, free_runtime_spec_schema_config_windows_resources_cpu) runtime_spec_schema_config_windows_resources_cpu * make_runtime_spec_schema_config_windows_resources_cpu (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_windows_resources_cpu) runtime_spec_schema_config_windows_resources_cpu *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "count", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->count); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'count': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->count_present = 1; } } while (0); do { yajl_val val = get_val (tree, "shares", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint16 (YAJL_GET_NUMBER (val), &ret->shares); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint16' for key 'shares': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->shares_present = 1; } } while (0); do { yajl_val val = get_val (tree, "maximum", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint16 (YAJL_GET_NUMBER (val), &ret->maximum); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint16' for key 'maximum': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->maximum_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "count") && strcmp (tree->u.object.keys[i], "shares") && strcmp (tree->u.object.keys[i], "maximum")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_windows_resources_cpu (runtime_spec_schema_config_windows_resources_cpu *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_windows_resources_cpu (yajl_gen g, const runtime_spec_schema_config_windows_resources_cpu *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->count_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("count"), 5 /* strlen ("count") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->count) num = (long long unsigned int)ptr->count; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->shares_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("shares"), 6 /* strlen ("shares") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->shares) num = (long long unsigned int)ptr->shares; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->maximum_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("maximum"), 7 /* strlen ("maximum") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->maximum) num = (long long unsigned int)ptr->maximum; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_windows_resources_storage *, free_runtime_spec_schema_config_windows_resources_storage) runtime_spec_schema_config_windows_resources_storage * make_runtime_spec_schema_config_windows_resources_storage (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_windows_resources_storage) runtime_spec_schema_config_windows_resources_storage *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "iops", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->iops); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'iops': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->iops_present = 1; } } while (0); do { yajl_val val = get_val (tree, "bps", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->bps); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'bps': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->bps_present = 1; } } while (0); do { yajl_val val = get_val (tree, "sandboxSize", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->sandbox_size); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'sandboxSize': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->sandbox_size_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "iops") && strcmp (tree->u.object.keys[i], "bps") && strcmp (tree->u.object.keys[i], "sandboxSize")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_windows_resources_storage (runtime_spec_schema_config_windows_resources_storage *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_windows_resources_storage (yajl_gen g, const runtime_spec_schema_config_windows_resources_storage *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->iops_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("iops"), 4 /* strlen ("iops") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->iops) num = (long long unsigned int)ptr->iops; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->bps_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("bps"), 3 /* strlen ("bps") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->bps) num = (long long unsigned int)ptr->bps; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->sandbox_size_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("sandboxSize"), 11 /* strlen ("sandboxSize") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->sandbox_size) num = (long long unsigned int)ptr->sandbox_size; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_windows_resources *, free_runtime_spec_schema_config_windows_resources) runtime_spec_schema_config_windows_resources * make_runtime_spec_schema_config_windows_resources (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_windows_resources) runtime_spec_schema_config_windows_resources *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; ret->memory = make_runtime_spec_schema_config_windows_resources_memory (get_val (tree, "memory", yajl_t_object), ctx, err); if (ret->memory == NULL && *err != 0) return NULL; ret->cpu = make_runtime_spec_schema_config_windows_resources_cpu (get_val (tree, "cpu", yajl_t_object), ctx, err); if (ret->cpu == NULL && *err != 0) return NULL; ret->storage = make_runtime_spec_schema_config_windows_resources_storage (get_val (tree, "storage", yajl_t_object), ctx, err); if (ret->storage == NULL && *err != 0) return NULL; if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "memory") && strcmp (tree->u.object.keys[i], "cpu") && strcmp (tree->u.object.keys[i], "storage")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_windows_resources (runtime_spec_schema_config_windows_resources *ptr) { if (ptr == NULL) return; if (ptr->memory != NULL) { free_runtime_spec_schema_config_windows_resources_memory (ptr->memory); ptr->memory = NULL; } if (ptr->cpu != NULL) { free_runtime_spec_schema_config_windows_resources_cpu (ptr->cpu); ptr->cpu = NULL; } if (ptr->storage != NULL) { free_runtime_spec_schema_config_windows_resources_storage (ptr->storage); ptr->storage = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_windows_resources (yajl_gen g, const runtime_spec_schema_config_windows_resources *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->memory != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("memory"), 6 /* strlen ("memory") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_windows_resources_memory (g, ptr != NULL ? ptr->memory : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->cpu != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("cpu"), 3 /* strlen ("cpu") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_windows_resources_cpu (g, ptr != NULL ? ptr->cpu : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->storage != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("storage"), 7 /* strlen ("storage") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_windows_resources_storage (g, ptr != NULL ? ptr->storage : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_windows_network *, free_runtime_spec_schema_config_windows_network) runtime_spec_schema_config_windows_network * make_runtime_spec_schema_config_windows_network (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_windows_network) runtime_spec_schema_config_windows_network *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "endpointList", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->endpoint_list_len = len; ret->endpoint_list = calloc (len + 1, sizeof (*ret->endpoint_list)); if (ret->endpoint_list == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->endpoint_list[i] = strdup (str ? str : ""); if (ret->endpoint_list[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "allowUnqualifiedDNSQuery", yajl_t_true); if (val != NULL) { ret->allow_unqualified_dns_query = YAJL_IS_TRUE(val); ret->allow_unqualified_dns_query_present = 1; } else { val = get_val (tree, "allowUnqualifiedDNSQuery", yajl_t_false); if (val != NULL) { ret->allow_unqualified_dns_query = 0; ret->allow_unqualified_dns_query_present = 1; } } } while (0); do { yajl_val tmp = get_val (tree, "DNSSearchList", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->dns_search_list_len = len; ret->dns_search_list = calloc (len + 1, sizeof (*ret->dns_search_list)); if (ret->dns_search_list == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->dns_search_list[i] = strdup (str ? str : ""); if (ret->dns_search_list[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "networkSharedContainerName", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->network_shared_container_name = strdup (str ? str : ""); if (ret->network_shared_container_name == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "networkNamespace", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->network_namespace = strdup (str ? str : ""); if (ret->network_namespace == NULL) return NULL; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "endpointList") && strcmp (tree->u.object.keys[i], "allowUnqualifiedDNSQuery") && strcmp (tree->u.object.keys[i], "DNSSearchList") && strcmp (tree->u.object.keys[i], "networkSharedContainerName") && strcmp (tree->u.object.keys[i], "networkNamespace")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_windows_network (runtime_spec_schema_config_windows_network *ptr) { if (ptr == NULL) return; if (ptr->endpoint_list != NULL) { size_t i; for (i = 0; i < ptr->endpoint_list_len; i++) { if (ptr->endpoint_list[i] != NULL) { free (ptr->endpoint_list[i]); ptr->endpoint_list[i] = NULL; } } free (ptr->endpoint_list); ptr->endpoint_list = NULL; } if (ptr->dns_search_list != NULL) { size_t i; for (i = 0; i < ptr->dns_search_list_len; i++) { if (ptr->dns_search_list[i] != NULL) { free (ptr->dns_search_list[i]); ptr->dns_search_list[i] = NULL; } } free (ptr->dns_search_list); ptr->dns_search_list = NULL; } free (ptr->network_shared_container_name); ptr->network_shared_container_name = NULL; free (ptr->network_namespace); ptr->network_namespace = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_windows_network (yajl_gen g, const runtime_spec_schema_config_windows_network *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->endpoint_list != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("endpointList"), 12 /* strlen ("endpointList") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->endpoint_list != NULL) len = ptr->endpoint_list_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->endpoint_list[i]), strlen (ptr->endpoint_list[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->allow_unqualified_dns_query_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("allowUnqualifiedDNSQuery"), 24 /* strlen ("allowUnqualifiedDNSQuery") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->allow_unqualified_dns_query) b = ptr->allow_unqualified_dns_query; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->dns_search_list != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("DNSSearchList"), 13 /* strlen ("DNSSearchList") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->dns_search_list != NULL) len = ptr->dns_search_list_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->dns_search_list[i]), strlen (ptr->dns_search_list[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->network_shared_container_name != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("networkSharedContainerName"), 26 /* strlen ("networkSharedContainerName") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->network_shared_container_name != NULL) str = ptr->network_shared_container_name; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->network_namespace != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("networkNamespace"), 16 /* strlen ("networkNamespace") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->network_namespace != NULL) str = ptr->network_namespace; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_windows_credential_spec *, free_runtime_spec_schema_config_windows_credential_spec) runtime_spec_schema_config_windows_credential_spec * make_runtime_spec_schema_config_windows_credential_spec (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_windows_credential_spec) runtime_spec_schema_config_windows_credential_spec *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; return move_ptr (ret); } void free_runtime_spec_schema_config_windows_credential_spec (runtime_spec_schema_config_windows_credential_spec *ptr) { if (ptr == NULL) return; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_windows_credential_spec (yajl_gen g, const runtime_spec_schema_config_windows_credential_spec *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ if (!(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_windows_hyperv *, free_runtime_spec_schema_config_windows_hyperv) runtime_spec_schema_config_windows_hyperv * make_runtime_spec_schema_config_windows_hyperv (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_windows_hyperv) runtime_spec_schema_config_windows_hyperv *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "utilityVMPath", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->utility_vm_path = strdup (str ? str : ""); if (ret->utility_vm_path == NULL) return NULL; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "utilityVMPath")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_windows_hyperv (runtime_spec_schema_config_windows_hyperv *ptr) { if (ptr == NULL) return; free (ptr->utility_vm_path); ptr->utility_vm_path = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_windows_hyperv (yajl_gen g, const runtime_spec_schema_config_windows_hyperv *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->utility_vm_path != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("utilityVMPath"), 13 /* strlen ("utilityVMPath") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->utility_vm_path != NULL) str = ptr->utility_vm_path; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_config_windows *, free_runtime_spec_schema_config_windows) runtime_spec_schema_config_windows * make_runtime_spec_schema_config_windows (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_config_windows) runtime_spec_schema_config_windows *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "layerFolders", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->layer_folders_len = len; ret->layer_folders = calloc (len + 1, sizeof (*ret->layer_folders)); if (ret->layer_folders == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->layer_folders[i] = strdup (str ? str : ""); if (ret->layer_folders[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "devices", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->devices_len = len; ret->devices = calloc (len + 1, sizeof (*ret->devices)); if (ret->devices == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->devices[i] = make_runtime_spec_schema_defs_windows_device (val, ctx, err); if (ret->devices[i] == NULL) return NULL; } } } while (0); ret->resources = make_runtime_spec_schema_config_windows_resources (get_val (tree, "resources", yajl_t_object), ctx, err); if (ret->resources == NULL && *err != 0) return NULL; ret->network = make_runtime_spec_schema_config_windows_network (get_val (tree, "network", yajl_t_object), ctx, err); if (ret->network == NULL && *err != 0) return NULL; ret->credential_spec = make_runtime_spec_schema_config_windows_credential_spec (get_val (tree, "credentialSpec", yajl_t_object), ctx, err); if (ret->credential_spec == NULL && *err != 0) return NULL; do { yajl_val val = get_val (tree, "servicing", yajl_t_true); if (val != NULL) { ret->servicing = YAJL_IS_TRUE(val); ret->servicing_present = 1; } else { val = get_val (tree, "servicing", yajl_t_false); if (val != NULL) { ret->servicing = 0; ret->servicing_present = 1; } } } while (0); do { yajl_val val = get_val (tree, "ignoreFlushesDuringBoot", yajl_t_true); if (val != NULL) { ret->ignore_flushes_during_boot = YAJL_IS_TRUE(val); ret->ignore_flushes_during_boot_present = 1; } else { val = get_val (tree, "ignoreFlushesDuringBoot", yajl_t_false); if (val != NULL) { ret->ignore_flushes_during_boot = 0; ret->ignore_flushes_during_boot_present = 1; } } } while (0); ret->hyperv = make_runtime_spec_schema_config_windows_hyperv (get_val (tree, "hyperv", yajl_t_object), ctx, err); if (ret->hyperv == NULL && *err != 0) return NULL; if (ret->layer_folders == NULL) { if (asprintf (err, "Required field '%s' not present", "layerFolders") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "layerFolders") && strcmp (tree->u.object.keys[i], "devices") && strcmp (tree->u.object.keys[i], "resources") && strcmp (tree->u.object.keys[i], "network") && strcmp (tree->u.object.keys[i], "credentialSpec") && strcmp (tree->u.object.keys[i], "servicing") && strcmp (tree->u.object.keys[i], "ignoreFlushesDuringBoot") && strcmp (tree->u.object.keys[i], "hyperv")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_config_windows (runtime_spec_schema_config_windows *ptr) { if (ptr == NULL) return; if (ptr->layer_folders != NULL) { size_t i; for (i = 0; i < ptr->layer_folders_len; i++) { if (ptr->layer_folders[i] != NULL) { free (ptr->layer_folders[i]); ptr->layer_folders[i] = NULL; } } free (ptr->layer_folders); ptr->layer_folders = NULL; } if (ptr->devices != NULL) { size_t i; for (i = 0; i < ptr->devices_len; i++) { if (ptr->devices[i] != NULL) { free_runtime_spec_schema_defs_windows_device (ptr->devices[i]); ptr->devices[i] = NULL; } } free (ptr->devices); ptr->devices = NULL; } if (ptr->resources != NULL) { free_runtime_spec_schema_config_windows_resources (ptr->resources); ptr->resources = NULL; } if (ptr->network != NULL) { free_runtime_spec_schema_config_windows_network (ptr->network); ptr->network = NULL; } if (ptr->credential_spec != NULL) { free_runtime_spec_schema_config_windows_credential_spec (ptr->credential_spec); ptr->credential_spec = NULL; } if (ptr->hyperv != NULL) { free_runtime_spec_schema_config_windows_hyperv (ptr->hyperv); ptr->hyperv = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_config_windows (yajl_gen g, const runtime_spec_schema_config_windows *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->layer_folders != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("layerFolders"), 12 /* strlen ("layerFolders") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->layer_folders != NULL) len = ptr->layer_folders_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->layer_folders[i]), strlen (ptr->layer_folders[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->devices != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("devices"), 7 /* strlen ("devices") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->devices != NULL) len = ptr->devices_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_windows_device (g, ptr->devices[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->resources != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("resources"), 9 /* strlen ("resources") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_windows_resources (g, ptr != NULL ? ptr->resources : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->network != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("network"), 7 /* strlen ("network") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_windows_network (g, ptr != NULL ? ptr->network : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->credential_spec != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("credentialSpec"), 14 /* strlen ("credentialSpec") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_windows_credential_spec (g, ptr != NULL ? ptr->credential_spec : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->servicing_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("servicing"), 9 /* strlen ("servicing") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->servicing) b = ptr->servicing; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->ignore_flushes_during_boot_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("ignoreFlushesDuringBoot"), 23 /* strlen ("ignoreFlushesDuringBoot") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->ignore_flushes_during_boot) b = ptr->ignore_flushes_during_boot; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->hyperv != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("hyperv"), 6 /* strlen ("hyperv") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_config_windows_hyperv (g, ptr != NULL ? ptr->hyperv : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_defs.c0000644000000000000000000007607614656670200022475 0ustar0000000000000000/* Generated from defs.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_defs.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_defs_hook *, free_runtime_spec_schema_defs_hook) runtime_spec_schema_defs_hook * make_runtime_spec_schema_defs_hook (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_hook) runtime_spec_schema_defs_hook *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "path", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->path = strdup (str ? str : ""); if (ret->path == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "args", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->args_len = len; ret->args = calloc (len + 1, sizeof (*ret->args)); if (ret->args == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->args[i] = strdup (str ? str : ""); if (ret->args[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "env", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->env_len = len; ret->env = calloc (len + 1, sizeof (*ret->env)); if (ret->env == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->env[i] = strdup (str ? str : ""); if (ret->env[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "timeout", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int (YAJL_GET_NUMBER (val), (int *)&ret->timeout); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'integer' for key 'timeout': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->timeout_present = 1; } } while (0); if (ret->path == NULL) { if (asprintf (err, "Required field '%s' not present", "path") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "path") && strcmp (tree->u.object.keys[i], "args") && strcmp (tree->u.object.keys[i], "env") && strcmp (tree->u.object.keys[i], "timeout")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_hook (runtime_spec_schema_defs_hook *ptr) { if (ptr == NULL) return; free (ptr->path); ptr->path = NULL; if (ptr->args != NULL) { size_t i; for (i = 0; i < ptr->args_len; i++) { if (ptr->args[i] != NULL) { free (ptr->args[i]); ptr->args[i] = NULL; } } free (ptr->args); ptr->args = NULL; } if (ptr->env != NULL) { size_t i; for (i = 0; i < ptr->env_len; i++) { if (ptr->env[i] != NULL) { free (ptr->env[i]); ptr->env[i] = NULL; } } free (ptr->env); ptr->env = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_hook (yajl_gen g, const runtime_spec_schema_defs_hook *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->path != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("path"), 4 /* strlen ("path") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->path != NULL) str = ptr->path; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->args != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("args"), 4 /* strlen ("args") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->args != NULL) len = ptr->args_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->args[i]), strlen (ptr->args[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->env != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("env"), 3 /* strlen ("env") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->env != NULL) len = ptr->env_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->env[i]), strlen (ptr->env[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->timeout_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("timeout"), 7 /* strlen ("timeout") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->timeout) num = (long long int)ptr->timeout; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_id_mapping *, free_runtime_spec_schema_defs_id_mapping) runtime_spec_schema_defs_id_mapping * make_runtime_spec_schema_defs_id_mapping (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_id_mapping) runtime_spec_schema_defs_id_mapping *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "containerID", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->container_id); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'containerID': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->container_id_present = 1; } } while (0); do { yajl_val val = get_val (tree, "hostID", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->host_id); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'hostID': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->host_id_present = 1; } } while (0); do { yajl_val val = get_val (tree, "size", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->size); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'size': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->size_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "containerID") && strcmp (tree->u.object.keys[i], "hostID") && strcmp (tree->u.object.keys[i], "size")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_id_mapping (runtime_spec_schema_defs_id_mapping *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_id_mapping (yajl_gen g, const runtime_spec_schema_defs_id_mapping *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->container_id_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("containerID"), 11 /* strlen ("containerID") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->container_id) num = (long long unsigned int)ptr->container_id; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->host_id_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("hostID"), 6 /* strlen ("hostID") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->host_id) num = (long long unsigned int)ptr->host_id; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->size_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("size"), 4 /* strlen ("size") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->size) num = (long long unsigned int)ptr->size; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_mount *, free_runtime_spec_schema_defs_mount) runtime_spec_schema_defs_mount * make_runtime_spec_schema_defs_mount (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_mount) runtime_spec_schema_defs_mount *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "source", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->source = strdup (str ? str : ""); if (ret->source == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "destination", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->destination = strdup (str ? str : ""); if (ret->destination == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "options", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->options_len = len; ret->options = calloc (len + 1, sizeof (*ret->options)); if (ret->options == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->options[i] = strdup (str ? str : ""); if (ret->options[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "type", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->type = strdup (str ? str : ""); if (ret->type == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "uidMappings", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->uid_mappings_len = len; ret->uid_mappings = calloc (len + 1, sizeof (*ret->uid_mappings)); if (ret->uid_mappings == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->uid_mappings[i] = make_runtime_spec_schema_defs_id_mapping (val, ctx, err); if (ret->uid_mappings[i] == NULL) return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "gidMappings", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->gid_mappings_len = len; ret->gid_mappings = calloc (len + 1, sizeof (*ret->gid_mappings)); if (ret->gid_mappings == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->gid_mappings[i] = make_runtime_spec_schema_defs_id_mapping (val, ctx, err); if (ret->gid_mappings[i] == NULL) return NULL; } } } while (0); if (ret->destination == NULL) { if (asprintf (err, "Required field '%s' not present", "destination") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "source") && strcmp (tree->u.object.keys[i], "destination") && strcmp (tree->u.object.keys[i], "options") && strcmp (tree->u.object.keys[i], "type") && strcmp (tree->u.object.keys[i], "uidMappings") && strcmp (tree->u.object.keys[i], "gidMappings")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_mount (runtime_spec_schema_defs_mount *ptr) { if (ptr == NULL) return; free (ptr->source); ptr->source = NULL; free (ptr->destination); ptr->destination = NULL; if (ptr->options != NULL) { size_t i; for (i = 0; i < ptr->options_len; i++) { if (ptr->options[i] != NULL) { free (ptr->options[i]); ptr->options[i] = NULL; } } free (ptr->options); ptr->options = NULL; } free (ptr->type); ptr->type = NULL; if (ptr->uid_mappings != NULL) { size_t i; for (i = 0; i < ptr->uid_mappings_len; i++) { if (ptr->uid_mappings[i] != NULL) { free_runtime_spec_schema_defs_id_mapping (ptr->uid_mappings[i]); ptr->uid_mappings[i] = NULL; } } free (ptr->uid_mappings); ptr->uid_mappings = NULL; } if (ptr->gid_mappings != NULL) { size_t i; for (i = 0; i < ptr->gid_mappings_len; i++) { if (ptr->gid_mappings[i] != NULL) { free_runtime_spec_schema_defs_id_mapping (ptr->gid_mappings[i]); ptr->gid_mappings[i] = NULL; } } free (ptr->gid_mappings); ptr->gid_mappings = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_mount (yajl_gen g, const runtime_spec_schema_defs_mount *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->source != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("source"), 6 /* strlen ("source") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->source != NULL) str = ptr->source; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->destination != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("destination"), 11 /* strlen ("destination") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->destination != NULL) str = ptr->destination; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->options != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("options"), 7 /* strlen ("options") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->options != NULL) len = ptr->options_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->options[i]), strlen (ptr->options[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("type"), 4 /* strlen ("type") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->type != NULL) str = ptr->type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->uid_mappings != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("uidMappings"), 11 /* strlen ("uidMappings") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->uid_mappings != NULL) len = ptr->uid_mappings_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_id_mapping (g, ptr->uid_mappings[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->gid_mappings != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("gidMappings"), 11 /* strlen ("gidMappings") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->gid_mappings != NULL) len = ptr->gid_mappings_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_id_mapping (g, ptr->gid_mappings[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_defs_linux.c0000644000000000000000000026451314656670200023707 0ustar0000000000000000/* Generated from defs-linux.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_defs_linux.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_defs_linux_personality *, free_runtime_spec_schema_defs_linux_personality) runtime_spec_schema_defs_linux_personality * make_runtime_spec_schema_defs_linux_personality (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_personality) runtime_spec_schema_defs_linux_personality *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "domain", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->domain = strdup (str ? str : ""); if (ret->domain == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "flags", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->flags_len = len; ret->flags = calloc (len + 1, sizeof (*ret->flags)); if (ret->flags == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->flags[i] = strdup (str ? str : ""); if (ret->flags[i] == NULL) return NULL; } } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "domain") && strcmp (tree->u.object.keys[i], "flags")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_personality (runtime_spec_schema_defs_linux_personality *ptr) { if (ptr == NULL) return; free (ptr->domain); ptr->domain = NULL; if (ptr->flags != NULL) { size_t i; for (i = 0; i < ptr->flags_len; i++) { if (ptr->flags[i] != NULL) { free (ptr->flags[i]); ptr->flags[i] = NULL; } } free (ptr->flags); ptr->flags = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_personality (yajl_gen g, const runtime_spec_schema_defs_linux_personality *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->domain != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("domain"), 6 /* strlen ("domain") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->domain != NULL) str = ptr->domain; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->flags != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("flags"), 5 /* strlen ("flags") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->flags != NULL) len = ptr->flags_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->flags[i]), strlen (ptr->flags[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_linux_syscall_arg *, free_runtime_spec_schema_defs_linux_syscall_arg) runtime_spec_schema_defs_linux_syscall_arg * make_runtime_spec_schema_defs_linux_syscall_arg (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_syscall_arg) runtime_spec_schema_defs_linux_syscall_arg *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "index", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->index); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'index': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->index_present = 1; } } while (0); do { yajl_val val = get_val (tree, "value", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->value); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'value': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->value_present = 1; } } while (0); do { yajl_val val = get_val (tree, "valueTwo", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->value_two); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'valueTwo': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->value_two_present = 1; } } while (0); do { yajl_val val = get_val (tree, "op", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->op = strdup (str ? str : ""); if (ret->op == NULL) return NULL; } } while (0); if (ret->op == NULL) { if (asprintf (err, "Required field '%s' not present", "op") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "index") && strcmp (tree->u.object.keys[i], "value") && strcmp (tree->u.object.keys[i], "valueTwo") && strcmp (tree->u.object.keys[i], "op")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_syscall_arg (runtime_spec_schema_defs_linux_syscall_arg *ptr) { if (ptr == NULL) return; free (ptr->op); ptr->op = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_syscall_arg (yajl_gen g, const runtime_spec_schema_defs_linux_syscall_arg *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->index_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("index"), 5 /* strlen ("index") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->index) num = (long long unsigned int)ptr->index; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->value_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("value"), 5 /* strlen ("value") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->value) num = (long long unsigned int)ptr->value; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->value_two_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("valueTwo"), 8 /* strlen ("valueTwo") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->value_two) num = (long long unsigned int)ptr->value_two; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->op != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("op"), 2 /* strlen ("op") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->op != NULL) str = ptr->op; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_linux_syscall *, free_runtime_spec_schema_defs_linux_syscall) runtime_spec_schema_defs_linux_syscall * make_runtime_spec_schema_defs_linux_syscall (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_syscall) runtime_spec_schema_defs_linux_syscall *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "names", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->names_len = len; ret->names = calloc (len + 1, sizeof (*ret->names)); if (ret->names == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->names[i] = strdup (str ? str : ""); if (ret->names[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "action", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->action = strdup (str ? str : ""); if (ret->action == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "errnoRet", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->errno_ret); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'errnoRet': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->errno_ret_present = 1; } } while (0); do { yajl_val tmp = get_val (tree, "args", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->args_len = len; ret->args = calloc (len + 1, sizeof (*ret->args)); if (ret->args == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; ret->args[i] = make_runtime_spec_schema_defs_linux_syscall_arg (val, ctx, err); if (ret->args[i] == NULL) return NULL; } } } while (0); if (ret->names == NULL) { if (asprintf (err, "Required field '%s' not present", "names") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->action == NULL) { if (asprintf (err, "Required field '%s' not present", "action") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "names") && strcmp (tree->u.object.keys[i], "action") && strcmp (tree->u.object.keys[i], "errnoRet") && strcmp (tree->u.object.keys[i], "args")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_syscall (runtime_spec_schema_defs_linux_syscall *ptr) { if (ptr == NULL) return; if (ptr->names != NULL) { size_t i; for (i = 0; i < ptr->names_len; i++) { if (ptr->names[i] != NULL) { free (ptr->names[i]); ptr->names[i] = NULL; } } free (ptr->names); ptr->names = NULL; } free (ptr->action); ptr->action = NULL; if (ptr->args != NULL) { size_t i; for (i = 0; i < ptr->args_len; i++) { if (ptr->args[i] != NULL) { free_runtime_spec_schema_defs_linux_syscall_arg (ptr->args[i]); ptr->args[i] = NULL; } } free (ptr->args); ptr->args = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_syscall (yajl_gen g, const runtime_spec_schema_defs_linux_syscall *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->names != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("names"), 5 /* strlen ("names") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->names != NULL) len = ptr->names_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->names[i]), strlen (ptr->names[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->action != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("action"), 6 /* strlen ("action") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->action != NULL) str = ptr->action; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->errno_ret_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("errnoRet"), 8 /* strlen ("errnoRet") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->errno_ret) num = (long long unsigned int)ptr->errno_ret; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->args != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("args"), 4 /* strlen ("args") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->args != NULL) len = ptr->args_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = gen_runtime_spec_schema_defs_linux_syscall_arg (g, ptr->args[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_linux_device *, free_runtime_spec_schema_defs_linux_device) runtime_spec_schema_defs_linux_device * make_runtime_spec_schema_defs_linux_device (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_device) runtime_spec_schema_defs_linux_device *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "type", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->type = strdup (str ? str : ""); if (ret->type == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "path", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->path = strdup (str ? str : ""); if (ret->path == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "fileMode", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int (YAJL_GET_NUMBER (val), (int *)&ret->file_mode); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'integer' for key 'fileMode': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->file_mode_present = 1; } } while (0); do { yajl_val val = get_val (tree, "major", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->major); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'major': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->major_present = 1; } } while (0); do { yajl_val val = get_val (tree, "minor", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->minor); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'minor': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->minor_present = 1; } } while (0); do { yajl_val val = get_val (tree, "uid", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint (YAJL_GET_NUMBER (val), (unsigned int *)&ret->uid); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'UID' for key 'uid': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->uid_present = 1; } } while (0); do { yajl_val val = get_val (tree, "gid", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint (YAJL_GET_NUMBER (val), (unsigned int *)&ret->gid); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'GID' for key 'gid': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->gid_present = 1; } } while (0); if (ret->type == NULL) { if (asprintf (err, "Required field '%s' not present", "type") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->path == NULL) { if (asprintf (err, "Required field '%s' not present", "path") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "type") && strcmp (tree->u.object.keys[i], "path") && strcmp (tree->u.object.keys[i], "fileMode") && strcmp (tree->u.object.keys[i], "major") && strcmp (tree->u.object.keys[i], "minor") && strcmp (tree->u.object.keys[i], "uid") && strcmp (tree->u.object.keys[i], "gid")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_device (runtime_spec_schema_defs_linux_device *ptr) { if (ptr == NULL) return; free (ptr->type); ptr->type = NULL; free (ptr->path); ptr->path = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_device (yajl_gen g, const runtime_spec_schema_defs_linux_device *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("type"), 4 /* strlen ("type") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->type != NULL) str = ptr->type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->path != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("path"), 4 /* strlen ("path") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->path != NULL) str = ptr->path; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->file_mode_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("fileMode"), 8 /* strlen ("fileMode") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->file_mode) num = (long long int)ptr->file_mode; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->major_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("major"), 5 /* strlen ("major") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->major) num = (long long int)ptr->major; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->minor_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("minor"), 5 /* strlen ("minor") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->minor) num = (long long int)ptr->minor; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->uid_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("uid"), 3 /* strlen ("uid") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->uid) num = (long long unsigned int)ptr->uid; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->gid_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("gid"), 3 /* strlen ("gid") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->gid) num = (long long unsigned int)ptr->gid; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_linux_block_io_device *, free_runtime_spec_schema_defs_linux_block_io_device) runtime_spec_schema_defs_linux_block_io_device * make_runtime_spec_schema_defs_linux_block_io_device (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_block_io_device) runtime_spec_schema_defs_linux_block_io_device *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "major", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->major); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'major': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->major_present = 1; } } while (0); do { yajl_val val = get_val (tree, "minor", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->minor); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'minor': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->minor_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "major") && strcmp (tree->u.object.keys[i], "minor")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_block_io_device (runtime_spec_schema_defs_linux_block_io_device *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_block_io_device (yajl_gen g, const runtime_spec_schema_defs_linux_block_io_device *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->major_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("major"), 5 /* strlen ("major") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->major) num = (long long int)ptr->major; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->minor_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("minor"), 5 /* strlen ("minor") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->minor) num = (long long int)ptr->minor; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_linux_block_io_device_weight *, free_runtime_spec_schema_defs_linux_block_io_device_weight) runtime_spec_schema_defs_linux_block_io_device_weight * make_runtime_spec_schema_defs_linux_block_io_device_weight (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_block_io_device_weight) runtime_spec_schema_defs_linux_block_io_device_weight *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "major", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->major); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'major': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->major_present = 1; } } while (0); do { yajl_val val = get_val (tree, "minor", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->minor); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'minor': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->minor_present = 1; } } while (0); do { yajl_val val = get_val (tree, "weight", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint16 (YAJL_GET_NUMBER (val), &ret->weight); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint16' for key 'weight': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->weight_present = 1; } } while (0); do { yajl_val val = get_val (tree, "leafWeight", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint16 (YAJL_GET_NUMBER (val), &ret->leaf_weight); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint16' for key 'leafWeight': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->leaf_weight_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "major") && strcmp (tree->u.object.keys[i], "minor") && strcmp (tree->u.object.keys[i], "weight") && strcmp (tree->u.object.keys[i], "leafWeight")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_block_io_device_weight (runtime_spec_schema_defs_linux_block_io_device_weight *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_block_io_device_weight (yajl_gen g, const runtime_spec_schema_defs_linux_block_io_device_weight *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->major_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("major"), 5 /* strlen ("major") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->major) num = (long long int)ptr->major; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->minor_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("minor"), 5 /* strlen ("minor") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->minor) num = (long long int)ptr->minor; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->weight_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("weight"), 6 /* strlen ("weight") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->weight) num = (long long unsigned int)ptr->weight; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->leaf_weight_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("leafWeight"), 10 /* strlen ("leafWeight") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->leaf_weight) num = (long long unsigned int)ptr->leaf_weight; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_linux_block_io_device_throttle *, free_runtime_spec_schema_defs_linux_block_io_device_throttle) runtime_spec_schema_defs_linux_block_io_device_throttle * make_runtime_spec_schema_defs_linux_block_io_device_throttle (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_block_io_device_throttle) runtime_spec_schema_defs_linux_block_io_device_throttle *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "major", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->major); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'major': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->major_present = 1; } } while (0); do { yajl_val val = get_val (tree, "minor", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->minor); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'minor': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->minor_present = 1; } } while (0); do { yajl_val val = get_val (tree, "rate", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint64 (YAJL_GET_NUMBER (val), &ret->rate); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint64' for key 'rate': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->rate_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "major") && strcmp (tree->u.object.keys[i], "minor") && strcmp (tree->u.object.keys[i], "rate")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_block_io_device_throttle (runtime_spec_schema_defs_linux_block_io_device_throttle *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_block_io_device_throttle (yajl_gen g, const runtime_spec_schema_defs_linux_block_io_device_throttle *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->major_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("major"), 5 /* strlen ("major") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->major) num = (long long int)ptr->major; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->minor_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("minor"), 5 /* strlen ("minor") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->minor) num = (long long int)ptr->minor; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->rate_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("rate"), 4 /* strlen ("rate") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->rate) num = (long long unsigned int)ptr->rate; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_linux_device_cgroup *, free_runtime_spec_schema_defs_linux_device_cgroup) runtime_spec_schema_defs_linux_device_cgroup * make_runtime_spec_schema_defs_linux_device_cgroup (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_device_cgroup) runtime_spec_schema_defs_linux_device_cgroup *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "allow", yajl_t_true); if (val != NULL) { ret->allow = YAJL_IS_TRUE(val); ret->allow_present = 1; } else { val = get_val (tree, "allow", yajl_t_false); if (val != NULL) { ret->allow = 0; ret->allow_present = 1; } } } while (0); do { yajl_val val = get_val (tree, "type", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->type = strdup (str ? str : ""); if (ret->type == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "major", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->major); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'major': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->major_present = 1; } } while (0); do { yajl_val val = get_val (tree, "minor", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->minor); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'minor': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->minor_present = 1; } } while (0); do { yajl_val val = get_val (tree, "access", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->access = strdup (str ? str : ""); if (ret->access == NULL) return NULL; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "allow") && strcmp (tree->u.object.keys[i], "type") && strcmp (tree->u.object.keys[i], "major") && strcmp (tree->u.object.keys[i], "minor") && strcmp (tree->u.object.keys[i], "access")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_device_cgroup (runtime_spec_schema_defs_linux_device_cgroup *ptr) { if (ptr == NULL) return; free (ptr->type); ptr->type = NULL; free (ptr->access); ptr->access = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_device_cgroup (yajl_gen g, const runtime_spec_schema_defs_linux_device_cgroup *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->allow_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("allow"), 5 /* strlen ("allow") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->allow) b = ptr->allow; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("type"), 4 /* strlen ("type") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->type != NULL) str = ptr->type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->major_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("major"), 5 /* strlen ("major") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->major) num = (long long int)ptr->major; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->minor_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("minor"), 5 /* strlen ("minor") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->minor) num = (long long int)ptr->minor; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->access != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("access"), 6 /* strlen ("access") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->access != NULL) str = ptr->access; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_linux_network_interface_priority *, free_runtime_spec_schema_defs_linux_network_interface_priority) runtime_spec_schema_defs_linux_network_interface_priority * make_runtime_spec_schema_defs_linux_network_interface_priority (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_network_interface_priority) runtime_spec_schema_defs_linux_network_interface_priority *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "name", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->name = strdup (str ? str : ""); if (ret->name == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "priority", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->priority); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'priority': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->priority_present = 1; } } while (0); if (ret->name == NULL) { if (asprintf (err, "Required field '%s' not present", "name") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "name") && strcmp (tree->u.object.keys[i], "priority")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_network_interface_priority (runtime_spec_schema_defs_linux_network_interface_priority *ptr) { if (ptr == NULL) return; free (ptr->name); ptr->name = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_network_interface_priority (yajl_gen g, const runtime_spec_schema_defs_linux_network_interface_priority *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->name != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("name"), 4 /* strlen ("name") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->name != NULL) str = ptr->name; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->priority_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("priority"), 8 /* strlen ("priority") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->priority) num = (long long unsigned int)ptr->priority; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_linux_rdma *, free_runtime_spec_schema_defs_linux_rdma) runtime_spec_schema_defs_linux_rdma * make_runtime_spec_schema_defs_linux_rdma (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_rdma) runtime_spec_schema_defs_linux_rdma *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "hcaHandles", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->hca_handles); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'hcaHandles': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->hca_handles_present = 1; } } while (0); do { yajl_val val = get_val (tree, "hcaObjects", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->hca_objects); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'hcaObjects': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->hca_objects_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "hcaHandles") && strcmp (tree->u.object.keys[i], "hcaObjects")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_rdma (runtime_spec_schema_defs_linux_rdma *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_rdma (yajl_gen g, const runtime_spec_schema_defs_linux_rdma *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->hca_handles_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("hcaHandles"), 10 /* strlen ("hcaHandles") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->hca_handles) num = (long long unsigned int)ptr->hca_handles; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->hca_objects_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("hcaObjects"), 10 /* strlen ("hcaObjects") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->hca_objects) num = (long long unsigned int)ptr->hca_objects; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_linux_namespace_reference *, free_runtime_spec_schema_defs_linux_namespace_reference) runtime_spec_schema_defs_linux_namespace_reference * make_runtime_spec_schema_defs_linux_namespace_reference (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_namespace_reference) runtime_spec_schema_defs_linux_namespace_reference *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "type", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->type = strdup (str ? str : ""); if (ret->type == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "path", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->path = strdup (str ? str : ""); if (ret->path == NULL) return NULL; } } while (0); if (ret->type == NULL) { if (asprintf (err, "Required field '%s' not present", "type") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "type") && strcmp (tree->u.object.keys[i], "path")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_namespace_reference (runtime_spec_schema_defs_linux_namespace_reference *ptr) { if (ptr == NULL) return; free (ptr->type); ptr->type = NULL; free (ptr->path); ptr->path = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_namespace_reference (yajl_gen g, const runtime_spec_schema_defs_linux_namespace_reference *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("type"), 4 /* strlen ("type") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->type != NULL) str = ptr->type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->path != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("path"), 4 /* strlen ("path") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->path != NULL) str = ptr->path; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_defs_linux_time_offsets *, free_runtime_spec_schema_defs_linux_time_offsets) runtime_spec_schema_defs_linux_time_offsets * make_runtime_spec_schema_defs_linux_time_offsets (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_linux_time_offsets) runtime_spec_schema_defs_linux_time_offsets *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "secs", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->secs); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'secs': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->secs_present = 1; } } while (0); do { yajl_val val = get_val (tree, "nanosecs", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint32 (YAJL_GET_NUMBER (val), &ret->nanosecs); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'uint32' for key 'nanosecs': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->nanosecs_present = 1; } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "secs") && strcmp (tree->u.object.keys[i], "nanosecs")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_linux_time_offsets (runtime_spec_schema_defs_linux_time_offsets *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_linux_time_offsets (yajl_gen g, const runtime_spec_schema_defs_linux_time_offsets *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->secs_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("secs"), 4 /* strlen ("secs") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->secs) num = (long long int)ptr->secs; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->nanosecs_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("nanosecs"), 8 /* strlen ("nanosecs") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->nanosecs) num = (long long unsigned int)ptr->nanosecs; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_defs_zos.c0000644000000000000000000003030214656670200023346 0ustar0000000000000000/* Generated from defs-zos.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_defs_zos.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_defs_zos_device *, free_runtime_spec_schema_defs_zos_device) runtime_spec_schema_defs_zos_device * make_runtime_spec_schema_defs_zos_device (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_zos_device) runtime_spec_schema_defs_zos_device *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "path", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->path = strdup (str ? str : ""); if (ret->path == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "type", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->type = strdup (str ? str : ""); if (ret->type == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "major", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->major); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'major': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->major_present = 1; } } while (0); do { yajl_val val = get_val (tree, "minor", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (val), &ret->minor); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int64' for key 'minor': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->minor_present = 1; } } while (0); do { yajl_val val = get_val (tree, "fileMode", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int (YAJL_GET_NUMBER (val), (int *)&ret->file_mode); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'integer' for key 'fileMode': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->file_mode_present = 1; } } while (0); do { yajl_val val = get_val (tree, "uid", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint (YAJL_GET_NUMBER (val), (unsigned int *)&ret->uid); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'UID' for key 'uid': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->uid_present = 1; } } while (0); do { yajl_val val = get_val (tree, "gid", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_uint (YAJL_GET_NUMBER (val), (unsigned int *)&ret->gid); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'GID' for key 'gid': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->gid_present = 1; } } while (0); if (ret->path == NULL) { if (asprintf (err, "Required field '%s' not present", "path") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->type == NULL) { if (asprintf (err, "Required field '%s' not present", "type") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "path") && strcmp (tree->u.object.keys[i], "type") && strcmp (tree->u.object.keys[i], "major") && strcmp (tree->u.object.keys[i], "minor") && strcmp (tree->u.object.keys[i], "fileMode") && strcmp (tree->u.object.keys[i], "uid") && strcmp (tree->u.object.keys[i], "gid")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_zos_device (runtime_spec_schema_defs_zos_device *ptr) { if (ptr == NULL) return; free (ptr->path); ptr->path = NULL; free (ptr->type); ptr->type = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_zos_device (yajl_gen g, const runtime_spec_schema_defs_zos_device *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->path != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("path"), 4 /* strlen ("path") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->path != NULL) str = ptr->path; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("type"), 4 /* strlen ("type") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->type != NULL) str = ptr->type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->major_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("major"), 5 /* strlen ("major") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->major) num = (long long int)ptr->major; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->minor_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("minor"), 5 /* strlen ("minor") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->minor) num = (long long int)ptr->minor; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->file_mode_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("fileMode"), 8 /* strlen ("fileMode") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->file_mode) num = (long long int)ptr->file_mode; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->uid_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("uid"), 3 /* strlen ("uid") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->uid) num = (long long unsigned int)ptr->uid; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->gid_present)) { long long unsigned int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("gid"), 3 /* strlen ("gid") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->gid) num = (long long unsigned int)ptr->gid; stat = map_uint (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_defs_vm.c0000644000000000000000000000045614656670200023164 0ustar0000000000000000/* Generated from defs-vm.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_defs_vm.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_defs_windows.c0000644000000000000000000001335314656670200024234 0ustar0000000000000000/* Generated from defs-windows.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_defs_windows.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_defs_windows_device *, free_runtime_spec_schema_defs_windows_device) runtime_spec_schema_defs_windows_device * make_runtime_spec_schema_defs_windows_device (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_defs_windows_device) runtime_spec_schema_defs_windows_device *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "id", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->id = strdup (str ? str : ""); if (ret->id == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "idType", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->id_type = strdup (str ? str : ""); if (ret->id_type == NULL) return NULL; } } while (0); if (ret->id == NULL) { if (asprintf (err, "Required field '%s' not present", "id") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->id_type == NULL) { if (asprintf (err, "Required field '%s' not present", "idType") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "id") && strcmp (tree->u.object.keys[i], "idType")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_defs_windows_device (runtime_spec_schema_defs_windows_device *ptr) { if (ptr == NULL) return; free (ptr->id); ptr->id = NULL; free (ptr->id_type); ptr->id_type = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_defs_windows_device (yajl_gen g, const runtime_spec_schema_defs_windows_device *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->id != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("id"), 2 /* strlen ("id") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->id != NULL) str = ptr->id; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->id_type != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("idType"), 6 /* strlen ("idType") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->id_type != NULL) str = ptr->id_type; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_state_schema.c0000644000000000000000000003377314656670200024211 0ustar0000000000000000/* Generated from state-schema.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_state_schema.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_state_schema *, free_runtime_spec_schema_state_schema) runtime_spec_schema_state_schema * make_runtime_spec_schema_state_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_state_schema) runtime_spec_schema_state_schema *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "ociVersion", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->oci_version = strdup (str ? str : ""); if (ret->oci_version == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "id", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->id = strdup (str ? str : ""); if (ret->id == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "status", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->status = strdup (str ? str : ""); if (ret->status == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "pid", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int (YAJL_GET_NUMBER (val), (int *)&ret->pid); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'integer' for key 'pid': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->pid_present = 1; } } while (0); do { yajl_val val = get_val (tree, "bundle", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->bundle = strdup (str ? str : ""); if (ret->bundle == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "annotations", yajl_t_object); if (tmp != NULL) { ret->annotations = make_json_map_string_string (tmp, ctx, err); if (ret->annotations == NULL) { char *new_error = NULL; if (asprintf (&new_error, "Value error for key 'annotations': %s", *err ? *err : "null") < 0) new_error = strdup ("error allocating memory"); free (*err); *err = new_error; return NULL; } } } while (0); if (ret->oci_version == NULL) { if (asprintf (err, "Required field '%s' not present", "ociVersion") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->id == NULL) { if (asprintf (err, "Required field '%s' not present", "id") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->status == NULL) { if (asprintf (err, "Required field '%s' not present", "status") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->bundle == NULL) { if (asprintf (err, "Required field '%s' not present", "bundle") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "ociVersion") && strcmp (tree->u.object.keys[i], "id") && strcmp (tree->u.object.keys[i], "status") && strcmp (tree->u.object.keys[i], "pid") && strcmp (tree->u.object.keys[i], "bundle") && strcmp (tree->u.object.keys[i], "annotations")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_state_schema (runtime_spec_schema_state_schema *ptr) { if (ptr == NULL) return; free (ptr->oci_version); ptr->oci_version = NULL; free (ptr->id); ptr->id = NULL; free (ptr->status); ptr->status = NULL; free (ptr->bundle); ptr->bundle = NULL; free_json_map_string_string (ptr->annotations); ptr->annotations = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_state_schema (yajl_gen g, const runtime_spec_schema_state_schema *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->oci_version != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("ociVersion"), 10 /* strlen ("ociVersion") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->oci_version != NULL) str = ptr->oci_version; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->id != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("id"), 2 /* strlen ("id") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->id != NULL) str = ptr->id; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->status != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("status"), 6 /* strlen ("status") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->status != NULL) str = ptr->status; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->pid_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("pid"), 3 /* strlen ("pid") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->pid) num = (long long int)ptr->pid; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->bundle != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("bundle"), 6 /* strlen ("bundle") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->bundle != NULL) str = ptr->bundle; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->annotations != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("annotations"), 11 /* strlen ("annotations") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_json_map_string_string (g, ptr ? ptr->annotations : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } runtime_spec_schema_state_schema * runtime_spec_schema_state_schema_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { runtime_spec_schema_state_schema *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = runtime_spec_schema_state_schema_parse_data (content, ctx, err);return ptr; } runtime_spec_schema_state_schema * runtime_spec_schema_state_schema_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {runtime_spec_schema_state_schema *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = runtime_spec_schema_state_schema_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) runtime_spec_schema_state_schema * runtime_spec_schema_state_schema_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { runtime_spec_schema_state_schema *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_runtime_spec_schema_state_schema (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * runtime_spec_schema_state_schema_generate_json (const runtime_spec_schema_state_schema *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_runtime_spec_schema_state_schema (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_features_linux.c0000644000000000000000000016752014656670200024604 0ustar0000000000000000/* Generated from features-linux.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_features_linux.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_features_linux_cgroup *, free_runtime_spec_schema_features_linux_cgroup) runtime_spec_schema_features_linux_cgroup * make_runtime_spec_schema_features_linux_cgroup (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_features_linux_cgroup) runtime_spec_schema_features_linux_cgroup *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "v1", yajl_t_true); if (val != NULL) { ret->v1 = YAJL_IS_TRUE(val); ret->v1_present = 1; } else { val = get_val (tree, "v1", yajl_t_false); if (val != NULL) { ret->v1 = 0; ret->v1_present = 1; } } } while (0); do { yajl_val val = get_val (tree, "v2", yajl_t_true); if (val != NULL) { ret->v2 = YAJL_IS_TRUE(val); ret->v2_present = 1; } else { val = get_val (tree, "v2", yajl_t_false); if (val != NULL) { ret->v2 = 0; ret->v2_present = 1; } } } while (0); do { yajl_val val = get_val (tree, "systemd", yajl_t_true); if (val != NULL) { ret->systemd = YAJL_IS_TRUE(val); ret->systemd_present = 1; } else { val = get_val (tree, "systemd", yajl_t_false); if (val != NULL) { ret->systemd = 0; ret->systemd_present = 1; } } } while (0); do { yajl_val val = get_val (tree, "systemdUser", yajl_t_true); if (val != NULL) { ret->systemd_user = YAJL_IS_TRUE(val); ret->systemd_user_present = 1; } else { val = get_val (tree, "systemdUser", yajl_t_false); if (val != NULL) { ret->systemd_user = 0; ret->systemd_user_present = 1; } } } while (0); do { yajl_val val = get_val (tree, "rdma", yajl_t_true); if (val != NULL) { ret->rdma = YAJL_IS_TRUE(val); ret->rdma_present = 1; } else { val = get_val (tree, "rdma", yajl_t_false); if (val != NULL) { ret->rdma = 0; ret->rdma_present = 1; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "v1") && strcmp (tree->u.object.keys[i], "v2") && strcmp (tree->u.object.keys[i], "systemd") && strcmp (tree->u.object.keys[i], "systemdUser") && strcmp (tree->u.object.keys[i], "rdma")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_features_linux_cgroup (runtime_spec_schema_features_linux_cgroup *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_features_linux_cgroup (yajl_gen g, const runtime_spec_schema_features_linux_cgroup *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->v1_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("v1"), 2 /* strlen ("v1") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->v1) b = ptr->v1; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->v2_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("v2"), 2 /* strlen ("v2") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->v2) b = ptr->v2; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->systemd_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("systemd"), 7 /* strlen ("systemd") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->systemd) b = ptr->systemd; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->systemd_user_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("systemdUser"), 11 /* strlen ("systemdUser") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->systemd_user) b = ptr->systemd_user; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->rdma_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("rdma"), 4 /* strlen ("rdma") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->rdma) b = ptr->rdma; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_features_linux_seccomp *, free_runtime_spec_schema_features_linux_seccomp) runtime_spec_schema_features_linux_seccomp * make_runtime_spec_schema_features_linux_seccomp (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_features_linux_seccomp) runtime_spec_schema_features_linux_seccomp *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "enabled", yajl_t_true); if (val != NULL) { ret->enabled = YAJL_IS_TRUE(val); ret->enabled_present = 1; } else { val = get_val (tree, "enabled", yajl_t_false); if (val != NULL) { ret->enabled = 0; ret->enabled_present = 1; } } } while (0); do { yajl_val tmp = get_val (tree, "actions", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->actions_len = len; ret->actions = calloc (len + 1, sizeof (*ret->actions)); if (ret->actions == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->actions[i] = strdup (str ? str : ""); if (ret->actions[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "operators", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->operators_len = len; ret->operators = calloc (len + 1, sizeof (*ret->operators)); if (ret->operators == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->operators[i] = strdup (str ? str : ""); if (ret->operators[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "archs", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->archs_len = len; ret->archs = calloc (len + 1, sizeof (*ret->archs)); if (ret->archs == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->archs[i] = strdup (str ? str : ""); if (ret->archs[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "knownFlags", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->known_flags_len = len; ret->known_flags = calloc (len + 1, sizeof (*ret->known_flags)); if (ret->known_flags == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->known_flags[i] = strdup (str ? str : ""); if (ret->known_flags[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "supportedFlags", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->supported_flags_len = len; ret->supported_flags = calloc (len + 1, sizeof (*ret->supported_flags)); if (ret->supported_flags == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->supported_flags[i] = strdup (str ? str : ""); if (ret->supported_flags[i] == NULL) return NULL; } } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "enabled") && strcmp (tree->u.object.keys[i], "actions") && strcmp (tree->u.object.keys[i], "operators") && strcmp (tree->u.object.keys[i], "archs") && strcmp (tree->u.object.keys[i], "knownFlags") && strcmp (tree->u.object.keys[i], "supportedFlags")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_features_linux_seccomp (runtime_spec_schema_features_linux_seccomp *ptr) { if (ptr == NULL) return; if (ptr->actions != NULL) { size_t i; for (i = 0; i < ptr->actions_len; i++) { if (ptr->actions[i] != NULL) { free (ptr->actions[i]); ptr->actions[i] = NULL; } } free (ptr->actions); ptr->actions = NULL; } if (ptr->operators != NULL) { size_t i; for (i = 0; i < ptr->operators_len; i++) { if (ptr->operators[i] != NULL) { free (ptr->operators[i]); ptr->operators[i] = NULL; } } free (ptr->operators); ptr->operators = NULL; } if (ptr->archs != NULL) { size_t i; for (i = 0; i < ptr->archs_len; i++) { if (ptr->archs[i] != NULL) { free (ptr->archs[i]); ptr->archs[i] = NULL; } } free (ptr->archs); ptr->archs = NULL; } if (ptr->known_flags != NULL) { size_t i; for (i = 0; i < ptr->known_flags_len; i++) { if (ptr->known_flags[i] != NULL) { free (ptr->known_flags[i]); ptr->known_flags[i] = NULL; } } free (ptr->known_flags); ptr->known_flags = NULL; } if (ptr->supported_flags != NULL) { size_t i; for (i = 0; i < ptr->supported_flags_len; i++) { if (ptr->supported_flags[i] != NULL) { free (ptr->supported_flags[i]); ptr->supported_flags[i] = NULL; } } free (ptr->supported_flags); ptr->supported_flags = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_features_linux_seccomp (yajl_gen g, const runtime_spec_schema_features_linux_seccomp *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->enabled_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("enabled"), 7 /* strlen ("enabled") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->enabled) b = ptr->enabled; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->actions != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("actions"), 7 /* strlen ("actions") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->actions != NULL) len = ptr->actions_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->actions[i]), strlen (ptr->actions[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->operators != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("operators"), 9 /* strlen ("operators") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->operators != NULL) len = ptr->operators_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->operators[i]), strlen (ptr->operators[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->archs != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("archs"), 5 /* strlen ("archs") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->archs != NULL) len = ptr->archs_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->archs[i]), strlen (ptr->archs[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->known_flags != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("knownFlags"), 10 /* strlen ("knownFlags") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->known_flags != NULL) len = ptr->known_flags_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->known_flags[i]), strlen (ptr->known_flags[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->supported_flags != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("supportedFlags"), 14 /* strlen ("supportedFlags") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->supported_flags != NULL) len = ptr->supported_flags_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->supported_flags[i]), strlen (ptr->supported_flags[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_features_linux_apparmor *, free_runtime_spec_schema_features_linux_apparmor) runtime_spec_schema_features_linux_apparmor * make_runtime_spec_schema_features_linux_apparmor (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_features_linux_apparmor) runtime_spec_schema_features_linux_apparmor *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "enabled", yajl_t_true); if (val != NULL) { ret->enabled = YAJL_IS_TRUE(val); ret->enabled_present = 1; } else { val = get_val (tree, "enabled", yajl_t_false); if (val != NULL) { ret->enabled = 0; ret->enabled_present = 1; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "enabled")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_features_linux_apparmor (runtime_spec_schema_features_linux_apparmor *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_features_linux_apparmor (yajl_gen g, const runtime_spec_schema_features_linux_apparmor *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->enabled_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("enabled"), 7 /* strlen ("enabled") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->enabled) b = ptr->enabled; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_features_linux_selinux *, free_runtime_spec_schema_features_linux_selinux) runtime_spec_schema_features_linux_selinux * make_runtime_spec_schema_features_linux_selinux (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_features_linux_selinux) runtime_spec_schema_features_linux_selinux *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "enabled", yajl_t_true); if (val != NULL) { ret->enabled = YAJL_IS_TRUE(val); ret->enabled_present = 1; } else { val = get_val (tree, "enabled", yajl_t_false); if (val != NULL) { ret->enabled = 0; ret->enabled_present = 1; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "enabled")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_features_linux_selinux (runtime_spec_schema_features_linux_selinux *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_features_linux_selinux (yajl_gen g, const runtime_spec_schema_features_linux_selinux *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->enabled_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("enabled"), 7 /* strlen ("enabled") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->enabled) b = ptr->enabled; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_features_linux_intel_rdt *, free_runtime_spec_schema_features_linux_intel_rdt) runtime_spec_schema_features_linux_intel_rdt * make_runtime_spec_schema_features_linux_intel_rdt (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_features_linux_intel_rdt) runtime_spec_schema_features_linux_intel_rdt *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "enabled", yajl_t_true); if (val != NULL) { ret->enabled = YAJL_IS_TRUE(val); ret->enabled_present = 1; } else { val = get_val (tree, "enabled", yajl_t_false); if (val != NULL) { ret->enabled = 0; ret->enabled_present = 1; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "enabled")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_features_linux_intel_rdt (runtime_spec_schema_features_linux_intel_rdt *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_features_linux_intel_rdt (yajl_gen g, const runtime_spec_schema_features_linux_intel_rdt *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->enabled_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("enabled"), 7 /* strlen ("enabled") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->enabled) b = ptr->enabled; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_features_linux_mount_extensions_idmap *, free_runtime_spec_schema_features_linux_mount_extensions_idmap) runtime_spec_schema_features_linux_mount_extensions_idmap * make_runtime_spec_schema_features_linux_mount_extensions_idmap (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_features_linux_mount_extensions_idmap) runtime_spec_schema_features_linux_mount_extensions_idmap *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "enabled", yajl_t_true); if (val != NULL) { ret->enabled = YAJL_IS_TRUE(val); ret->enabled_present = 1; } else { val = get_val (tree, "enabled", yajl_t_false); if (val != NULL) { ret->enabled = 0; ret->enabled_present = 1; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "enabled")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_features_linux_mount_extensions_idmap (runtime_spec_schema_features_linux_mount_extensions_idmap *ptr) { if (ptr == NULL) return; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_features_linux_mount_extensions_idmap (yajl_gen g, const runtime_spec_schema_features_linux_mount_extensions_idmap *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->enabled_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("enabled"), 7 /* strlen ("enabled") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->enabled) b = ptr->enabled; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_features_linux_mount_extensions *, free_runtime_spec_schema_features_linux_mount_extensions) runtime_spec_schema_features_linux_mount_extensions * make_runtime_spec_schema_features_linux_mount_extensions (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_features_linux_mount_extensions) runtime_spec_schema_features_linux_mount_extensions *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; ret->idmap = make_runtime_spec_schema_features_linux_mount_extensions_idmap (get_val (tree, "idmap", yajl_t_object), ctx, err); if (ret->idmap == NULL && *err != 0) return NULL; if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "idmap")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_features_linux_mount_extensions (runtime_spec_schema_features_linux_mount_extensions *ptr) { if (ptr == NULL) return; if (ptr->idmap != NULL) { free_runtime_spec_schema_features_linux_mount_extensions_idmap (ptr->idmap); ptr->idmap = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_features_linux_mount_extensions (yajl_gen g, const runtime_spec_schema_features_linux_mount_extensions *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->idmap != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("idmap"), 5 /* strlen ("idmap") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_features_linux_mount_extensions_idmap (g, ptr != NULL ? ptr->idmap : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (runtime_spec_schema_features_linux *, free_runtime_spec_schema_features_linux) runtime_spec_schema_features_linux * make_runtime_spec_schema_features_linux (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_features_linux) runtime_spec_schema_features_linux *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "namespaces", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->namespaces_len = len; ret->namespaces = calloc (len + 1, sizeof (*ret->namespaces)); if (ret->namespaces == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->namespaces[i] = strdup (str ? str : ""); if (ret->namespaces[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "capabilities", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->capabilities_len = len; ret->capabilities = calloc (len + 1, sizeof (*ret->capabilities)); if (ret->capabilities == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->capabilities[i] = strdup (str ? str : ""); if (ret->capabilities[i] == NULL) return NULL; } } } } while (0); ret->cgroup = make_runtime_spec_schema_features_linux_cgroup (get_val (tree, "cgroup", yajl_t_object), ctx, err); if (ret->cgroup == NULL && *err != 0) return NULL; ret->seccomp = make_runtime_spec_schema_features_linux_seccomp (get_val (tree, "seccomp", yajl_t_object), ctx, err); if (ret->seccomp == NULL && *err != 0) return NULL; ret->apparmor = make_runtime_spec_schema_features_linux_apparmor (get_val (tree, "apparmor", yajl_t_object), ctx, err); if (ret->apparmor == NULL && *err != 0) return NULL; ret->selinux = make_runtime_spec_schema_features_linux_selinux (get_val (tree, "selinux", yajl_t_object), ctx, err); if (ret->selinux == NULL && *err != 0) return NULL; ret->intel_rdt = make_runtime_spec_schema_features_linux_intel_rdt (get_val (tree, "intelRdt", yajl_t_object), ctx, err); if (ret->intel_rdt == NULL && *err != 0) return NULL; ret->mount_extensions = make_runtime_spec_schema_features_linux_mount_extensions (get_val (tree, "mountExtensions", yajl_t_object), ctx, err); if (ret->mount_extensions == NULL && *err != 0) return NULL; if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "namespaces") && strcmp (tree->u.object.keys[i], "capabilities") && strcmp (tree->u.object.keys[i], "cgroup") && strcmp (tree->u.object.keys[i], "seccomp") && strcmp (tree->u.object.keys[i], "apparmor") && strcmp (tree->u.object.keys[i], "selinux") && strcmp (tree->u.object.keys[i], "intelRdt") && strcmp (tree->u.object.keys[i], "mountExtensions")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_features_linux (runtime_spec_schema_features_linux *ptr) { if (ptr == NULL) return; if (ptr->namespaces != NULL) { size_t i; for (i = 0; i < ptr->namespaces_len; i++) { if (ptr->namespaces[i] != NULL) { free (ptr->namespaces[i]); ptr->namespaces[i] = NULL; } } free (ptr->namespaces); ptr->namespaces = NULL; } if (ptr->capabilities != NULL) { size_t i; for (i = 0; i < ptr->capabilities_len; i++) { if (ptr->capabilities[i] != NULL) { free (ptr->capabilities[i]); ptr->capabilities[i] = NULL; } } free (ptr->capabilities); ptr->capabilities = NULL; } if (ptr->cgroup != NULL) { free_runtime_spec_schema_features_linux_cgroup (ptr->cgroup); ptr->cgroup = NULL; } if (ptr->seccomp != NULL) { free_runtime_spec_schema_features_linux_seccomp (ptr->seccomp); ptr->seccomp = NULL; } if (ptr->apparmor != NULL) { free_runtime_spec_schema_features_linux_apparmor (ptr->apparmor); ptr->apparmor = NULL; } if (ptr->selinux != NULL) { free_runtime_spec_schema_features_linux_selinux (ptr->selinux); ptr->selinux = NULL; } if (ptr->intel_rdt != NULL) { free_runtime_spec_schema_features_linux_intel_rdt (ptr->intel_rdt); ptr->intel_rdt = NULL; } if (ptr->mount_extensions != NULL) { free_runtime_spec_schema_features_linux_mount_extensions (ptr->mount_extensions); ptr->mount_extensions = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_features_linux (yajl_gen g, const runtime_spec_schema_features_linux *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->namespaces != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("namespaces"), 10 /* strlen ("namespaces") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->namespaces != NULL) len = ptr->namespaces_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->namespaces[i]), strlen (ptr->namespaces[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->capabilities != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("capabilities"), 12 /* strlen ("capabilities") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->capabilities != NULL) len = ptr->capabilities_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->capabilities[i]), strlen (ptr->capabilities[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->cgroup != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("cgroup"), 6 /* strlen ("cgroup") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_features_linux_cgroup (g, ptr != NULL ? ptr->cgroup : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->seccomp != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("seccomp"), 7 /* strlen ("seccomp") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_features_linux_seccomp (g, ptr != NULL ? ptr->seccomp : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->apparmor != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("apparmor"), 8 /* strlen ("apparmor") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_features_linux_apparmor (g, ptr != NULL ? ptr->apparmor : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->selinux != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("selinux"), 7 /* strlen ("selinux") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_features_linux_selinux (g, ptr != NULL ? ptr->selinux : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->intel_rdt != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("intelRdt"), 8 /* strlen ("intelRdt") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_features_linux_intel_rdt (g, ptr != NULL ? ptr->intel_rdt : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->mount_extensions != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("mountExtensions"), 15 /* strlen ("mountExtensions") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_features_linux_mount_extensions (g, ptr != NULL ? ptr->mount_extensions : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } crun-1.16.1/libocispec/src/ocispec/runtime_spec_schema_features_schema.c0000644000000000000000000004676114656670200024710 0ustar0000000000000000/* Generated from features-schema.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/runtime_spec_schema_features_schema.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (runtime_spec_schema_features_schema *, free_runtime_spec_schema_features_schema) runtime_spec_schema_features_schema * make_runtime_spec_schema_features_schema (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_runtime_spec_schema_features_schema) runtime_spec_schema_features_schema *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "ociVersionMin", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->oci_version_min = strdup (str ? str : ""); if (ret->oci_version_min == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "ociVersionMax", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->oci_version_max = strdup (str ? str : ""); if (ret->oci_version_max == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "hooks", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->hooks_len = len; ret->hooks = calloc (len + 1, sizeof (*ret->hooks)); if (ret->hooks == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->hooks[i] = strdup (str ? str : ""); if (ret->hooks[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "mountOptions", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->mount_options_len = len; ret->mount_options = calloc (len + 1, sizeof (*ret->mount_options)); if (ret->mount_options == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->mount_options[i] = strdup (str ? str : ""); if (ret->mount_options[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "annotations", yajl_t_object); if (tmp != NULL) { ret->annotations = make_json_map_string_string (tmp, ctx, err); if (ret->annotations == NULL) { char *new_error = NULL; if (asprintf (&new_error, "Value error for key 'annotations': %s", *err ? *err : "null") < 0) new_error = strdup ("error allocating memory"); free (*err); *err = new_error; return NULL; } } } while (0); do { yajl_val tmp = get_val (tree, "potentiallyUnsafeConfigAnnotations", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->potentially_unsafe_config_annotations_len = len; ret->potentially_unsafe_config_annotations = calloc (len + 1, sizeof (*ret->potentially_unsafe_config_annotations)); if (ret->potentially_unsafe_config_annotations == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->potentially_unsafe_config_annotations[i] = strdup (str ? str : ""); if (ret->potentially_unsafe_config_annotations[i] == NULL) return NULL; } } } } while (0); ret->linux = make_runtime_spec_schema_features_linux (get_val (tree, "linux", yajl_t_object), ctx, err); if (ret->linux == NULL && *err != 0) return NULL; if (ret->oci_version_min == NULL) { if (asprintf (err, "Required field '%s' not present", "ociVersionMin") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->oci_version_max == NULL) { if (asprintf (err, "Required field '%s' not present", "ociVersionMax") < 0) *err = strdup ("error allocating memory"); return NULL; } if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "ociVersionMin") && strcmp (tree->u.object.keys[i], "ociVersionMax") && strcmp (tree->u.object.keys[i], "hooks") && strcmp (tree->u.object.keys[i], "mountOptions") && strcmp (tree->u.object.keys[i], "annotations") && strcmp (tree->u.object.keys[i], "potentiallyUnsafeConfigAnnotations") && strcmp (tree->u.object.keys[i], "linux")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_runtime_spec_schema_features_schema (runtime_spec_schema_features_schema *ptr) { if (ptr == NULL) return; free (ptr->oci_version_min); ptr->oci_version_min = NULL; free (ptr->oci_version_max); ptr->oci_version_max = NULL; if (ptr->hooks != NULL) { size_t i; for (i = 0; i < ptr->hooks_len; i++) { if (ptr->hooks[i] != NULL) { free (ptr->hooks[i]); ptr->hooks[i] = NULL; } } free (ptr->hooks); ptr->hooks = NULL; } if (ptr->mount_options != NULL) { size_t i; for (i = 0; i < ptr->mount_options_len; i++) { if (ptr->mount_options[i] != NULL) { free (ptr->mount_options[i]); ptr->mount_options[i] = NULL; } } free (ptr->mount_options); ptr->mount_options = NULL; } free_json_map_string_string (ptr->annotations); ptr->annotations = NULL; if (ptr->potentially_unsafe_config_annotations != NULL) { size_t i; for (i = 0; i < ptr->potentially_unsafe_config_annotations_len; i++) { if (ptr->potentially_unsafe_config_annotations[i] != NULL) { free (ptr->potentially_unsafe_config_annotations[i]); ptr->potentially_unsafe_config_annotations[i] = NULL; } } free (ptr->potentially_unsafe_config_annotations); ptr->potentially_unsafe_config_annotations = NULL; } if (ptr->linux != NULL) { free_runtime_spec_schema_features_linux (ptr->linux); ptr->linux = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_runtime_spec_schema_features_schema (yajl_gen g, const runtime_spec_schema_features_schema *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->oci_version_min != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("ociVersionMin"), 13 /* strlen ("ociVersionMin") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->oci_version_min != NULL) str = ptr->oci_version_min; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->oci_version_max != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("ociVersionMax"), 13 /* strlen ("ociVersionMax") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->oci_version_max != NULL) str = ptr->oci_version_max; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->hooks != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("hooks"), 5 /* strlen ("hooks") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->hooks != NULL) len = ptr->hooks_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->hooks[i]), strlen (ptr->hooks[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->mount_options != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("mountOptions"), 12 /* strlen ("mountOptions") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->mount_options != NULL) len = ptr->mount_options_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->mount_options[i]), strlen (ptr->mount_options[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->annotations != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("annotations"), 11 /* strlen ("annotations") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_json_map_string_string (g, ptr ? ptr->annotations : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->potentially_unsafe_config_annotations != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("potentiallyUnsafeConfigAnnotations"), 34 /* strlen ("potentiallyUnsafeConfigAnnotations") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->potentially_unsafe_config_annotations != NULL) len = ptr->potentially_unsafe_config_annotations_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->potentially_unsafe_config_annotations[i]), strlen (ptr->potentially_unsafe_config_annotations[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->linux != NULL)) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("linux"), 5 /* strlen ("linux") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_runtime_spec_schema_features_linux (g, ptr != NULL ? ptr->linux : NULL, ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } runtime_spec_schema_features_schema * runtime_spec_schema_features_schema_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { runtime_spec_schema_features_schema *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = runtime_spec_schema_features_schema_parse_data (content, ctx, err);return ptr; } runtime_spec_schema_features_schema * runtime_spec_schema_features_schema_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {runtime_spec_schema_features_schema *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = runtime_spec_schema_features_schema_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) runtime_spec_schema_features_schema * runtime_spec_schema_features_schema_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { runtime_spec_schema_features_schema *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_runtime_spec_schema_features_schema (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * runtime_spec_schema_features_schema_generate_json (const runtime_spec_schema_features_schema *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_runtime_spec_schema_features_schema (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/image_manifest_items_image_manifest_items_schema.c0000644000000000000000000003651014656670200027366 0ustar0000000000000000/* Generated from image-manifest-items-schema.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/image_manifest_items_image_manifest_items_schema.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (image_manifest_items_image_manifest_items_schema_element *, free_image_manifest_items_image_manifest_items_schema_element) image_manifest_items_image_manifest_items_schema_element * make_image_manifest_items_image_manifest_items_schema_element (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_manifest_items_image_manifest_items_schema_element) image_manifest_items_image_manifest_items_schema_element *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "Config", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->config = strdup (str ? str : ""); if (ret->config == NULL) return NULL; } } while (0); do { yajl_val tmp = get_val (tree, "Layers", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->layers_len = len; ret->layers = calloc (len + 1, sizeof (*ret->layers)); if (ret->layers == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->layers[i] = strdup (str ? str : ""); if (ret->layers[i] == NULL) return NULL; } } } } while (0); do { yajl_val tmp = get_val (tree, "RepoTags", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->repo_tags_len = len; ret->repo_tags = calloc (len + 1, sizeof (*ret->repo_tags)); if (ret->repo_tags == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->repo_tags[i] = strdup (str ? str : ""); if (ret->repo_tags[i] == NULL) return NULL; } } } } while (0); do { yajl_val val = get_val (tree, "Parent", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->parent = strdup (str ? str : ""); if (ret->parent == NULL) return NULL; } } while (0); if (ret->config == NULL) { if (asprintf (err, "Required field '%s' not present", "Config") < 0) *err = strdup ("error allocating memory"); return NULL; } if (ret->layers == NULL) { if (asprintf (err, "Required field '%s' not present", "Layers") < 0) *err = strdup ("error allocating memory"); return NULL; } return move_ptr (ret); } void free_image_manifest_items_image_manifest_items_schema_element (image_manifest_items_image_manifest_items_schema_element *ptr) { if (ptr == NULL) return; free (ptr->config); ptr->config = NULL; if (ptr->layers != NULL) { size_t i; for (i = 0; i < ptr->layers_len; i++) { if (ptr->layers[i] != NULL) { free (ptr->layers[i]); ptr->layers[i] = NULL; } } free (ptr->layers); ptr->layers = NULL; } if (ptr->repo_tags != NULL) { size_t i; for (i = 0; i < ptr->repo_tags_len; i++) { if (ptr->repo_tags[i] != NULL) { free (ptr->repo_tags[i]); ptr->repo_tags[i] = NULL; } } free (ptr->repo_tags); ptr->repo_tags = NULL; } free (ptr->parent); ptr->parent = NULL; free (ptr); } yajl_gen_status gen_image_manifest_items_image_manifest_items_schema_element (yajl_gen g, const image_manifest_items_image_manifest_items_schema_element *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->config != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("Config"), 6 /* strlen ("Config") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->config != NULL) str = ptr->config; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->layers != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("Layers"), 6 /* strlen ("Layers") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->layers != NULL) len = ptr->layers_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->layers[i]), strlen (ptr->layers[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->repo_tags != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("RepoTags"), 8 /* strlen ("RepoTags") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->repo_tags != NULL) len = ptr->repo_tags_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->repo_tags[i]), strlen (ptr->repo_tags[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->parent != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("Parent"), 6 /* strlen ("Parent") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->parent != NULL) str = ptr->parent; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (image_manifest_items_image_manifest_items_schema_container *, free_image_manifest_items_image_manifest_items_schema_container) image_manifest_items_image_manifest_items_schema_container *make_image_manifest_items_image_manifest_items_schema_container (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_image_manifest_items_image_manifest_items_schema_container) image_manifest_items_image_manifest_items_schema_container *ptr = NULL; size_t i, alen; (void) ctx; if (tree == NULL || err == NULL || YAJL_GET_ARRAY (tree) == NULL) return NULL; *err = NULL; alen = YAJL_GET_ARRAY_NO_CHECK (tree)->len; if (alen == 0) return NULL; ptr = calloc (1, sizeof (image_manifest_items_image_manifest_items_schema_container)); if (ptr == NULL) return NULL; ptr->items = calloc (alen + 1, sizeof(*ptr->items)); if (ptr->items == NULL) return NULL; ptr->len = alen; for (i = 0; i < alen; i++) { yajl_val work = YAJL_GET_ARRAY_NO_CHECK (tree)->values[i]; ptr->items[i] = make_image_manifest_items_image_manifest_items_schema_element (work, ctx, err); if (ptr->items[i] == NULL) return NULL; } return move_ptr(ptr); } void free_image_manifest_items_image_manifest_items_schema_container (image_manifest_items_image_manifest_items_schema_container *ptr) { size_t i; if (ptr == NULL) return; for (i = 0; i < ptr->len; i++) { free_image_manifest_items_image_manifest_items_schema_element (ptr->items[i]); ptr->items[i] = NULL; } free (ptr->items); ptr->items = NULL; free (ptr); } yajl_gen_status gen_image_manifest_items_image_manifest_items_schema_container (yajl_gen g, const image_manifest_items_image_manifest_items_schema_container *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat; size_t i; if (ptr == NULL) return yajl_gen_status_ok; *err = NULL; stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < ptr->len; i++) { { stat = gen_image_manifest_items_image_manifest_items_schema_element (g, ptr->items[i], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } } stat = yajl_gen_array_close ((yajl_gen) g); if (ptr->len > 0 && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } image_manifest_items_image_manifest_items_schema_container * image_manifest_items_image_manifest_items_schema_container_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { image_manifest_items_image_manifest_items_schema_container *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = image_manifest_items_image_manifest_items_schema_container_parse_data (content, ctx, err);return ptr; } image_manifest_items_image_manifest_items_schema_container * image_manifest_items_image_manifest_items_schema_container_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {image_manifest_items_image_manifest_items_schema_container *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = image_manifest_items_image_manifest_items_schema_container_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) image_manifest_items_image_manifest_items_schema_container * image_manifest_items_image_manifest_items_schema_container_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { image_manifest_items_image_manifest_items_schema_container *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_image_manifest_items_image_manifest_items_schema_container (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * image_manifest_items_image_manifest_items_schema_container_generate_json (const image_manifest_items_image_manifest_items_schema_container *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_image_manifest_items_image_manifest_items_schema_container (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/basic_test_double_array_item.c0000644000000000000000000002375714656670200023343 0ustar0000000000000000/* Generated from test_double_array_item.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/basic_test_double_array_item.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (basic_test_double_array_item *, free_basic_test_double_array_item) basic_test_double_array_item * make_basic_test_double_array_item (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_basic_test_double_array_item) basic_test_double_array_item *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "item1", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->item1 = strdup (str ? str : ""); if (ret->item1 == NULL) return NULL; } } while (0); do { yajl_val val = get_val (tree, "item2", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int32 (YAJL_GET_NUMBER (val), &ret->item2); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int32' for key 'item2': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->item2_present = 1; } } while (0); do { yajl_val val = get_val (tree, "item3", yajl_t_true); if (val != NULL) { ret->item3 = YAJL_IS_TRUE(val); ret->item3_present = 1; } else { val = get_val (tree, "item3", yajl_t_false); if (val != NULL) { ret->item3 = 0; ret->item3_present = 1; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "item1") && strcmp (tree->u.object.keys[i], "item2") && strcmp (tree->u.object.keys[i], "item3")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_basic_test_double_array_item (basic_test_double_array_item *ptr) { if (ptr == NULL) return; free (ptr->item1); ptr->item1 = NULL; yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_basic_test_double_array_item (yajl_gen g, const basic_test_double_array_item *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->item1 != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("item1"), 5 /* strlen ("item1") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->item1 != NULL) str = ptr->item1; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->item2_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("item2"), 5 /* strlen ("item2") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->item2) num = (long long int)ptr->item2; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->item3_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("item3"), 5 /* strlen ("item3") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->item3) b = ptr->item3; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } basic_test_double_array_item * basic_test_double_array_item_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { basic_test_double_array_item *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = basic_test_double_array_item_parse_data (content, ctx, err);return ptr; } basic_test_double_array_item * basic_test_double_array_item_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {basic_test_double_array_item *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = basic_test_double_array_item_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) basic_test_double_array_item * basic_test_double_array_item_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { basic_test_double_array_item *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_basic_test_double_array_item (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * basic_test_double_array_item_generate_json (const basic_test_double_array_item *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_basic_test_double_array_item (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/basic_test_double_array.c0000644000000000000000000006777514656670200022335 0ustar0000000000000000/* Generated from test_double_array.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/basic_test_double_array.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (basic_test_double_array_objectarrays_element *, free_basic_test_double_array_objectarrays_element) basic_test_double_array_objectarrays_element * make_basic_test_double_array_objectarrays_element (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_basic_test_double_array_objectarrays_element) basic_test_double_array_objectarrays_element *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "first", yajl_t_true); if (val != NULL) { ret->first = YAJL_IS_TRUE(val); ret->first_present = 1; } else { val = get_val (tree, "first", yajl_t_false); if (val != NULL) { ret->first = 0; ret->first_present = 1; } } } while (0); do { yajl_val val = get_val (tree, "second", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->second = strdup (str ? str : ""); if (ret->second == NULL) return NULL; } } while (0); return move_ptr (ret); } void free_basic_test_double_array_objectarrays_element (basic_test_double_array_objectarrays_element *ptr) { if (ptr == NULL) return; free (ptr->second); ptr->second = NULL; free (ptr); } yajl_gen_status gen_basic_test_double_array_objectarrays_element (yajl_gen g, const basic_test_double_array_objectarrays_element *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->first_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("first"), 5 /* strlen ("first") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->first) b = ptr->first; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->second != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("second"), 6 /* strlen ("second") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->second != NULL) str = ptr->second; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (basic_test_double_array *, free_basic_test_double_array) basic_test_double_array * make_basic_test_double_array (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_basic_test_double_array) basic_test_double_array *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val tmp = get_val (tree, "strarrays", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->strarrays_len = len; ret->strarrays = calloc (len + 1, sizeof (*ret->strarrays)); if (ret->strarrays == NULL) return NULL; ret->strarrays_item_lens = calloc ( len + 1, sizeof (size_t)); if (ret->strarrays_item_lens == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val *items = YAJL_GET_ARRAY_NO_CHECK(values[i])->values; ret->strarrays[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(values[i])->len + 1, sizeof (**ret->strarrays)); if (ret->strarrays[i] == NULL) return NULL; size_t j; for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(values[i])->len; j++) { yajl_val val = items[j]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->strarrays[i][j] = strdup (str ? str : ""); if (ret->strarrays[i][j] == NULL) return NULL; } ret->strarrays_item_lens[i] += 1; }; } } } while (0); do { yajl_val tmp = get_val (tree, "intarrays", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->intarrays_len = len; ret->intarrays = calloc (len + 1, sizeof (*ret->intarrays)); if (ret->intarrays == NULL) return NULL; ret->intarrays_item_lens = calloc ( len + 1, sizeof (size_t)); if (ret->intarrays_item_lens == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val *items = YAJL_GET_ARRAY_NO_CHECK(values[i])->values; ret->intarrays[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(values[i])->len + 1, sizeof (**ret->intarrays)); if (ret->intarrays[i] == NULL) return NULL; size_t j; for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(values[i])->len; j++) { yajl_val val = items[j]; if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int32 (YAJL_GET_NUMBER (val), &ret->intarrays[i][j]); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int32' for key 'intarrays': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } } ret->intarrays_item_lens[i] += 1; }; } } } while (0); do { yajl_val tmp = get_val (tree, "boolarrays", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->boolarrays_len = len; ret->boolarrays = calloc (len + 1, sizeof (*ret->boolarrays)); if (ret->boolarrays == NULL) return NULL; ret->boolarrays_item_lens = calloc ( len + 1, sizeof (size_t)); if (ret->boolarrays_item_lens == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val *items = YAJL_GET_ARRAY_NO_CHECK(values[i])->values; ret->boolarrays[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(values[i])->len + 1, sizeof (**ret->boolarrays)); if (ret->boolarrays[i] == NULL) return NULL; size_t j; for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(values[i])->len; j++) { yajl_val val = items[j]; if (val != NULL) { ret->boolarrays[i][j] = YAJL_IS_TRUE(val); } ret->boolarrays_item_lens[i] += 1; }; } } } while (0); do { yajl_val tmp = get_val (tree, "objectarrays", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->objectarrays_len = len; ret->objectarrays = calloc (len + 1, sizeof (*ret->objectarrays)); if (ret->objectarrays == NULL) return NULL; ret->objectarrays_item_lens = calloc ( len + 1, sizeof (size_t)); if (ret->objectarrays_item_lens == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; size_t j; ret->objectarrays[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(val)->len + 1, sizeof (**ret->objectarrays)); if (ret->objectarrays[i] == NULL) return NULL; yajl_val *items = YAJL_GET_ARRAY_NO_CHECK(val)->values; for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(val)->len; j++) { ret->objectarrays[i][j] = make_basic_test_double_array_objectarrays_element (items[j], ctx, err); if (ret->objectarrays[i][j] == NULL) return NULL; ret->objectarrays_item_lens[i] += 1; }; } } } while (0); do { yajl_val tmp = get_val (tree, "refobjarrays", yajl_t_array); if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL) { size_t i; size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len; yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values; ret->refobjarrays_len = len; ret->refobjarrays = calloc (len + 1, sizeof (*ret->refobjarrays)); if (ret->refobjarrays == NULL) return NULL; ret->refobjarrays_item_lens = calloc ( len + 1, sizeof (size_t)); if (ret->refobjarrays_item_lens == NULL) return NULL; for (i = 0; i < len; i++) { yajl_val val = values[i]; size_t j; ret->refobjarrays[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(val)->len + 1, sizeof (**ret->refobjarrays)); if (ret->refobjarrays[i] == NULL) return NULL; yajl_val *items = YAJL_GET_ARRAY_NO_CHECK(val)->values; for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(val)->len; j++) { ret->refobjarrays[i][j] = make_basic_test_double_array_item (items[j], ctx, err); if (ret->refobjarrays[i][j] == NULL) return NULL; ret->refobjarrays_item_lens[i] += 1; }; } } } while (0); if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {if (strcmp (tree->u.object.keys[i], "strarrays") && strcmp (tree->u.object.keys[i], "intarrays") && strcmp (tree->u.object.keys[i], "boolarrays") && strcmp (tree->u.object.keys[i], "objectarrays") && strcmp (tree->u.object.keys[i], "refobjarrays")){ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } return move_ptr (ret); } void free_basic_test_double_array (basic_test_double_array *ptr) { if (ptr == NULL) return; if (ptr->strarrays != NULL) { size_t i; for (i = 0; i < ptr->strarrays_len; i++) { size_t j; for (j = 0; j < ptr->strarrays_item_lens[i]; j++) { free (ptr->strarrays[i][j]); ptr->strarrays[i][j] = NULL; } if (ptr->strarrays[i] != NULL) { free (ptr->strarrays[i]); ptr->strarrays[i] = NULL; } } free (ptr->strarrays_item_lens); ptr->strarrays_item_lens = NULL; free (ptr->strarrays); ptr->strarrays = NULL; } { size_t i; for (i = 0; i < ptr->intarrays_len; i++) { free (ptr->intarrays[i]); ptr->intarrays[i] = NULL; } free (ptr->intarrays_item_lens); ptr->intarrays_item_lens = NULL; free (ptr->intarrays); ptr->intarrays = NULL; } { size_t i; for (i = 0; i < ptr->boolarrays_len; i++) { free (ptr->boolarrays[i]); ptr->boolarrays[i] = NULL; } free (ptr->boolarrays_item_lens); ptr->boolarrays_item_lens = NULL; free (ptr->boolarrays); ptr->boolarrays = NULL; } if (ptr->objectarrays != NULL) { size_t i; for (i = 0; i < ptr->objectarrays_len; i++) { size_t j; for (j = 0; j < ptr->objectarrays_item_lens[i]; j++) { free_basic_test_double_array_objectarrays_element (ptr->objectarrays[i][j]); ptr->objectarrays[i][j] = NULL; } free (ptr->objectarrays[i]); ptr->objectarrays[i] = NULL; } free (ptr->objectarrays_item_lens); ptr->objectarrays_item_lens = NULL; free (ptr->objectarrays); ptr->objectarrays = NULL; } if (ptr->refobjarrays != NULL) { size_t i; for (i = 0; i < ptr->refobjarrays_len; i++) { size_t j; for (j = 0; j < ptr->refobjarrays_item_lens[i]; j++) { free_basic_test_double_array_item (ptr->refobjarrays[i][j]); ptr->refobjarrays[i][j] = NULL; } free (ptr->refobjarrays[i]); ptr->refobjarrays[i] = NULL; } free (ptr->refobjarrays_item_lens); ptr->refobjarrays_item_lens = NULL; free (ptr->refobjarrays); ptr->refobjarrays = NULL; } yajl_tree_free (ptr->_residual); ptr->_residual = NULL; free (ptr); } yajl_gen_status gen_basic_test_double_array (yajl_gen g, const basic_test_double_array *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->strarrays != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("strarrays"), 9 /* strlen ("strarrays") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->strarrays != NULL) len = ptr->strarrays_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); size_t j; for (j = 0; j < ptr->strarrays_item_lens[i]; j++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->strarrays[i][j]), strlen (ptr->strarrays[i][j])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->intarrays != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("intarrays"), 9 /* strlen ("intarrays") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->intarrays != NULL) len = ptr->intarrays_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); size_t j; for (j = 0; j < ptr->intarrays_item_lens[i]; j++) { stat = map_int (g, ptr->intarrays[i][j]); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->boolarrays != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("boolarrays"), 10 /* strlen ("boolarrays") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->boolarrays != NULL) len = ptr->boolarrays_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); size_t j; for (j = 0; j < ptr->boolarrays_item_lens[i]; j++) { stat = yajl_gen_bool ((yajl_gen)g, (int)(ptr->boolarrays[i][j])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); } stat = yajl_gen_array_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->objectarrays != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("objectarrays"), 12 /* strlen ("objectarrays") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->objectarrays != NULL) len = ptr->objectarrays_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); size_t j; for (j = 0; j < ptr->objectarrays_item_lens[i]; j++) { stat = gen_basic_test_double_array_objectarrays_element (g, ptr->objectarrays[i][j], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->refobjarrays != NULL)) { size_t len = 0, i; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("refobjarrays"), 12 /* strlen ("refobjarrays") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->refobjarrays != NULL) len = ptr->refobjarrays_len; if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); size_t j; for (j = 0; j < ptr->refobjarrays_item_lens[i]; j++) { stat = gen_basic_test_double_array_item (g, ptr->refobjarrays[i][j], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); } stat = yajl_gen_array_close ((yajl_gen) g); if (!len && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if (ptr != NULL && ptr->_residual != NULL) { stat = gen_yajl_object_residual (ptr->_residual, g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } basic_test_double_array * basic_test_double_array_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { basic_test_double_array *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = basic_test_double_array_parse_data (content, ctx, err);return ptr; } basic_test_double_array * basic_test_double_array_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {basic_test_double_array *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = basic_test_double_array_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) basic_test_double_array * basic_test_double_array_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { basic_test_double_array *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_basic_test_double_array (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * basic_test_double_array_generate_json (const basic_test_double_array *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_basic_test_double_array (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/basic_test_top_array_int.c0000644000000000000000000001500514656670200022512 0ustar0000000000000000/* Generated from test_top_array_int.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/basic_test_top_array_int.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (basic_test_top_array_int_container *, free_basic_test_top_array_int_container) basic_test_top_array_int_container *make_basic_test_top_array_int_container (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_basic_test_top_array_int_container) basic_test_top_array_int_container *ptr = NULL; size_t i, alen; (void) ctx; if (tree == NULL || err == NULL || YAJL_GET_ARRAY (tree) == NULL) return NULL; *err = NULL; alen = YAJL_GET_ARRAY_NO_CHECK (tree)->len; if (alen == 0) return NULL; ptr = calloc (1, sizeof (basic_test_top_array_int_container)); if (ptr == NULL) return NULL; ptr->items = calloc (alen + 1, sizeof(*ptr->items)); if (ptr->items == NULL) return NULL; ptr->len = alen; for (i = 0; i < alen; i++) { yajl_val work = YAJL_GET_ARRAY_NO_CHECK (tree)->values[i]; yajl_val val = work; if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int32 (YAJL_GET_NUMBER (val), &ptr->items[i]); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int32' for key 'basic_test_top_array_int': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } } } return move_ptr(ptr); } void free_basic_test_top_array_int_container (basic_test_top_array_int_container *ptr) { size_t i; if (ptr == NULL) return; for (i = 0; i < ptr->len; i++) { } free (ptr->items); ptr->items = NULL; free (ptr); } yajl_gen_status gen_basic_test_top_array_int_container (yajl_gen g, const basic_test_top_array_int_container *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat; size_t i; if (ptr == NULL) return yajl_gen_status_ok; *err = NULL; stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < ptr->len; i++) { { stat = map_int (g, ptr->items[i]); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } } stat = yajl_gen_array_close ((yajl_gen) g); if (ptr->len > 0 && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } basic_test_top_array_int_container * basic_test_top_array_int_container_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { basic_test_top_array_int_container *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = basic_test_top_array_int_container_parse_data (content, ctx, err);return ptr; } basic_test_top_array_int_container * basic_test_top_array_int_container_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {basic_test_top_array_int_container *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = basic_test_top_array_int_container_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) basic_test_top_array_int_container * basic_test_top_array_int_container_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { basic_test_top_array_int_container *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_basic_test_top_array_int_container (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * basic_test_top_array_int_container_generate_json (const basic_test_top_array_int_container *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_basic_test_top_array_int_container (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/basic_test_top_array_string.c0000644000000000000000000001451314656670200023231 0ustar0000000000000000/* Generated from test_top_array_string.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/basic_test_top_array_string.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (basic_test_top_array_string_container *, free_basic_test_top_array_string_container) basic_test_top_array_string_container *make_basic_test_top_array_string_container (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_basic_test_top_array_string_container) basic_test_top_array_string_container *ptr = NULL; size_t i, alen; (void) ctx; if (tree == NULL || err == NULL || YAJL_GET_ARRAY (tree) == NULL) return NULL; *err = NULL; alen = YAJL_GET_ARRAY_NO_CHECK (tree)->len; if (alen == 0) return NULL; ptr = calloc (1, sizeof (basic_test_top_array_string_container)); if (ptr == NULL) return NULL; ptr->items = calloc (alen + 1, sizeof(*ptr->items)); if (ptr->items == NULL) return NULL; ptr->len = alen; for (i = 0; i < alen; i++) { yajl_val work = YAJL_GET_ARRAY_NO_CHECK (tree)->values[i]; yajl_val val = work; if (val != NULL) { char *str = YAJL_GET_STRING (val); ptr->items[i] = strdup (str ? str : ""); if (ptr->items[i] == NULL) return NULL; } } return move_ptr(ptr); } void free_basic_test_top_array_string_container (basic_test_top_array_string_container *ptr) { size_t i; if (ptr == NULL) return; for (i = 0; i < ptr->len; i++) { free (ptr->items[i]); ptr->items[i] = NULL; } free (ptr->items); ptr->items = NULL; free (ptr); } yajl_gen_status gen_basic_test_top_array_string_container (yajl_gen g, const basic_test_top_array_string_container *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat; size_t i; if (ptr == NULL) return yajl_gen_status_ok; *err = NULL; stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < ptr->len; i++) { { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->items[i]), strlen (ptr->items[i])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } } stat = yajl_gen_array_close ((yajl_gen) g); if (ptr->len > 0 && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } basic_test_top_array_string_container * basic_test_top_array_string_container_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { basic_test_top_array_string_container *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = basic_test_top_array_string_container_parse_data (content, ctx, err);return ptr; } basic_test_top_array_string_container * basic_test_top_array_string_container_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {basic_test_top_array_string_container *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = basic_test_top_array_string_container_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) basic_test_top_array_string_container * basic_test_top_array_string_container_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { basic_test_top_array_string_container *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_basic_test_top_array_string_container (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * basic_test_top_array_string_container_generate_json (const basic_test_top_array_string_container *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_basic_test_top_array_string_container (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/basic_test_top_double_array_int.c0000644000000000000000000001723514656670200024053 0ustar0000000000000000/* Generated from test_top_double_array_int.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/basic_test_top_double_array_int.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (basic_test_top_double_array_int_container *, free_basic_test_top_double_array_int_container) basic_test_top_double_array_int_container *make_basic_test_top_double_array_int_container (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_basic_test_top_double_array_int_container) basic_test_top_double_array_int_container *ptr = NULL; size_t i, alen; (void) ctx; if (tree == NULL || err == NULL || YAJL_GET_ARRAY (tree) == NULL) return NULL; *err = NULL; alen = YAJL_GET_ARRAY_NO_CHECK (tree)->len; if (alen == 0) return NULL; ptr = calloc (1, sizeof (basic_test_top_double_array_int_container)); if (ptr == NULL) return NULL; ptr->items = calloc (alen + 1, sizeof(*ptr->items)); if (ptr->items == NULL) return NULL; ptr->len = alen; ptr->subitem_lens = calloc ( alen + 1, sizeof (size_t)); if (ptr->subitem_lens == NULL) return NULL; for (i = 0; i < alen; i++) { yajl_val work = YAJL_GET_ARRAY_NO_CHECK (tree)->values[i]; ptr->items[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(work)->len + 1, sizeof (**ptr->items)); if (ptr->items[i] == NULL) return NULL; size_t j; yajl_val *tmps = YAJL_GET_ARRAY_NO_CHECK(work)->values; for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(work)->len; j++) { yajl_val val = tmps[j]; if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int32 (YAJL_GET_NUMBER (val), &ptr->items[i][j]); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int32' for key '': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } } ptr->subitem_lens[i] += 1; } } return move_ptr(ptr); } void free_basic_test_top_double_array_int_container (basic_test_top_double_array_int_container *ptr) { size_t i; if (ptr == NULL) return; for (i = 0; i < ptr->len; i++) { free (ptr->items[i]); ptr->items[i] = NULL; } free (ptr->subitem_lens); ptr->subitem_lens = NULL; free (ptr->items); ptr->items = NULL; free (ptr); } yajl_gen_status gen_basic_test_top_double_array_int_container (yajl_gen g, const basic_test_top_double_array_int_container *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat; size_t i; if (ptr == NULL) return yajl_gen_status_ok; *err = NULL; stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < ptr->len; i++) { { stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); size_t j; for (j = 0; j < ptr->subitem_lens[i]; j++) { stat = map_int (g, ptr->items[i][j]); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); } } stat = yajl_gen_array_close ((yajl_gen) g); if (ptr->len > 0 && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } basic_test_top_double_array_int_container * basic_test_top_double_array_int_container_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { basic_test_top_double_array_int_container *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = basic_test_top_double_array_int_container_parse_data (content, ctx, err);return ptr; } basic_test_top_double_array_int_container * basic_test_top_double_array_int_container_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {basic_test_top_double_array_int_container *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = basic_test_top_double_array_int_container_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) basic_test_top_double_array_int_container * basic_test_top_double_array_int_container_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { basic_test_top_double_array_int_container *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_basic_test_top_double_array_int_container (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * basic_test_top_double_array_int_container_generate_json (const basic_test_top_double_array_int_container *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_basic_test_top_double_array_int_container (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/basic_test_top_double_array_obj.c0000644000000000000000000002754614656670200024041 0ustar0000000000000000/* Generated from test_top_double_array_obj.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/basic_test_top_double_array_obj.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (basic_test_top_double_array_obj_element *, free_basic_test_top_double_array_obj_element) basic_test_top_double_array_obj_element * make_basic_test_top_double_array_obj_element (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_basic_test_top_double_array_obj_element) basic_test_top_double_array_obj_element *ret = NULL; *err = NULL; (void) ctx; /* Silence compiler warning. */ if (tree == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; do { yajl_val val = get_val (tree, "first", yajl_t_true); if (val != NULL) { ret->first = YAJL_IS_TRUE(val); ret->first_present = 1; } else { val = get_val (tree, "first", yajl_t_false); if (val != NULL) { ret->first = 0; ret->first_present = 1; } } } while (0); do { yajl_val val = get_val (tree, "second", yajl_t_number); if (val != NULL) { int invalid; if (! YAJL_IS_NUMBER (val)) { *err = strdup ("invalid type"); return NULL; } invalid = common_safe_int32 (YAJL_GET_NUMBER (val), &ret->second); if (invalid) { if (asprintf (err, "Invalid value '%s' with type 'int32' for key 'second': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0) *err = strdup ("error allocating memory"); return NULL; } ret->second_present = 1; } } while (0); do { yajl_val val = get_val (tree, "third", yajl_t_string); if (val != NULL) { char *str = YAJL_GET_STRING (val); ret->third = strdup (str ? str : ""); if (ret->third == NULL) return NULL; } } while (0); return move_ptr (ret); } void free_basic_test_top_double_array_obj_element (basic_test_top_double_array_obj_element *ptr) { if (ptr == NULL) return; free (ptr->third); ptr->third = NULL; free (ptr); } yajl_gen_status gen_basic_test_top_double_array_obj_element (yajl_gen g, const basic_test_top_double_array_obj_element *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; *err = NULL; (void) ptr; /* Silence compiler warning. */ stat = yajl_gen_map_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->first_present)) { bool b = false; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("first"), 5 /* strlen ("first") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->first) b = ptr->first; stat = yajl_gen_bool ((yajl_gen)g, (int)(b)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->second_present)) { long long int num = 0; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("second"), 6 /* strlen ("second") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->second) num = (long long int)ptr->second; stat = map_int (g, num); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->third != NULL)) { char *str = ""; stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("third"), 5 /* strlen ("third") */); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); if (ptr != NULL && ptr->third != NULL) str = ptr->third; stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(str), strlen (str)); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } define_cleaner_function (basic_test_top_double_array_obj_container *, free_basic_test_top_double_array_obj_container) basic_test_top_double_array_obj_container *make_basic_test_top_double_array_obj_container (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_basic_test_top_double_array_obj_container) basic_test_top_double_array_obj_container *ptr = NULL; size_t i, alen; (void) ctx; if (tree == NULL || err == NULL || YAJL_GET_ARRAY (tree) == NULL) return NULL; *err = NULL; alen = YAJL_GET_ARRAY_NO_CHECK (tree)->len; if (alen == 0) return NULL; ptr = calloc (1, sizeof (basic_test_top_double_array_obj_container)); if (ptr == NULL) return NULL; ptr->items = calloc (alen + 1, sizeof(*ptr->items)); if (ptr->items == NULL) return NULL; ptr->len = alen; ptr->subitem_lens = calloc ( alen + 1, sizeof (size_t)); if (ptr->subitem_lens == NULL) return NULL; for (i = 0; i < alen; i++) { yajl_val work = YAJL_GET_ARRAY_NO_CHECK (tree)->values[i]; size_t j; ptr->items[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(work)->len + 1, sizeof (**ptr->items)); if (ptr->items[i] == NULL) return NULL; yajl_val *tmps = YAJL_GET_ARRAY_NO_CHECK(work)->values; for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(work)->len; j++) { ptr->items[i][j] = make_basic_test_top_double_array_obj_element (tmps[j], ctx, err); if (ptr->items[i][j] == NULL) return NULL; ptr->subitem_lens[i] += 1; } } return move_ptr(ptr); } void free_basic_test_top_double_array_obj_container (basic_test_top_double_array_obj_container *ptr) { size_t i; if (ptr == NULL) return; for (i = 0; i < ptr->len; i++) { size_t j; for (j = 0; j < ptr->subitem_lens[i]; j++) { free_basic_test_top_double_array_obj_element (ptr->items[i][j]); ptr->items[i][j] = NULL; } free (ptr->items[i]); ptr->items[i] = NULL; } free (ptr->subitem_lens); ptr->subitem_lens = NULL; free (ptr->items); ptr->items = NULL; free (ptr); } yajl_gen_status gen_basic_test_top_double_array_obj_container (yajl_gen g, const basic_test_top_double_array_obj_container *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat; size_t i; if (ptr == NULL) return yajl_gen_status_ok; *err = NULL; stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < ptr->len; i++) { { stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); size_t j; for (j = 0; j < ptr->subitem_lens[i]; j++) { stat = gen_basic_test_top_double_array_obj_element (g, ptr->items[i][j], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); } } stat = yajl_gen_array_close ((yajl_gen) g); if (ptr->len > 0 && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } basic_test_top_double_array_obj_container * basic_test_top_double_array_obj_container_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { basic_test_top_double_array_obj_container *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = basic_test_top_double_array_obj_container_parse_data (content, ctx, err);return ptr; } basic_test_top_double_array_obj_container * basic_test_top_double_array_obj_container_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {basic_test_top_double_array_obj_container *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = basic_test_top_double_array_obj_container_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) basic_test_top_double_array_obj_container * basic_test_top_double_array_obj_container_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { basic_test_top_double_array_obj_container *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_basic_test_top_double_array_obj_container (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * basic_test_top_double_array_obj_container_generate_json (const basic_test_top_double_array_obj_container *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_basic_test_top_double_array_obj_container (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/basic_test_top_double_array_refobj.c0000644000000000000000000001673414656670200024533 0ustar0000000000000000/* Generated from test_top_double_array_refobj.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/basic_test_top_double_array_refobj.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (basic_test_top_double_array_refobj_container *, free_basic_test_top_double_array_refobj_container) basic_test_top_double_array_refobj_container *make_basic_test_top_double_array_refobj_container (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_basic_test_top_double_array_refobj_container) basic_test_top_double_array_refobj_container *ptr = NULL; size_t i, alen; (void) ctx; if (tree == NULL || err == NULL || YAJL_GET_ARRAY (tree) == NULL) return NULL; *err = NULL; alen = YAJL_GET_ARRAY_NO_CHECK (tree)->len; if (alen == 0) return NULL; ptr = calloc (1, sizeof (basic_test_top_double_array_refobj_container)); if (ptr == NULL) return NULL; ptr->items = calloc (alen + 1, sizeof(*ptr->items)); if (ptr->items == NULL) return NULL; ptr->len = alen; ptr->subitem_lens = calloc ( alen + 1, sizeof (size_t)); if (ptr->subitem_lens == NULL) return NULL; for (i = 0; i < alen; i++) { yajl_val work = YAJL_GET_ARRAY_NO_CHECK (tree)->values[i]; size_t j; ptr->items[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(work)->len + 1, sizeof (**ptr->items)); if (ptr->items[i] == NULL) return NULL; yajl_val *tmps = YAJL_GET_ARRAY_NO_CHECK(work)->values; for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(work)->len; j++) { ptr->items[i][j] = make_basic_test_double_array_item (tmps[j], ctx, err); if (ptr->items[i][j] == NULL) return NULL; ptr->subitem_lens[i] += 1; } } return move_ptr(ptr); } void free_basic_test_top_double_array_refobj_container (basic_test_top_double_array_refobj_container *ptr) { size_t i; if (ptr == NULL) return; for (i = 0; i < ptr->len; i++) { size_t j; for (j = 0; j < ptr->subitem_lens[i]; j++) { free_basic_test_double_array_item (ptr->items[i][j]); ptr->items[i][j] = NULL; } free (ptr->items[i]); ptr->items[i] = NULL; } free (ptr->subitem_lens); ptr->subitem_lens = NULL; free (ptr->items); ptr->items = NULL; free (ptr); } yajl_gen_status gen_basic_test_top_double_array_refobj_container (yajl_gen g, const basic_test_top_double_array_refobj_container *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat; size_t i; if (ptr == NULL) return yajl_gen_status_ok; *err = NULL; stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < ptr->len; i++) { { stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); size_t j; for (j = 0; j < ptr->subitem_lens[i]; j++) { stat = gen_basic_test_double_array_item (g, ptr->items[i][j], ctx, err); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); } } stat = yajl_gen_array_close ((yajl_gen) g); if (ptr->len > 0 && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } basic_test_top_double_array_refobj_container * basic_test_top_double_array_refobj_container_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { basic_test_top_double_array_refobj_container *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = basic_test_top_double_array_refobj_container_parse_data (content, ctx, err);return ptr; } basic_test_top_double_array_refobj_container * basic_test_top_double_array_refobj_container_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {basic_test_top_double_array_refobj_container *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = basic_test_top_double_array_refobj_container_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) basic_test_top_double_array_refobj_container * basic_test_top_double_array_refobj_container_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { basic_test_top_double_array_refobj_container *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_basic_test_top_double_array_refobj_container (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * basic_test_top_double_array_refobj_container_generate_json (const basic_test_top_double_array_refobj_container *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_basic_test_top_double_array_refobj_container (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/basic_test_top_double_array_string.c0000644000000000000000000001711014656670200024557 0ustar0000000000000000/* Generated from test_top_double_array_string.json. Do not edit! */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include "ocispec/basic_test_top_double_array_string.h" #define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array) #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) define_cleaner_function (basic_test_top_double_array_string_container *, free_basic_test_top_double_array_string_container) basic_test_top_double_array_string_container *make_basic_test_top_double_array_string_container (yajl_val tree, const struct parser_context *ctx, parser_error *err) { __auto_cleanup(free_basic_test_top_double_array_string_container) basic_test_top_double_array_string_container *ptr = NULL; size_t i, alen; (void) ctx; if (tree == NULL || err == NULL || YAJL_GET_ARRAY (tree) == NULL) return NULL; *err = NULL; alen = YAJL_GET_ARRAY_NO_CHECK (tree)->len; if (alen == 0) return NULL; ptr = calloc (1, sizeof (basic_test_top_double_array_string_container)); if (ptr == NULL) return NULL; ptr->items = calloc (alen + 1, sizeof(*ptr->items)); if (ptr->items == NULL) return NULL; ptr->len = alen; ptr->subitem_lens = calloc ( alen + 1, sizeof (size_t)); if (ptr->subitem_lens == NULL) return NULL; for (i = 0; i < alen; i++) { yajl_val work = YAJL_GET_ARRAY_NO_CHECK (tree)->values[i]; ptr->items[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(work)->len + 1, sizeof (**ptr->items)); if (ptr->items[i] == NULL) return NULL; size_t j; yajl_val *tmps = YAJL_GET_ARRAY_NO_CHECK(work)->values; for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(work)->len; j++) { yajl_val val = tmps[j]; if (val != NULL) { char *str = YAJL_GET_STRING (val); ptr->items[i][j] = strdup (str ? str : ""); if (ptr->items[i][j] == NULL) return NULL; } ptr->subitem_lens[i] += 1; } } return move_ptr(ptr); } void free_basic_test_top_double_array_string_container (basic_test_top_double_array_string_container *ptr) { size_t i; if (ptr == NULL) return; for (i = 0; i < ptr->len; i++) { size_t j; for (j = 0; j < ptr->subitem_lens[i]; j++) { free (ptr->items[i][j]); ptr->items[i][j] = NULL; } free (ptr->items[i]); ptr->items[i] = NULL; } free (ptr->subitem_lens); ptr->subitem_lens = NULL; free (ptr->items); ptr->items = NULL; free (ptr); } yajl_gen_status gen_basic_test_top_double_array_string_container (yajl_gen g, const basic_test_top_double_array_string_container *ptr, const struct parser_context *ctx, parser_error *err) { yajl_gen_status stat; size_t i; if (ptr == NULL) return yajl_gen_status_ok; *err = NULL; stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < ptr->len; i++) { { stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); size_t j; for (j = 0; j < ptr->subitem_lens[i]; j++) { stat = yajl_gen_string ((yajl_gen)g, (const unsigned char *)(ptr->items[i][j]), strlen (ptr->items[i][j])); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close ((yajl_gen) g); } } stat = yajl_gen_array_close ((yajl_gen) g); if (ptr->len > 0 && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } basic_test_top_double_array_string_container * basic_test_top_double_array_string_container_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err) { basic_test_top_double_array_string_container *ptr = NULL;size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }ptr = basic_test_top_double_array_string_container_parse_data (content, ctx, err);return ptr; } basic_test_top_double_array_string_container * basic_test_top_double_array_string_container_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err) {basic_test_top_double_array_string_container *ptr = NULL; size_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; } ptr = basic_test_top_double_array_string_container_parse_data (content, ctx, err);return ptr; } define_cleaner_function (yajl_val, yajl_tree_free) basic_test_top_double_array_string_container * basic_test_top_double_array_string_container_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err) { basic_test_top_double_array_string_container *ptr = NULL;__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; } ptr = make_basic_test_top_double_array_string_container (tree, ctx, err);return ptr; } static void cleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char * basic_test_top_double_array_string_container_generate_json (const basic_test_top_double_array_string_container *ptr, const struct parser_context *ctx, parser_error *err){ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } if (yajl_gen_status_ok != gen_basic_test_top_double_array_string_container (g, ptr, ctx, err)) { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/read-file.c0000644000000000000000000000553314332154664017277 0ustar0000000000000000/* Copyright 2017 Giuseppe Scrivano Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include #include "ocispec/read-file.h" #include #include #include #include #include #include #include char * fread_file (FILE *stream, size_t *length) { char *buf = NULL; size_t alloc = BUFSIZ; { struct stat st; if (fstat (fileno (stream), &st) >= 0 && S_ISREG (st.st_mode)) { off_t pos = ftello (stream); if (pos >= 0 && pos < st.st_size) { off_t alloc_off = st.st_size - pos; if (SIZE_MAX - 1 < (uintmax_t)(alloc_off)) { errno = ENOMEM; return NULL; } alloc = alloc_off + 1; } } } if (!(buf = malloc (alloc))) return NULL; { size_t size = 0; int save_errno; for (;;) { size_t requested = alloc - size; size_t count = fread (buf + size, 1, requested, stream); size += count; if (count != requested) { save_errno = errno; if (ferror (stream)) break; if (size < alloc - 1) { char *reduce_buf = realloc (buf, size + 1); if (reduce_buf != NULL) buf = reduce_buf; } buf[size] = '\0'; *length = size; return buf; } { char *temp_buf; if (alloc == SIZE_MAX) { save_errno = ENOMEM; break; } if (alloc < SIZE_MAX - alloc / 2) alloc = alloc + alloc / 2; else alloc = SIZE_MAX; if (!(temp_buf = realloc (buf, alloc))) { save_errno = errno; break; } buf = temp_buf; } } free (buf); errno = save_errno; return NULL; } } char * read_file (const char *path, size_t *length) { FILE *f = fopen (path, "r"); char *buf; int save_errno; if (!f) return NULL; buf = fread_file (f, length); save_errno = errno; if (fclose (f) != 0) { if (buf) { save_errno = errno; free (buf); } errno = save_errno; return NULL; } return buf; } crun-1.16.1/libocispec/src/ocispec/json_common.c0000644000000000000000000012256414332154664017774 0ustar0000000000000000#define _GNU_SOURCE #include #include #include #include #include "ocispec/json_common.h" #define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object) #define YAJL_GET_STRING_NO_CHECK(v) ((v)->u.string) #define MAX_NUM_STR_LEN 21 static yajl_gen_status gen_yajl_val (yajl_val obj, yajl_gen g, parser_error *err); static yajl_gen_status gen_yajl_val_obj (yajl_val obj, yajl_gen g, parser_error *err) { size_t i; yajl_gen_status stat = yajl_gen_status_ok; stat = yajl_gen_map_open (g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < obj->u.object.len; i++) { stat = yajl_gen_string (g, (const unsigned char *) obj->u.object.keys[i], strlen (obj->u.object.keys[i])); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_yajl_val (obj->u.object.values[i], g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close (g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } static yajl_gen_status gen_yajl_val_array (yajl_val arr, yajl_gen g, parser_error *err) { size_t i; yajl_gen_status stat = yajl_gen_status_ok; stat = yajl_gen_array_open (g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < arr->u.array.len; i++) { stat = gen_yajl_val (arr->u.array.values[i], g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_array_close (g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } static yajl_gen_status gen_yajl_val (yajl_val obj, yajl_gen g, parser_error *err) { yajl_gen_status __stat = yajl_gen_status_ok; char *__tstr; switch (obj->type) { case yajl_t_string: __tstr = YAJL_GET_STRING (obj); if (__tstr == NULL) { return __stat; } __stat = yajl_gen_string (g, (const unsigned char *) __tstr, strlen (__tstr)); if (yajl_gen_status_ok != __stat) GEN_SET_ERROR_AND_RETURN (__stat, err); return yajl_gen_status_ok; case yajl_t_number: __tstr = YAJL_GET_NUMBER (obj); if (__tstr == NULL) { return __stat; } __stat = yajl_gen_number (g, __tstr, strlen (__tstr)); if (yajl_gen_status_ok != __stat) GEN_SET_ERROR_AND_RETURN (__stat, err); return yajl_gen_status_ok; case yajl_t_object: return gen_yajl_val_obj (obj, g, err); case yajl_t_array: return gen_yajl_val_array (obj, g, err); case yajl_t_true: return yajl_gen_bool (g, true); case yajl_t_false: return yajl_gen_bool (g, false); case yajl_t_null: return yajl_gen_null(g); case yajl_t_any: return __stat; } return __stat; } yajl_gen_status gen_yajl_object_residual (yajl_val obj, yajl_gen g, parser_error *err) { size_t i; yajl_gen_status stat = yajl_gen_status_ok; for (i = 0; i < obj->u.object.len; i++) { if (obj->u.object.keys[i] == NULL) { continue; } stat = yajl_gen_string (g, (const unsigned char *) obj->u.object.keys[i], strlen (obj->u.object.keys[i])); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); stat = gen_yajl_val (obj->u.object.values[i], g, err); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } return yajl_gen_status_ok; } yajl_gen_status map_uint (void *ctx, long long unsigned int num) { char numstr[MAX_NUM_STR_LEN]; int ret; ret = snprintf (numstr, sizeof (numstr), "%llu", num); if (ret < 0 || (size_t) ret >= sizeof (numstr)) return yajl_gen_in_error_state; return yajl_gen_number ((yajl_gen) ctx, (const char *) numstr, strlen (numstr)); } yajl_gen_status map_int (void *ctx, long long int num) { char numstr[MAX_NUM_STR_LEN]; int ret; ret = snprintf (numstr, sizeof (numstr), "%lld", num); if (ret < 0 || (size_t) ret >= sizeof (numstr)) return yajl_gen_in_error_state; return yajl_gen_number ((yajl_gen) ctx, (const char *) numstr, strlen (numstr)); } bool json_gen_init (yajl_gen *g, const struct parser_context *ctx) { *g = yajl_gen_alloc (NULL); if (NULL == *g) return false; yajl_gen_config (*g, yajl_gen_beautify, (int) (! (ctx->options & OPT_GEN_SIMPLIFY))); yajl_gen_config (*g, yajl_gen_validate_utf8, (int) (! (ctx->options & OPT_GEN_NO_VALIDATE_UTF8))); return true; } yajl_val get_val (yajl_val tree, const char *name, yajl_type type) { const char *path[] = { name, NULL }; return yajl_tree_get (tree, path, type); } char * safe_strdup (const char *src) { char *dst = NULL; if (src == NULL) return NULL; dst = strdup (src); if (dst == NULL) abort (); return dst; } void * safe_malloc (size_t size) { void *ret = NULL; if (size == 0) abort (); ret = calloc (1, size); if (ret == NULL) abort (); return ret; } int common_safe_double (const char *numstr, double *converted) { char *err_str = NULL; double d; if (numstr == NULL) return -EINVAL; errno = 0; d = strtod (numstr, &err_str); if (errno > 0) return -errno; if (err_str == NULL || err_str == numstr || *err_str != '\0') return -EINVAL; *converted = d; return 0; } int common_safe_uint8 (const char *numstr, uint8_t *converted) { char *err = NULL; unsigned long int uli; if (numstr == NULL) return -EINVAL; errno = 0; uli = strtoul (numstr, &err, 0); if (errno > 0) return -errno; if (err == NULL || err == numstr || *err != '\0') return -EINVAL; if (uli > UINT8_MAX) return -ERANGE; *converted = (uint8_t) uli; return 0; } int common_safe_uint16 (const char *numstr, uint16_t *converted) { char *err = NULL; unsigned long int uli; if (numstr == NULL) return -EINVAL; errno = 0; uli = strtoul (numstr, &err, 0); if (errno > 0) return -errno; if (err == NULL || err == numstr || *err != '\0') return -EINVAL; if (uli > UINT16_MAX) return -ERANGE; *converted = (uint16_t) uli; return 0; } int common_safe_uint32 (const char *numstr, uint32_t *converted) { char *err = NULL; unsigned long long int ull; if (numstr == NULL) return -EINVAL; errno = 0; ull = strtoull (numstr, &err, 0); if (errno > 0) return -errno; if (err == NULL || err == numstr || *err != '\0') return -EINVAL; if (ull > UINT32_MAX) return -ERANGE; *converted = (uint32_t) ull; return 0; } int common_safe_uint64 (const char *numstr, uint64_t *converted) { char *err = NULL; unsigned long long int ull; if (numstr == NULL) return -EINVAL; errno = 0; ull = strtoull (numstr, &err, 0); if (errno > 0) return -errno; if (err == NULL || err == numstr || *err != '\0') return -EINVAL; *converted = (uint64_t) ull; return 0; } int common_safe_uint (const char *numstr, unsigned int *converted) { char *err = NULL; unsigned long long int ull; if (numstr == NULL) return -EINVAL; errno = 0; ull = strtoull (numstr, &err, 0); if (errno > 0) return -errno; if (err == NULL || err == numstr || *err != '\0') return -EINVAL; if (ull > UINT_MAX) return -ERANGE; *converted = (unsigned int) ull; return 0; } int common_safe_int8 (const char *numstr, int8_t *converted) { char *err = NULL; long int li; if (numstr == NULL) { return -EINVAL; } errno = 0; li = strtol (numstr, &err, 0); if (errno > 0) return -errno; if (err == NULL || err == numstr || *err != '\0') return -EINVAL; if (li > INT8_MAX || li < INT8_MIN) return -ERANGE; *converted = (int8_t) li; return 0; } int common_safe_int16 (const char *numstr, int16_t *converted) { char *err = NULL; long int li; if (numstr == NULL) return -EINVAL; errno = 0; li = strtol (numstr, &err, 0); if (errno > 0) return -errno; if (err == NULL || err == numstr || *err != '\0') return -EINVAL; if (li > INT16_MAX || li < INT16_MIN) return -ERANGE; *converted = (int16_t) li; return 0; } int common_safe_int32 (const char *numstr, int32_t *converted) { char *err = NULL; long long int lli; if (numstr == NULL) return -EINVAL; errno = 0; lli = strtol (numstr, &err, 0); if (errno > 0) return -errno; if (err == NULL || err == numstr || *err != '\0') return -EINVAL; if (lli > INT32_MAX || lli < INT32_MIN) return -ERANGE; *converted = (int32_t) lli; return 0; } int common_safe_int64 (const char *numstr, int64_t *converted) { char *err = NULL; long long int lli; if (numstr == NULL) return -EINVAL; errno = 0; lli = strtoll (numstr, &err, 0); if (errno > 0) return -errno; if (err == NULL || err == numstr || *err != '\0') return -EINVAL; *converted = (int64_t) lli; return 0; } int common_safe_int (const char *numstr, int *converted) { char *err = NULL; long long int lli; if (numstr == NULL) return -EINVAL; errno = 0; lli = strtol (numstr, &err, 0); if (errno > 0) return -errno; if (err == NULL || err == numstr || *err != '\0') return -EINVAL; if (lli > INT_MAX || lli < INT_MIN) return -ERANGE; *converted = (int) lli; return 0; } yajl_gen_status gen_json_map_int_int (void *ctx, const json_map_int_int *map, const struct parser_context *ptx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; yajl_gen g = (yajl_gen) ctx; size_t len = 0, i = 0; if (map != NULL) len = map->len; if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_map_open ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { char numstr[MAX_NUM_STR_LEN]; int nret; nret = snprintf (numstr, sizeof (numstr), "%lld", (long long int) map->keys[i]); if (nret < 0 || (size_t) nret >= sizeof (numstr)) { if (! *err) *err = strdup ("Error to print string"); return yajl_gen_in_error_state; } stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *) numstr, strlen (numstr)); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); stat = map_int (g, map->values[i]); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); return yajl_gen_status_ok; } void free_json_map_int_int (json_map_int_int *map) { if (map != NULL) { free (map->keys); map->keys = NULL; free (map->values); map->values = NULL; free (map); } } define_cleaner_function (json_map_int_int *, free_json_map_int_int) json_map_int_int *make_json_map_int_int (yajl_val src, const struct parser_context *ctx, parser_error *err) { __auto_cleanup (free_json_map_int_int) json_map_int_int *ret = NULL; size_t i; size_t len; (void) ctx; /* Silence compiler warning. */ if (src == NULL || YAJL_GET_OBJECT (src) == NULL) return NULL; len = YAJL_GET_OBJECT_NO_CHECK (src)->len; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; ret->len = 0; ret->keys = calloc (len + 1, sizeof (int)); if (ret->keys == NULL) { return NULL; } ret->values = calloc (len + 1, sizeof (int)); if (ret->values == NULL) { return NULL; } for (i = 0; i < len; i++) { const char *srckey = YAJL_GET_OBJECT_NO_CHECK (src)->keys[i]; yajl_val srcval = YAJL_GET_OBJECT_NO_CHECK (src)->values[i]; ret->keys[i] = 0; ret->values[i] = 0; ret->len = i + 1; if (srckey != NULL) { int invalid = common_safe_int (srckey, &(ret->keys[i])); if (invalid) { if (*err == NULL && asprintf (err, "Invalid key '%s' with type 'int': %s", srckey, strerror (-invalid)) < 0) { *err = strdup ("error allocating memory"); } return NULL; } } if (srcval != NULL) { int invalid; if (! YAJL_IS_NUMBER (srcval)) { if (*err == NULL && asprintf (err, "Invalid value with type 'int' for key '%s'", srckey) < 0) { *err = strdup ("error allocating memory"); } return NULL; } invalid = common_safe_int (YAJL_GET_NUMBER (srcval), &(ret->values[i])); if (invalid) { if (*err == NULL && asprintf (err, "Invalid value with type 'int' for key '%s': %s", srckey, strerror (-invalid)) < 0) { *err = strdup ("error allocating memory"); } return NULL; } } } return move_ptr (ret); } int append_json_map_int_int (json_map_int_int *map, int key, int val) { size_t len; __auto_free int *keys = NULL; __auto_free int *vals = NULL; if (map == NULL) return -1; if ((SIZE_MAX / sizeof (int) - 1) < map->len) return -1; len = map->len + 1; keys = calloc (1, len * sizeof (int)); if (keys == NULL) return -1; vals = calloc (1, len * sizeof (int)); if (vals == NULL) { return -1; } if (map->len) { (void) memcpy (keys, map->keys, map->len * sizeof (int)); (void) memcpy (vals, map->values, map->len * sizeof (int)); } free (map->keys); map->keys = keys; keys = NULL; free (map->values); map->values = vals; vals = NULL; map->keys[map->len] = key; map->values[map->len] = val; map->len++; return 0; } yajl_gen_status gen_json_map_int_bool (void *ctx, const json_map_int_bool *map, const struct parser_context *ptx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; yajl_gen g = (yajl_gen) ctx; size_t len = 0, i = 0; if (map != NULL) len = map->len; if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_map_open ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { char numstr[MAX_NUM_STR_LEN]; int nret; nret = snprintf (numstr, sizeof (numstr), "%lld", (long long int) map->keys[i]); if (nret < 0 || (size_t) nret >= sizeof (numstr)) { if (! *err) *err = strdup ("Error to print string"); return yajl_gen_in_error_state; } stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *) numstr, strlen (numstr)); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); stat = yajl_gen_bool ((yajl_gen) g, (int) (map->values[i])); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); return yajl_gen_status_ok; } void free_json_map_int_bool (json_map_int_bool *map) { if (map != NULL) { size_t i; for (i = 0; i < map->len; i++) { // No need to free key for type int // No need to free value for type bool } free (map->keys); map->keys = NULL; free (map->values); map->values = NULL; free (map); } } define_cleaner_function (json_map_int_bool *, free_json_map_int_bool) json_map_int_bool *make_json_map_int_bool (yajl_val src, const struct parser_context *ctx, parser_error *err) { __auto_cleanup (free_json_map_int_bool) json_map_int_bool *ret = NULL; size_t i; size_t len; (void) ctx; /* Silence compiler warning. */ if (src == NULL || YAJL_GET_OBJECT (src) == NULL) return NULL; len = YAJL_GET_OBJECT_NO_CHECK (src)->len; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; ret->len = 0; ret->keys = calloc (len + 1, sizeof (int)); if (ret->keys == NULL) { return NULL; } ret->values = calloc (len + 1, sizeof (bool)); if (ret->values == NULL) { return NULL; } for (i = 0; i < len; i++) { const char *srckey = YAJL_GET_OBJECT_NO_CHECK (src)->keys[i]; yajl_val srcval = YAJL_GET_OBJECT_NO_CHECK (src)->values[i]; ret->keys[i] = 0; ret->values[i] = false; ret->len = i + 1; if (srckey != NULL) { int invalid = common_safe_int (srckey, &(ret->keys[i])); if (invalid) { if (*err == NULL && asprintf (err, "Invalid key '%s' with type 'int': %s", srckey, strerror (-invalid)) < 0) { *err = strdup ("error allocating memory"); } return NULL; } } if (srcval != NULL) { if (YAJL_IS_TRUE (srcval)) ret->values[i] = true; else if (YAJL_IS_FALSE (srcval)) ret->values[i] = false; else { if (*err == NULL && asprintf (err, "Invalid value with type 'bool' for key '%s'", srckey) < 0) { *err = strdup ("error allocating memory"); } return NULL; } } } return move_ptr (ret); } int append_json_map_int_bool (json_map_int_bool *map, int key, bool val) { size_t len; __auto_free int *keys = NULL; __auto_free bool *vals = NULL; if (map == NULL) return -1; if ((SIZE_MAX / sizeof (int) - 1) < map->len || (SIZE_MAX / sizeof (bool) - 1) < map->len) return -1; len = map->len + 1; keys = calloc (len, sizeof (int)); if (keys == NULL) return -1; vals = calloc (len, sizeof (bool)); if (vals == NULL) { return -1; } if (map->len) { (void) memcpy (keys, map->keys, map->len * sizeof (int)); (void) memcpy (vals, map->values, map->len * sizeof (bool)); } free (map->keys); map->keys = keys; keys = NULL; free (map->values); map->values = vals; vals = NULL; map->keys[map->len] = key; map->values[map->len] = val; map->len++; return 0; } yajl_gen_status gen_json_map_int_string (void *ctx, const json_map_int_string *map, const struct parser_context *ptx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; yajl_gen g = (yajl_gen) ctx; size_t len = 0, i = 0; if (map != NULL) len = map->len; if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_map_open ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { char numstr[MAX_NUM_STR_LEN]; int nret; nret = snprintf (numstr, sizeof (numstr), "%lld", (long long int) map->keys[i]); if (nret < 0 || (size_t) nret >= sizeof (numstr)) { if (! *err) *err = strdup ("Error to print string"); return yajl_gen_in_error_state; } stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *) numstr, strlen (numstr)); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *) (map->values[i]), strlen (map->values[i])); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); return yajl_gen_status_ok; } void free_json_map_int_string (json_map_int_string *map) { if (map != NULL) { size_t i; for (i = 0; i < map->len; i++) { // No need to free key for type int free (map->values[i]); map->values[i] = NULL; } free (map->keys); map->keys = NULL; free (map->values); map->values = NULL; free (map); } } define_cleaner_function (json_map_int_string *, free_json_map_int_string) json_map_int_string *make_json_map_int_string (yajl_val src, const struct parser_context *ctx, parser_error *err) { __auto_cleanup (free_json_map_int_string) json_map_int_string *ret = NULL; size_t i; size_t len; if (src == NULL || YAJL_GET_OBJECT (src) == NULL) return NULL; (void) ctx; /* Silence compiler warning. */ len = YAJL_GET_OBJECT_NO_CHECK (src)->len; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; ret->len = 0; ret->keys = calloc (len + 1, sizeof (int)); if (ret->keys == NULL) { return NULL; } ret->values = calloc (len + 1, sizeof (char *)); if (ret->values == NULL) { return NULL; } for (i = 0; i < len; i++) { const char *srckey = YAJL_GET_OBJECT_NO_CHECK (src)->keys[i]; yajl_val srcval = YAJL_GET_OBJECT_NO_CHECK (src)->values[i]; ret->keys[i] = 0; ret->values[i] = NULL; ret->len = i + 1; if (srckey != NULL) { int invalid; invalid = common_safe_int (srckey, &(ret->keys[i])); if (invalid) { if (*err == NULL && asprintf (err, "Invalid key '%s' with type 'int': %s", srckey, strerror (-invalid)) < 0) { *err = strdup ("error allocating memory"); } return NULL; } } if (srcval != NULL) { if (! YAJL_IS_STRING (srcval)) { if (*err == NULL && asprintf (err, "Invalid value with type 'string' for key '%s'", srckey) < 0) { *err = strdup ("error allocating memory"); } return NULL; } char *str = YAJL_GET_STRING_NO_CHECK (srcval); ret->values[i] = strdup (str ? str : ""); } } return move_ptr (ret); } int append_json_map_int_string (json_map_int_string *map, int key, const char *val) { size_t len; int *keys = NULL; char **vals = NULL; char *new_value; if (map == NULL) return -1; if ((SIZE_MAX / sizeof (int) - 1) < map->len || (SIZE_MAX / sizeof (char *) - 1) < map->len) return -1; len = map->len + 1; keys = realloc (map->keys, len * sizeof (int)); if (keys == NULL) return -1; map->keys = keys; vals = realloc (map->values, len * sizeof (char *)); if (vals == NULL) return -1; map->values = vals; new_value = strdup (val ? val : ""); if (new_value == NULL) return -1; map->keys[map->len] = key; map->values[map->len] = new_value; map->len++; return 0; } yajl_gen_status gen_json_map_string_int (void *ctx, const json_map_string_int *map, const struct parser_context *ptx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; yajl_gen g = (yajl_gen) ctx; size_t len = 0, i = 0; if (map != NULL) len = map->len; if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_map_open ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *) (map->keys[i]), strlen (map->keys[i])); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); stat = map_int (g, map->values[i]); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); return yajl_gen_status_ok; } void free_json_map_string_int (json_map_string_int *map) { if (map != NULL) { size_t i; for (i = 0; i < map->len; i++) { free (map->keys[i]); map->keys[i] = NULL; } free (map->keys); map->keys = NULL; free (map->values); map->values = NULL; free (map); } } define_cleaner_function (json_map_string_int *, free_json_map_string_int) json_map_string_int *make_json_map_string_int (yajl_val src, const struct parser_context *ctx, parser_error *err) { __auto_cleanup (free_json_map_string_int) json_map_string_int *ret = NULL; size_t i; size_t len; (void) ctx; /* Silence compiler warning. */ if (src == NULL || YAJL_GET_OBJECT (src) == NULL) return NULL; len = YAJL_GET_OBJECT_NO_CHECK (src)->len; ret = calloc (1, sizeof (*ret)); if (ret == NULL) { *(err) = strdup ("error allocating memory"); return NULL; } ret->len = 0; ret->keys = calloc (len + 1, sizeof (char *)); if (ret->keys == NULL) { *(err) = strdup ("error allocating memory"); return NULL; } ret->values = calloc (len + 1, sizeof (int)); if (ret->values == NULL) { *(err) = strdup ("error allocating memory"); return NULL; } for (i = 0; i < len; i++) { const char *srckey = YAJL_GET_OBJECT_NO_CHECK (src)->keys[i]; yajl_val srcval = YAJL_GET_OBJECT_NO_CHECK (src)->values[i]; ret->keys[i] = NULL; ret->values[i] = 0; ret->len = i + 1; ret->keys[i] = strdup (srckey ? srckey : ""); if (ret->keys[i] == NULL) { *(err) = strdup ("error allocating memory"); return NULL; } if (srcval != NULL) { int invalid; if (! YAJL_IS_NUMBER (srcval)) { if (*err == NULL && asprintf (err, "Invalid value with type 'int' for key '%s'", srckey) < 0) { *err = strdup ("error allocating memory"); } return NULL; } invalid = common_safe_int (YAJL_GET_NUMBER (srcval), &(ret->values[i])); if (invalid) { if (*err == NULL && asprintf (err, "Invalid value with type 'int' for key '%s': %s", srckey, strerror (-invalid)) < 0) { *err = strdup ("error allocating memory"); } return NULL; } } } return move_ptr (ret); } int append_json_map_string_int (json_map_string_int *map, const char *key, int val) { size_t len; char **keys = NULL; int *vals = NULL; char *new_value; if (map == NULL) return -1; if ((SIZE_MAX / sizeof (char *) - 1) < map->len || (SIZE_MAX / sizeof (int) - 1) < map->len) return -1; len = map->len + 1; keys = realloc (map->keys, len * sizeof (char *)); if (keys == NULL) return -1; map->keys = keys; vals = realloc (map->values, len * sizeof (int)); if (vals == NULL) return -1; map->values = vals; new_value = strdup (key ? key : ""); if (new_value == NULL) return -1; map->keys[map->len] = new_value; map->values[map->len] = val; map->len++; return 0; } yajl_gen_status gen_json_map_string_int64 (void *ctx, const json_map_string_int64 *map, const struct parser_context *ptx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; yajl_gen g = (yajl_gen) ctx; size_t len = 0, i = 0; if (map != NULL) len = map->len; if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_map_open ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *) (map->keys[i]), strlen (map->keys[i])); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); stat = map_int (g, map->values[i]); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); return yajl_gen_status_ok; } void free_json_map_string_int64 (json_map_string_int64 *map) { if (map != NULL) { size_t i; for (i = 0; i < map->len; i++) { free (map->keys[i]); map->keys[i] = NULL; } free (map->keys); map->keys = NULL; free (map->values); map->values = NULL; free (map); } } define_cleaner_function (json_map_string_int64 *, free_json_map_string_int64) json_map_string_int64 *make_json_map_string_int64 (yajl_val src, const struct parser_context *ctx, parser_error *err) { __auto_cleanup (free_json_map_string_int64) json_map_string_int64 *ret = NULL; (void) ctx; /* Silence compiler warning. */ if (src != NULL && YAJL_GET_OBJECT (src) != NULL) { size_t i; size_t len = YAJL_GET_OBJECT (src)->len; ret = safe_malloc (sizeof (*ret)); ret->len = len; ret->keys = safe_malloc ((len + 1) * sizeof (char *)); ret->values = safe_malloc ((len + 1) * sizeof (int64_t)); for (i = 0; i < len; i++) { const char *srckey = YAJL_GET_OBJECT (src)->keys[i]; yajl_val srcval = YAJL_GET_OBJECT (src)->values[i]; ret->keys[i] = safe_strdup (srckey ? srckey : ""); if (srcval != NULL) { int64_t invalid; if (! YAJL_IS_NUMBER (srcval)) { if (*err == NULL && asprintf (err, "Invalid value with type 'int' for key '%s'", srckey) < 0) { *(err) = safe_strdup ("error allocating memory"); } return NULL; } invalid = common_safe_int64 (YAJL_GET_NUMBER (srcval), &(ret->values[i])); if (invalid) { if (*err == NULL && asprintf (err, "Invalid value with type 'int' for key '%s': %s", srckey, strerror (-invalid)) < 0) { *(err) = safe_strdup ("error allocating memory"); } return NULL; } } } } return move_ptr (ret); } int append_json_map_string_int64 (json_map_string_int64 *map, const char *key, int64_t val) { size_t len; char **keys = NULL; int64_t *vals = NULL; if (map == NULL) return -1; if ((SIZE_MAX / sizeof (char *) - 1) < map->len || (SIZE_MAX / sizeof (int) - 1) < map->len) return -1; len = map->len + 1; keys = safe_malloc (len * sizeof (char *)); vals = safe_malloc (len * sizeof (int64_t)); if (map->len) { (void) memcpy (keys, map->keys, map->len * sizeof (char *)); (void) memcpy (vals, map->values, map->len * sizeof (int64_t)); } free (map->keys); map->keys = keys; free (map->values); map->values = vals; map->keys[map->len] = safe_strdup (key ? key : ""); map->values[map->len] = val; map->len++; return 0; } yajl_gen_status gen_json_map_string_bool (void *ctx, const json_map_string_bool *map, const struct parser_context *ptx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; yajl_gen g = (yajl_gen) ctx; size_t len = 0, i = 0; if (map != NULL) len = map->len; if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_map_open ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *) (map->keys[i]), strlen (map->keys[i])); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); stat = yajl_gen_bool ((yajl_gen) g, (int) (map->values[i])); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); return yajl_gen_status_ok; } void free_json_map_string_bool (json_map_string_bool *map) { if (map != NULL) { size_t i; for (i = 0; i < map->len; i++) { free (map->keys[i]); map->keys[i] = NULL; // No need to free value for type bool } free (map->keys); map->keys = NULL; free (map->values); map->values = NULL; free (map); } } define_cleaner_function (json_map_string_bool *, free_json_map_string_bool) json_map_string_bool *make_json_map_string_bool (yajl_val src, const struct parser_context *ctx, parser_error *err) { __auto_cleanup (free_json_map_string_bool) json_map_string_bool *ret = NULL; size_t i; size_t len; (void) ctx; /* Silence compiler warning. */ len = YAJL_GET_OBJECT_NO_CHECK (src)->len; if (src == NULL || YAJL_GET_OBJECT (src) == NULL) return NULL; ret = calloc (1, sizeof (*ret)); if (ret == NULL) return NULL; ret->len = 0; ret->keys = calloc (len + 1, sizeof (char *)); if (ret->keys == NULL) { return NULL; } ret->values = calloc (len + 1, sizeof (bool)); if (ret->values == NULL) { return NULL; } for (i = 0; i < len; i++) { const char *srckey = YAJL_GET_OBJECT_NO_CHECK (src)->keys[i]; yajl_val srcval = YAJL_GET_OBJECT_NO_CHECK (src)->values[i]; ret->keys[i] = NULL; ret->values[i] = NULL; ret->len = i + 1; ret->keys[i] = strdup (srckey ? srckey : ""); if (ret->keys[i] == NULL) { *(err) = strdup ("error allocating memory"); return NULL; } if (srcval != NULL) { if (YAJL_IS_TRUE (srcval)) ret->values[i] = true; else if (YAJL_IS_FALSE (srcval)) ret->values[i] = false; else { if (*err == NULL && asprintf (err, "Invalid value with type 'bool' for key '%s'", srckey) < 0) { *err = strdup ("error allocating memory"); } return NULL; } } } return move_ptr (ret); } int append_json_map_string_bool (json_map_string_bool *map, const char *key, bool val) { size_t len; __auto_free char **keys = NULL; __auto_free bool *vals = NULL; __auto_free char *new_value = NULL; if (map == NULL) return -1; if ((SIZE_MAX / sizeof (char *) - 1) < map->len || (SIZE_MAX / sizeof (bool) - 1) < map->len) return -1; len = map->len + 1; keys = calloc (len, sizeof (char *)); if (keys == NULL) return -1; vals = calloc (len, sizeof (bool)); if (vals == NULL) { return -1; } new_value = strdup (key ? key : ""); if (new_value == NULL) { return -1; } if (map->len) { (void) memcpy (keys, map->keys, map->len * sizeof (char *)); (void) memcpy (vals, map->values, map->len * sizeof (bool)); } free (map->keys); map->keys = keys; keys = NULL; free (map->values); map->values = vals; vals = NULL; map->keys[map->len] = new_value; new_value = NULL; map->values[map->len] = val; map->len++; return 0; } yajl_gen_status gen_json_map_string_string (void *ctx, const json_map_string_string *map, const struct parser_context *ptx, parser_error *err) { yajl_gen_status stat = yajl_gen_status_ok; yajl_gen g = (yajl_gen) ctx; size_t len = 0, i = 0; if (map != NULL) len = map->len; if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 0); stat = yajl_gen_map_open ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < len; i++) { stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *) (map->keys[i]), strlen (map->keys[i])); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *) (map->values[i]), strlen (map->values[i])); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); } stat = yajl_gen_map_close ((yajl_gen) g); if (yajl_gen_status_ok != stat) GEN_SET_ERROR_AND_RETURN (stat, err); if (! len && ! (ptx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); return yajl_gen_status_ok; } void free_json_map_string_string (json_map_string_string *map) { if (map != NULL) { size_t i; for (i = 0; i < map->len; i++) { free (map->keys[i]); map->keys[i] = NULL; free (map->values[i]); map->values[i] = NULL; } free (map->keys); map->keys = NULL; free (map->values); map->values = NULL; free (map); } } define_cleaner_function (json_map_string_string *, free_json_map_string_string) json_map_string_string *make_json_map_string_string (yajl_val src, const struct parser_context *ctx, parser_error *err) { __auto_cleanup (free_json_map_string_string) json_map_string_string *ret = NULL; size_t i; size_t len; (void) ctx; /* Silence compiler warning. */ if (src == NULL || YAJL_GET_OBJECT (src) == NULL) return NULL; len = YAJL_GET_OBJECT_NO_CHECK (src)->len; ret = malloc (sizeof (*ret)); if (ret == NULL) { *(err) = strdup ("error allocating memory"); return NULL; } ret->len = 0; ret->keys = calloc (len + 1, sizeof (char *)); if (ret->keys == NULL) { *(err) = strdup ("error allocating memory"); return NULL; } ret->values = calloc (len + 1, sizeof (char *)); if (ret->values == NULL) { *(err) = strdup ("error allocating memory"); return NULL; } for (i = 0; i < len; i++) { const char *srckey = YAJL_GET_OBJECT_NO_CHECK (src)->keys[i]; yajl_val srcval = YAJL_GET_OBJECT_NO_CHECK (src)->values[i]; ret->keys[i] = NULL; ret->values[i] = NULL; ret->len = i + 1; ret->keys[i] = strdup (srckey ? srckey : ""); if (ret->keys[i] == NULL) { return NULL; } if (srcval != NULL) { char *str; if (! YAJL_IS_STRING (srcval)) { if (*err == NULL && asprintf (err, "Invalid value with type 'string' for key '%s'", srckey) < 0) { *err = strdup ("error allocating memory"); } return NULL; } str = YAJL_GET_STRING_NO_CHECK (srcval); ret->values[i] = strdup (str ? str : ""); if (ret->values[i] == NULL) { return NULL; } } } return move_ptr (ret); } int append_json_map_string_string (json_map_string_string *map, const char *key, const char *val) { size_t len, i; __auto_free char **keys = NULL; __auto_free char **values = NULL; __auto_free char *new_key = NULL; __auto_free char *new_value = NULL; if (map == NULL) return -1; for (i = 0; i < map->len; i++) { if (strcmp (map->keys[i], key) == 0) { char *v = strdup (val ? val : ""); if (v == NULL) return -1; free (map->values[i]); map->values[i] = v; return 0; } } if ((SIZE_MAX / sizeof (char *) - 1) < map->len) return -1; new_key = strdup (key ? key : ""); if (new_key == NULL) return -1; new_value = strdup (val ? val : ""); if (new_value == NULL) return -1; len = map->len + 1; keys = realloc (map->keys, len * sizeof (char *)); if (keys == NULL) return -1; map->keys = keys; keys = NULL; map->keys[map->len] = NULL; values = realloc (map->values, len * sizeof (char *)); if (values == NULL) return -1; map->keys[map->len] = new_key; new_key = NULL; map->values = values; values = NULL; map->values[map->len] = new_value; new_value = NULL; map->len++; return 0; } static void cleanup_yajl_gen (yajl_gen g) { if (! g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) char *json_marshal_string (const char *str, size_t length, const struct parser_context *ctx, parser_error *err) { __auto_cleanup (cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; yajl_gen_status stat; if (str == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *) (&tmp_ctx); if (! json_gen_init (&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *) str, length); if (yajl_gen_status_ok != stat) { if (asprintf (err, "error generating json, errcode: %d", (int) stat) < 0) *err = strdup ("error allocating memory"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("error allocating memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\0'; return json_buf; } crun-1.16.1/libocispec/src/ocispec/validate.c0000644000000000000000000000452414332154664017237 0ustar0000000000000000/* Copyright (C) 2017, 2019 Giuseppe Scrivano libocispec 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. libocispec 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 libocispec. If not, see . */ #include #include #include #include #include #include "ocispec/runtime_spec_schema_config_schema.h" #ifdef FUZZER int LLVMFuzzerInitialize (int *argc, char ***argv) { return 0; } int LLVMFuzzerTestOneInput (uint8_t *buf, size_t len) { runtime_spec_schema_config_schema *container; struct parser_context ctx; parser_error err; FILE *s; if (len == 0) return 0; s = fmemopen (buf, len, "r"); if (s == NULL) return 0; ctx.options = OPT_PARSE_STRICT; ctx.errfile = stderr; container = runtime_spec_schema_config_schema_parse_file_stream (s, &ctx, &err); fclose (s); if (container) { free_runtime_spec_schema_config_schema (container); return 0; } if (err) { fprintf (stderr, "error: %s\n", err); free (err); } return 0; } #endif int main (int argc, char *argv[]) { parser_error err; runtime_spec_schema_config_schema *container; const char *file = "config.json"; struct parser_context ctx; #ifdef FUZZER if (getenv ("VALIDATE_FUZZ")) { extern void HF_ITER (uint8_t** buf, size_t* len); for (;;) { size_t len; uint8_t *buf; HF_ITER (&buf, &len); LLVMFuzzerTestOneInput (buf, len); } } #endif if (argc > 1) file = argv[1]; ctx.options = OPT_PARSE_STRICT; ctx.errfile = stderr; container = runtime_spec_schema_config_schema_parse_file (file, &ctx, &err); if (container) free_runtime_spec_schema_config_schema (container); if (err) { fprintf (stderr, "error in %s: %s\n", file, err); free (err); exit (EXIT_FAILURE); } exit (EXIT_SUCCESS); } crun-1.16.1/libocispec/src/ocispec/generate.py0000755000000000000000000006622214614670103017446 0ustar0000000000000000#!/usr/bin/python -Es # # libocispec - a C library for parsing OCI spec files. # # Copyright (C) 2017, 2019 Giuseppe Scrivano # libocispec 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. # # libocispec 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 libocispec. If not, see . # # As a special exception, you may create a larger work that contains # part or all of the libocispec parser skeleton and distribute that work # under terms of your choice, so long as that work isn't itself a # parser generator using the skeleton or a modified version thereof # as a parser skeleton. Alternatively, if you modify or redistribute # the parser skeleton itself, you may (at your option) remove this # special exception, which will cause the skeleton and the resulting # libocispec output files to be licensed under the GNU General Public # License without this special exception. import traceback import os import sys import json import argparse from collections import OrderedDict import helpers import headers import sources # - json suffix JSON_SUFFIX = ".json" ''' Description: ref suffix Interface: ref_suffix History: 2019-06-17 ''' # - Description: ref suffix REF_SUFFIX = "_json" ''' Description: root paths Interface: rootpaths History: 2019-06-17 ''' class MyRoot(object): ''' Description: Store schema information Interface: None History: 2019-06-17 ''' def __init__(self, root_path): self.root_path = root_path def get_repr(self): ''' Description: Store schema information Interface: None History: 2019-06-17 ''' return "{root_path:(%s)}" % (self.root_path) def get_path(self): ''' Description: Store schema information Interface: None History: 2019-06-17 ''' return self.root_path def trim_json_suffix(name): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ if name.endswith(JSON_SUFFIX) or name.endswith(REF_SUFFIX): name = name[:-len(JSON_SUFFIX)] return helpers.conv_to_c_style(name.replace('.', '_').replace('-', '_')) def get_prefix_package(filepath, rootpath): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ realpath = os.path.realpath(filepath) if realpath.startswith(rootpath) and len(realpath) > len(rootpath): return helpers.conv_to_c_style(os.path.dirname(realpath)[(len(rootpath) + 1):]) else: raise RuntimeError('schema path \"%s\" is not in scope of root path \"%s\"' \ % (realpath, rootpath)) def get_prefix_from_file(filepath): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ prefix_file = trim_json_suffix(os.path.basename(filepath)) root_path = MyRoot.root_path prefix_package = get_prefix_package(filepath, root_path) prefix = prefix_file if prefix_package == "" else prefix_package + "_" + prefix_file return prefix def schema_from_file(filepath, srcpath): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ schemapath = helpers.FilePath(filepath) prefix = get_prefix_from_file(schemapath.name) header = helpers.FilePath(os.path.join(srcpath, prefix + ".h")) source = helpers.FilePath(os.path.join(srcpath, prefix + ".c")) schema_info = helpers.SchemaInfo(schemapath, header, source, prefix, srcpath) return schema_info def make_ref_name(refname, reffile): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ prefix = get_prefix_from_file(reffile) if refname == "" or prefix.endswith(refname): return prefix return prefix + "_" + helpers.conv_to_c_style(refname) def splite_ref_name(ref): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ tmp_f, tmp_r = ref.split("#/") if '#/' in ref else (ref, "") return tmp_f, tmp_r def merge(children): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ subchildren = [] for i in children: for j in i.children: subchildren.append(j) return subchildren # BASIC_TYPES include all basic types BASIC_TYPES = ( "byte", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "UID", "GID", "bytePointer", "doublePointer", "int8Pointer", "int16Pointer", "int32Pointer", "int64Pointer", "uint8Pointer", "uint16Pointer", "uint32Pointer", "uint64Pointer", "ArrayOfStrings", "booleanPointer" ) def judge_support_type(typ): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ return typ in ("integer", "boolean", "string", "double") or typ in BASIC_TYPES def get_ref_subref(src, subref): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ cur = src subrefname = "" for j in subref.split('/'): subrefname = j if j in BASIC_TYPES: return src, {"type": j}, subrefname cur = cur[j] return src, cur, subrefname def get_ref_root(schema_info, src, ref, curfile): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ refname = "" tmp_f, tmp_r = splite_ref_name(ref) if tmp_f == "": cur = src else: realpath = os.path.realpath(os.path.join(os.path.dirname(curfile), tmp_f)) curfile = realpath subschema = schema_from_file(realpath, schema_info.filesdir) if schema_info.refs is None: schema_info.refs = {} schema_info.refs[subschema.header.basename] = subschema with open(realpath) as i: cur = src = json.loads(i.read()) subcur = cur if tmp_r != "": src, subcur, refname = get_ref_subref(src, tmp_r) if 'type' not in subcur and '$ref' in subcur: subf, subr = splite_ref_name(subcur['$ref']) if subf == "": src, subcur, refname = get_ref_subref(src, subr) if 'type' not in subcur: raise RuntimeError("Not support reference of nesting more than 2 level: ", ref) else: return get_ref_root(schema_info, src, subcur['$ref'], curfile) return src, subcur, curfile, make_ref_name(refname, curfile) def get_type_pattern_incur(cur, schema_info, src, curfile): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ # pattern of key: # '.{1,}' represents type 'string', # '.{2,}' represents type 'integer' if '.{2,}' in cur['patternProperties']: map_key = 'Int' else: map_key = 'String' for i, value in enumerate(cur['patternProperties'].values()): # only use the first value if i == 0: if 'type' in value: val = value["type"] else: dummy_subsrc, subcur, dummy_subcurfile, dummy_subrefname = get_ref_root( schema_info, src, value['$ref'], curfile) val = subcur['type'] break m_key = { 'object': 'Object', 'string': 'String', 'integer': 'Int', 'boolean': 'Bool', 'int64': 'Int64' }[val] map_val = m_key typ = 'map' + map_key + map_val return typ class GenerateNodeInfo(object): ''' Description: Store schema information Interface: None History: 2019-06-17 ''' def __init__(self, schema_info, name, cur, curfile): self.schema_info = schema_info self.name = name self.cur = cur self.curfile = curfile def get_repr(self): ''' Description: Store schema information Interface: None History: 2019-06-17 ''' return "{schema_info:(%s) name:(%s) cur:(%s) curfile:(%s)}" \ % (self.schema_info, self.name, self.cur, self.curfile) def get_name(self): ''' Description: Store schema information Interface: None History: 2019-06-17 ''' return self.name def gen_all_arr_typnode(node_info, src, typ, refname): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ schema_info = node_info.schema_info name = node_info.name cur = node_info.cur curfile = node_info.curfile subtyp = None subtypobj = None required = None children = merge(resolve_list(schema_info, name, src, cur["items"]['allOf'], curfile)) subtyp = children[0].typ subtypobj = children return helpers.Unite(name, typ, children, subtyp=subtyp, subtypobj=subtypobj, subtypname=refname, required=required), src def gen_any_arr_typnode(node_info, src, typ, refname): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ schema_info = node_info.schema_info name = node_info.name cur = node_info.cur curfile = node_info.curfile subtyp = None subtypobj = None required = None anychildren = resolve_list(schema_info, name, src, cur["items"]['anyOf'], curfile) subtyp = anychildren[0].typ children = anychildren[0].children subtypobj = children refname = anychildren[0].subtypname return helpers.Unite(name, typ, children, subtyp=subtyp, subtypobj=subtypobj, subtypname=refname, required=required), src def gen_ref_arr_typnode(node_info, src, typ, refname): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ schema_info = node_info.schema_info name = node_info.name cur = node_info.cur curfile = node_info.curfile item_type, src = resolve_type(schema_info, name, src, cur["items"], curfile) ref_file, subref = splite_ref_name(cur['items']['$ref']) if ref_file == "": src, dummy_subcur, subrefname = get_ref_subref(src, subref) refname = make_ref_name(subrefname, curfile) else: refname = item_type.subtypname return helpers.Unite(name, typ, None, subtyp=item_type.typ, subtypobj=item_type.children, subtypname=refname, required=item_type.required), src def gen_type_arr_typnode(node_info, src, typ, refname): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ schema_info = node_info.schema_info name = node_info.name cur = node_info.cur curfile = node_info.curfile item_type, src = resolve_type(schema_info, name, src, cur["items"], curfile) if typ == 'array' and typ == item_type.typ and not helpers.valid_basic_map_name(item_type.subtyp): return helpers.Unite(name, typ, None, subtyp=item_type.subtyp, subtypobj=item_type.subtypobj, subtypname=item_type.subtypname, required=item_type.required, doublearray=True), src else: return helpers.Unite(name, typ, None, subtyp=item_type.typ, subtypobj=item_type.children, subtypname=refname, required=item_type.required), src def gen_arr_typnode(node_info, src, typ, refname): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ cur = node_info.cur if 'allOf' in cur["items"]: return gen_all_arr_typnode(node_info, src, typ, refname) elif 'anyOf' in cur["items"]: return gen_any_arr_typnode(node_info, src, typ, refname) elif '$ref' in cur["items"]: return gen_ref_arr_typnode(node_info, src, typ, refname) elif 'type' in cur["items"]: return gen_type_arr_typnode(node_info, src, typ, refname) return None def gen_obj_typnode(node_info, src, typ, refname): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ schema_info = node_info.schema_info name = node_info.name cur = node_info.cur curfile = node_info.curfile children = None subtyp = None subtypobj = None required = None if 'allOf' in cur: children = merge(resolve_list(schema_info, name, src, cur['allOf'], curfile)) elif 'anyOf' in cur: children = resolve_list(schema_info, name, src, cur['anyOf'], curfile) elif 'patternProperties' in cur: children = parse_properties(schema_info, name, src, cur, curfile) children[0].name = children[0].name.replace('_{1,}', 'element').replace('_{2,}', \ 'element') children[0].fixname = "values" if helpers.valid_basic_map_name(children[0].typ): children[0].name = helpers.make_basic_map_name(children[0].typ) else: children = parse_properties(schema_info, name, src, cur, curfile) \ if 'properties' in cur else None if 'required' in cur: required = cur['required'] return helpers.Unite(name,\ typ,\ children,\ subtyp=subtyp,\ subtypobj=subtypobj,\ subtypname=refname,\ required=required), src def get_typ_notoneof(schema_info, src, cur, curfile): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ if 'patternProperties' in cur: typ = get_type_pattern_incur(cur, schema_info, src, curfile) elif "type" in cur: typ = cur["type"] else: typ = "object" return typ def resolve_type(schema_info, name, src, cur, curfile): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ children = None subtyp = None subtypobj = None required = None refname = None if '$ref' in cur: src, cur, curfile, refname = get_ref_root(schema_info, src, cur['$ref'], curfile) if "oneOf" in cur: cur = cur['oneOf'][0] if '$ref' in cur: return resolve_type(schema_info, name, src, cur, curfile) else: typ = cur['type'] else: typ = get_typ_notoneof(schema_info, src, cur, curfile) node_info = GenerateNodeInfo(schema_info, name, cur, curfile) if helpers.valid_basic_map_name(typ): pass elif typ == 'array': return gen_arr_typnode(node_info, src, typ, refname) elif typ == 'object' or typ == 'mapStringObject': return gen_obj_typnode(node_info, src, typ, refname) elif typ == 'ArrayOfStrings': typ = 'array' subtyp = 'string' children = subtypobj = None else: if not judge_support_type(typ): raise RuntimeError("Invalid schema type: %s" % typ) children = None return helpers.Unite(name, typ, children, subtyp=subtyp, subtypobj=subtypobj, subtypname=refname, required=required), src def resolve_list(schema_info, name, schema, objs, curfile): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ obj = [] index = 0 for i in objs: generated_name = helpers.CombinateName( \ i['$ref'].split("/")[-1]) if '$ref' in i \ else helpers.CombinateName(name.name + str(index)) node, _ = resolve_type(schema_info, generated_name, schema, i, curfile) if node: obj.append(node) index += 1 if not obj: obj = None return obj def parse_dict(schema_info, name, schema, objs, curfile): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ obj = [] for i in objs: node, _ = resolve_type(schema_info, name.append(i), schema, objs[i], curfile) if node: obj.append(node) if not obj: obj = None return obj def parse_properties(schema_info, name, schema, props, curfile): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ if 'definitions' in props: return parse_dict(schema_info, name, schema, props['definitions'], curfile) if 'patternProperties' in props: return parse_dict(schema_info, name, schema, props['patternProperties'], curfile) return parse_dict(schema_info, name, schema, props['properties'], curfile) def handle_type_not_in_schema(schema_info, schema, prefix): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ required = None if 'definitions' in schema: return helpers.Unite( \ helpers.CombinateName("definitions"), 'definitions', \ parse_properties(schema_info, helpers.CombinateName(""), schema, schema, \ schema_info.name.name), None, None, None, None) else: if len(schema) > 1: print('More than one element found in schema') return None value_nodes = [] for value in schema: if 'required' in schema[value]: required = schema[value]['required'] childrens = parse_properties(schema_info, helpers.CombinateName(""), \ schema[value], schema[value], \ schema_info.name.name) value_node = helpers.Unite(helpers.CombinateName(prefix), \ 'object', childrens, None, None, \ None, required) value_nodes.append(value_node) return helpers.Unite(helpers.CombinateName("definitions"), \ 'definitions', value_nodes, None, None, \ None, None) def parse_schema(schema_info, schema, prefix): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ required = None if 'type' not in schema: return handle_type_not_in_schema(schema_info, schema, prefix) if 'object' in schema['type']: if 'required' in schema: required = schema['required'] return helpers.Unite( helpers.CombinateName(prefix), 'object', parse_properties(schema_info, \ helpers.CombinateName(""), \ schema, schema, schema_info.name.name), \ None, None, None, required) elif 'array' in schema['type']: item_type, _ = resolve_type(schema_info, helpers.CombinateName(""), \ schema['items'], schema['items'], schema_info.name.name) if item_type.typ == 'array' and not helpers.valid_basic_map_name(item_type.subtyp): item_type.doublearray = True return item_type else: return helpers.Unite(helpers.CombinateName(prefix), 'array', None, item_type.typ, \ item_type.children, None, item_type.required) else: print("Not supported type '%s'" % schema['type']) return prefix, None def expand(tree, structs, visited): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ if tree.children is not None: for i in tree.children: if tree.subtypname: i.subtypname = "from_ref" expand(i, structs, visited=visited) if tree.subtypobj is not None: for i in tree.subtypobj: expand(i, structs, visited=visited) if tree.typ == 'array' and helpers.valid_basic_map_name(tree.subtyp): name = helpers.CombinateName(tree.name + "_element") node = helpers.Unite(name, tree.subtyp, None) expand(node, structs, visited) id_ = "%s:%s" % (tree.name, tree.typ) if id_ not in visited.keys(): structs.append(tree) visited[id_] = tree return structs def reflection(schema_info, gen_ref): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ with open(schema_info.header.name + ".tmp", "w") as \ header_file, open(schema_info.source.name + ".tmp", "w") as source_file: try: with open(schema_info.name.name) as schema_file: schema_json = json.loads(schema_file.read(), object_pairs_hook=OrderedDict) try: tree = parse_schema(schema_info, schema_json, schema_info.prefix) if tree is None: print("Failed parse schema") sys.exit(1) structs = expand(tree, [], {}) headers_text = [] headers.header_reflect(structs, schema_info, headers_text) source_text = [] header_file.writelines(headers_text) sources.src_reflect(structs, schema_info, source_text, tree.typ) source_file.writelines(source_text) except RuntimeError: traceback.print_exc() print("Failed to parse schema file: %s" % schema_info.name.name) sys.exit(1) finally: pass os.rename(schema_info.header.name + ".tmp", schema_info.header.name) os.rename(schema_info.source.name + ".tmp", schema_info.source.name) finally: try: os.unlink(schema_info.header.name + ".tmp") except: pass try: os.unlink(schema_info.source.name + ".tmp") except: pass if gen_ref is True: if schema_info.refs: for reffile in schema_info.refs.values(): reflection(reffile, True) def handle_single_file(args, srcpath, gen_ref, schemapath): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ if not os.path.exists(schemapath.name) or not os.path.exists(srcpath.name): print('Path %s does not exist' % schemapath.name) sys.exit(1) if os.path.isdir(schemapath.name): if args.recursive is True: # recursively parse schema for dirpath, dummy_dirnames, files in os.walk(schemapath.name): for target_file in files: if target_file.endswith(JSON_SUFFIX): schema_info = schema_from_file(os.path.join(dirpath, target_file), \ srcpath.name) reflection(schema_info, gen_ref) print("\033[1;34mReflection:\033[0m\t%-60s \033[1;32mSuccess\033[0m" % (target_file)) else: # only parse files in current directory for target_file in os.listdir(schemapath.name): fullpath = os.path.join(schemapath.name, target_file) if fullpath.endswith(JSON_SUFFIX) and os.path.isfile(fullpath): schema_info = schema_from_file(fullpath, srcpath.name) reflection(schema_info, gen_ref) print("\033[1;34mReflection:\033[0m\t%-60s \033[1;32mSuccess\033[0m" % (fullpath)) else: if schemapath.name.endswith(JSON_SUFFIX): schema_info = schema_from_file(schemapath.name, srcpath.name) reflection(schema_info, gen_ref) print("\033[1;34mReflection:\033[0m\t%-60s \033[1;32mSuccess\033[0m" % (schemapath.name)) else: print('File %s does not end with .json' % schemapath.name) def handle_files(args, srcpath): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ for path in args.path: gen_ref = args.gen_ref schemapath = helpers.FilePath(path) handle_single_file(args, srcpath, gen_ref, schemapath) def main(): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ parser = argparse.ArgumentParser(prog='generate.py', usage='%(prog)s [options] path [path ...]', description='Generate C header and source from json-schema') parser.add_argument('path', nargs='*', help='File or directory to parse') parser.add_argument( '--root', required=True, help= 'All schema files must be placed in root directory or sub-directory of root," \ " and naming of C variables is started from this path' ) parser.add_argument('--gen-ref', action='store_true', help='Generate reference file defined in schema with key \"$ref\"') parser.add_argument('-r', '--recursive', action='store_true', help='Recursively generate all schema files in directory') parser.add_argument( '--out', help='Specify a directory to save C header and source(default is current directory)') args = parser.parse_args() if not args.root: print('Missing root path, see help') sys.exit(1) root_path = os.path.realpath(args.root) if not os.path.exists(root_path): print('Root %s does not exist' % args.root) sys.exit(1) MyRoot.root_path = root_path if args.out: srcpath = helpers.FilePath(args.out) else: srcpath = helpers.FilePath(os.getcwd()) if not os.path.exists(srcpath.name): os.makedirs(srcpath.name) handle_files(args, srcpath) if __name__ == "__main__": main() crun-1.16.1/libocispec/src/ocispec/headers.py0000755000000000000000000002471114614670103017264 0ustar0000000000000000# -*- coding: utf-8 -*- # # libocispec - a C library for parsing OCI spec files. # # Copyright (C) Huawei Technologies., Ltd. 2018-2020. # Copyright (C) 2017, 2019 Giuseppe Scrivano # libocispec 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. # # libocispec 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 libocispec. If not, see . # # As a special exception, you may create a larger work that contains # part or all of the libocispec parser skeleton and distribute that work # under terms of your choice, so long as that work isn't itself a # parser generator using the skeleton or a modified version thereof # as a parser skeleton. Alternatively, if you modify or redistribute # the parser skeleton itself, you may (at your option) remove this # special exception, which will cause the skeleton and the resulting # libocispec output files to be licensed under the GNU General Public # License without this special exception. import helpers def append_header_arr(obj, header, prefix): ''' Description: Write c header file of array Interface: None History: 2019-06-17 ''' if not obj.subtypobj or obj.subtypname: return header.append("typedef struct {\n") for i in obj.subtypobj: if i.typ == 'array': c_typ = helpers.get_prefixed_pointer(i.name, i.subtyp, prefix) or \ helpers.get_map_c_types(i.subtyp) if i.subtypobj is not None: c_typ = helpers.get_name_substr(i.name, prefix) if not helpers.judge_complex(i.subtyp): header.append(f" {c_typ}{' ' if '*' not in c_typ else ''}*{i.fixname};\n") else: header.append(f" {c_typ} **{i.fixname};\n") header.append(f" size_t {i.fixname + '_len'};\n\n") else: c_typ = helpers.get_prefixed_pointer(i.name, i.typ, prefix) or \ helpers.get_map_c_types(i.typ) header.append(f" {c_typ}{' ' if '*' not in c_typ else ''}{i.fixname};\n") for i in obj.subtypobj: if helpers.judge_data_type(i.typ) or i.typ == 'boolean': header.append(f" unsigned int {i.fixname}_present : 1;\n") typename = helpers.get_name_substr(obj.name, prefix) header.append(f"}}\n{typename};\n\n") header.append(f"void free_{typename} ({typename} *ptr);\n\n") header.append(f"{typename} *make_{typename} (yajl_val tree, const struct parser_context *ctx, parser_error *err);\n\n") def append_header_map_str_obj(obj, header, prefix): ''' Description: Write c header file of mapStringObject Interface: None History: 2019-06-17 ''' child = obj.children[0] header.append("typedef struct {\n") header.append(" char **keys;\n") if helpers.valid_basic_map_name(child.typ): c_typ = helpers.get_prefixed_pointer("", child.typ, "") elif child.subtypname: c_typ = child.subtypname else: c_typ = helpers.get_prefixed_pointer(child.name, child.typ, prefix) header.append(f" {c_typ}{' ' if '*' not in c_typ else ''}*{child.fixname};\n") header.append(" size_t len;\n") def append_header_child_arr(child, header, prefix): ''' Description: Write c header file of array of child Interface: None History: 2019-06-17 ''' if helpers.get_map_c_types(child.subtyp) != "": c_typ = helpers.get_map_c_types(child.subtyp) elif helpers.valid_basic_map_name(child.subtyp): c_typ = f'{helpers.make_basic_map_name(child.subtyp)} *' elif child.subtypname is not None: c_typ = child.subtypname elif child.subtypobj is not None: c_typ = helpers.get_name_substr(child.name, prefix) else: c_typ = helpers.get_prefixed_pointer(child.name, child.subtyp, prefix) dflag = "" if child.doublearray: dflag = "*" if helpers.valid_basic_map_name(child.subtyp): header.append(f" {helpers.make_basic_map_name(child.subtyp)} **{child.fixname};\n") elif not helpers.judge_complex(child.subtyp): header.append(f" {c_typ}{' ' if '*' not in c_typ else ''}*{dflag}{child.fixname};\n") else: header.append(f" {c_typ}{' ' if '*' not in c_typ else ''}**{dflag}{child.fixname};\n") if child.doublearray and not helpers.valid_basic_map_name(child.subtyp): header.append(f" size_t *{child.fixname + '_item_lens'};\n") header.append(f" size_t {child.fixname + '_len'};\n\n") def append_header_child_others(child, header, prefix): ''' Description: Write c header file of others of child Interface: None History: 2019-06-17 ''' if helpers.get_map_c_types(child.typ) != "": c_typ = helpers.get_map_c_types(child.typ) elif helpers.valid_basic_map_name(child.typ): c_typ = f'{helpers.make_basic_map_name(child.typ)} *' elif child.subtypname: c_typ = helpers.get_prefixed_pointer(child.subtypname, child.typ, "") else: c_typ = helpers.get_prefixed_pointer(child.name, child.typ, prefix) header.append(f" {c_typ}{' ' if '*' not in c_typ else ''}{child.fixname};\n\n") def append_type_c_header(obj, header, prefix): ''' Description: Write c header file Interface: None History: 2019-06-17 ''' if not helpers.judge_complex(obj.typ): return if obj.typ == 'array': append_header_arr(obj, header, prefix) return if obj.typ == 'mapStringObject': if obj.subtypname is not None: return append_header_map_str_obj(obj, header, prefix) elif obj.typ == 'object': if obj.subtypname is not None: return header.append("typedef struct {\n") if obj.children is None: header.append(" char unuseful; // unuseful definition to avoid empty struct\n") present_tags = [] for i in obj.children or []: if helpers.judge_data_type(i.typ) or i.typ == 'boolean': present_tags.append(f" unsigned int {i.fixname}_present : 1;\n") if i.typ == 'array': append_header_child_arr(i, header, prefix) else: append_header_child_others(i, header, prefix) if obj.children is not None: header.append(" yajl_val _residual;\n") if len(present_tags) > 0: header.append("\n") for tag in present_tags: header.append(tag) typename = helpers.get_prefixed_name(obj.name, prefix) header.append(f"}}\n{typename};\n\n") header.append(f"void free_{typename} ({typename} *ptr);\n\n") header.append(f"{typename} *make_{typename} (yajl_val tree, const struct parser_context *ctx, parser_error *err);\n\n") header.append(f"yajl_gen_status gen_{typename} (yajl_gen g, const {typename} *ptr, const struct parser_context *ctx, parser_error *err);\n\n") def header_reflect_top_array(obj, prefix, header): c_typ = helpers.get_prefixed_pointer(obj.name, obj.subtyp, prefix) or \ helpers.get_map_c_types(obj.subtyp) if obj.subtypobj is not None: if obj.doublearray and obj.subtypname is not None: c_typ = obj.subtypname + " *" else: c_typ = helpers.get_name_substr(obj.name, prefix) + " *" if c_typ == "": return typename = helpers.get_top_array_type_name(obj.name, prefix) header.append("typedef struct {\n") if obj.doublearray: header.append(f" {c_typ}{' ' if '*' not in c_typ else ''}**items;\n") header.append(" size_t *subitem_lens;\n\n") else: header.append(f" {c_typ}{' ' if '*' not in c_typ else ''}*items;\n") header.append(" size_t len;\n\n") header.append(f"}}\n{typename};\n\n") header.append(f"void free_{typename} ({typename} *ptr);\n\n") header.append(f"{typename} *{typename}_parse_file(const char *filename, const struct "\ "parser_context *ctx, parser_error *err);\n\n") header.append(f"{typename} *{typename}_parse_file_stream(FILE *stream, const struct "\ "parser_context *ctx, parser_error *err);\n\n") header.append(f"{typename} *{typename}_parse_data(const char *jsondata, const struct "\ "parser_context *ctx, parser_error *err);\n\n") header.append(f"char *{typename}_generate_json(const {typename} *ptr, "\ "const struct parser_context *ctx, parser_error *err);\n\n") def header_reflect(structs, schema_info, header): ''' Description: Reflection header files Interface: None History: 2019-06-17 ''' prefix = schema_info.prefix header.append(f"// Generated from {schema_info.name.basename}. Do not edit!\n") header.append(f"#ifndef {prefix.upper()}_SCHEMA_H\n") header.append(f"#define {prefix.upper()}_SCHEMA_H\n\n") header.append("#include \n") header.append("#include \n") header.append("#include \"ocispec/json_common.h\"\n") if schema_info.refs: for ref in schema_info.refs.keys(): header.append(f"#include \"ocispec/{ref}\"\n") header.append("\n#ifdef __cplusplus\n") header.append("extern \"C\" {\n") header.append("#endif\n\n") for i in structs: append_type_c_header(i, header, prefix) length = len(structs) toptype = structs[length - 1].typ if length != 0 else "" if toptype == 'object': header.append(f"{prefix} *{prefix}_parse_file(const char *filename, const struct parser_context *ctx, "\ "parser_error *err);\n\n") header.append(f"{prefix} *{prefix}_parse_file_stream(FILE *stream, const struct parser_context *ctx, "\ "parser_error *err);\n\n") header.append(f"{prefix} *{prefix}_parse_data(const char *jsondata, const struct parser_context *ctx, "\ "parser_error *err);\n\n") header.append(f"char *{prefix}_generate_json(const {prefix} *ptr, const struct parser_context *ctx, "\ "parser_error *err);\n\n") elif toptype == 'array': header_reflect_top_array(structs[length - 1], prefix, header) header.append("#ifdef __cplusplus\n") header.append("}\n") header.append("#endif\n\n") header.append("#endif\n\n") crun-1.16.1/libocispec/src/ocispec/helpers.py0000755000000000000000000002354414614670103017316 0ustar0000000000000000# -*- coding: utf-8 -*- # # libocispec - a C library for parsing OCI spec files. # # Copyright (C) Huawei Technologies., Ltd. 2018-2020. All rights reserved. # libocispec 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. # # libocispec 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 libocispec. If not, see . # # As a special exception, you may create a larger work that contains # part or all of the libocispec parser skeleton and distribute that work # under terms of your choice, so long as that work isn't itself a # parser generator using the skeleton or a modified version thereof # as a parser skeleton. Alternatively, if you modify or redistribute # the parser skeleton itself, you may (at your option) remove this # special exception, which will cause the skeleton and the resulting # libocispec output files to be licensed under the GNU General Public # License without this special exception. import os import sys cxx_reserved_keywords = ["class", "delete", "explicit", "friend", "mutable", "new", "operator", "private", "protected", "public", "throw", "try", "virtual"] def append_separator(substr): ''' Description: append only '_' at last position of subStr Interface: None History: 2019-09-20 ''' if substr and substr[-1] != '_': substr.append('_') def conv_to_c_style(name): ''' Description: convert name to linux c format Interface: None History: 2019-06-17 ''' if name is None or name == "": return "" # replace C++ reserved keywords (the generated C headers can be included in C++ applications) if name in cxx_reserved_keywords: name = '_' + name name = name.replace('.', '_').replace('-', '_').replace('/', '_') substr = [] preindex = 0 index = 0 for index, char in enumerate(name): if char == '_': append_separator(substr) substr.append(name[preindex:index].lower()) preindex = index + 1 if not char.isupper() and name[preindex].isupper() and \ name[preindex + 1].isupper(): append_separator(substr) substr.append(name[preindex:index - 1].lower()) preindex = index - 1 continue if char.isupper() and index > 0 and name[index - 1].islower(): append_separator(substr) substr.append(name[preindex:index].lower()) preindex = index if preindex <= index and index >= 0 and name[index] != '_' and \ preindex != 0: append_separator(substr) substr.append(name[preindex:index + 1].lower()) result = ''.join(substr) return result def get_map_c_types(typ): ''' Description: Get map c types Interface: None History: 2019-06-17 ''' map_c_types = { 'byte': 'uint8_t', 'string': 'char *', 'integer': 'int', 'boolean': 'bool', 'double': 'double', 'int8': 'int8_t', "int16": 'int16_t', "int32": "int32_t", "int64": "int64_t", 'uint8': 'uint8_t', "uint16": 'uint16_t', "uint32": "uint32_t", "uint64": "uint64_t", "UID": "uid_t", "GID": "gid_t", "booleanPointer": "bool *", 'bytePointer': 'uint8_t *', 'integerPointer': 'int *', 'doublePointer': 'double *', 'int8Pointer': 'int8_t *', "int16Pointer": 'int16_t *', "int32Pointer": "int32_t *", "int64Pointer": "int64_t *", 'uint8Pointer': 'uint8_t *', "uint16Pointer": 'uint16_t *', "uint32Pointer": "uint32_t *", "uint64Pointer": "uint64_t *", } if typ in map_c_types: return map_c_types[typ] return "" def valid_basic_map_name(typ): ''' Description: Valid basic map name Interface: None History: 2019-06-17 ''' return typ != 'mapStringObject' and hasattr(typ, 'startswith') and \ typ.startswith('map') def make_basic_map_name(mapname): ''' Description: Make basic map name Interface: None History: 2019-06-17 ''' basic_map_types = ('string', 'int', 'bool', 'int64') parts = conv_to_c_style(mapname).split('_') if len(parts) != 3 or parts[0] != 'map' or \ (parts[1] not in basic_map_types) or \ (parts[2] not in basic_map_types): print('Invalid map name: %s' % mapname) sys.exit(1) return "json_map_%s_%s" % (parts[1], parts[2]) def get_top_array_type_name(name, prefix): ''' Description: Make top array type to contain subtype and length Interface: None History: 2020-10-24 ''' return "%s_container" % prefix if name is None or name == "" or prefix == name \ else "%s_%s_container" % (prefix, name) def get_name_substr(name, prefix): ''' Description: Make array name Interface: None History: 2019-06-17 ''' return "%s_element" % prefix if name is None or name == "" or prefix == name \ else "%s_%s_element" % (prefix, name) def get_prefixed_name(name, prefix): ''' Description: Make name Interface: None History: 2019-06-17 ''' if name is None or name == "" or prefix.endswith(name): return "%s" % prefix if prefix is None or prefix == "" or prefix == name or name.endswith(prefix): return "%s" % name return "%s_%s" % (prefix, name) def get_prefixed_pointer(name, typ, prefix): ''' Description: Make pointer name Interface: None History: 2019-06-17 ''' if typ != 'object' and typ != 'mapStringObject' and \ not valid_basic_map_name(typ): return "" return '%s *' % make_basic_map_name(typ) if valid_basic_map_name(typ) \ else "%s *" % get_prefixed_name(name, prefix) def judge_complex(typ): ''' Description: Check compound object Interface: None History: 2019-06-17 ''' return typ in ('object', 'array', 'mapStringObject') def judge_data_type(typ): ''' Description: Check numeric type Interface: None History: 2019-06-17 ''' if (typ.startswith("int") or typ.startswith("uint")) and \ "Pointer" not in typ: return True return typ in ("integer", "UID", "GID", "double") def judge_data_pointer_type(typ): ''' Description: Check numeric pointer type Interface: None History: 2019-06-17 ''' if (typ.startswith("int") or typ.startswith("uint")) and "Pointer" in typ: return True return False def obtain_data_pointer_type(typ): ''' Description: Get numeric pointer type Interface: None History: 2019-06-17 ''' index = typ.find("Pointer") return typ[0:index] if index != -1 else "" def obtain_pointer(name, typ, prefix): ''' Description: Obtain pointer string Interface: None History: 2019-06-17 ''' ptr = get_prefixed_pointer(name, typ, prefix) if ptr != "": return ptr return "char *" if typ == "string" else \ ("%s *" % typ if typ == "ArrayOfStrings" else "") class CombinateName(object): ''' Description: Store CombinateName information Interface: None History: 2019-06-17 ''' def __init__(self, name, leaf=None): self.name = name self.leaf = leaf def __repr__(self): return self.name def append(self, leaf): ''' Description: append name Interface: None History: 2019-06-17 ''' prefix_name = self.name + '_' if self.name != "" else "" return CombinateName(prefix_name + leaf, leaf) class Unite(object): ''' Description: Store Unite information Interface: None History: 2019-06-17 ''' def __init__(self, name, typ, children, subtyp=None, subtypobj=None, subtypname=None, \ required=None, doublearray=False): self.typ = typ self.children = children self.subtyp = subtyp self.subtypobj = subtypobj self.subtypname = subtypname self.required = required self.name = conv_to_c_style(name.name.replace('.', '_')) self.origname = name.leaf or name.name self.fixname = conv_to_c_style(self.origname.replace('.', '_')) self.doublearray = doublearray def __repr__(self): if self.subtyp is not None: return "name:(%s) type:(%s -> %s)" \ % (self.name, self.typ, self.subtyp) return "name:(%s) type:(%s)" % (self.name, self.typ) class FilePath(object): ''' Description: Store filepath information Interface: None History: 2019-06-17 ''' def __init__(self, name): self.name = os.path.realpath(name) self.dirname = os.path.dirname(self.name) self.basename = os.path.basename(self.name) def __repr__(self): return "{name:(%s) dirname:(%s) basename:(%s)}" \ % (self.name, self.dirname, self.basename) class SchemaInfo(object): ''' Description: Store schema information Interface: None History: 2019-06-17 ''' def __init__(self, name, header, source, prefix, filesdir, refs=None): self.name = name self.fileprefix = conv_to_c_style( \ name.basename.replace('.', '_').replace('-', '_')) self.header = header self.source = source self.prefix = prefix self.refs = refs self.filesdir = os.path.realpath(filesdir) def __repr__(self): return "{name:(%s) header:(%s) source:(%s) prefix:(%s)}" \ % (self.name, self.header, self.source, self.prefix) crun-1.16.1/libocispec/src/ocispec/sources.py0000755000000000000000000022455614614670103017345 0ustar0000000000000000# -*- coding: utf-8 -*- # # libocispec - a C library for parsing OCI spec files. # # Copyright (C) Huawei Technologies., Ltd. 2018-2020. # Copyright (C) 2017, 2019 Giuseppe Scrivano # # libocispec 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. # # libocispec 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 libocispec. If not, see . # # As a special exception, you may create a larger work that contains # part or all of the libocispec parser skeleton and distribute that work # under terms of your choice, so long as that work isn't itself a # parser generator using the skeleton or a modified version thereof # as a parser skeleton. Alternatively, if you modify or redistribute # the parser skeleton itself, you may (at your option) remove this # special exception, which will cause the skeleton and the resulting # libocispec output files to be licensed under the GNU General Public # License without this special exception. import helpers def append_c_code(obj, c_file, prefix): """ Description: append c language code to file Interface: None History: 2019-06-17 """ parse_json_to_c(obj, c_file, prefix) make_c_free (obj, c_file, prefix) get_c_json(obj, c_file, prefix) def parse_map_string_obj(obj, c_file, prefix, obj_typename): """ Description: generate c language for parse json map string object Interface: None History: 2019-06-17 """ child = obj.children[0] if helpers.valid_basic_map_name(child.typ): childname = helpers.make_basic_map_name(child.typ) else: if child.subtypname: childname = child.subtypname else: childname = helpers.get_prefixed_name(child.name, prefix) c_file.append(' if (YAJL_GET_OBJECT (tree) != NULL)\n') c_file.append(' {\n') c_file.append(' size_t i;\n') c_file.append(' size_t len = YAJL_GET_OBJECT_NO_CHECK (tree)->len;\n') c_file.append(' const char **keys = YAJL_GET_OBJECT_NO_CHECK (tree)->keys;\n') c_file.append(' yajl_val *values = YAJL_GET_OBJECT_NO_CHECK (tree)->values;\n') c_file.append(' ret->len = len;\n') c_file.append(' ret->keys = calloc (len + 1, sizeof (*ret->keys));\n') c_file.append(' if (ret->keys == NULL)\n') c_file.append(' return NULL;\n') c_file.append(f' ret->{child.fixname} = calloc (len + 1, sizeof (*ret->{child.fixname}));\n') c_file.append(f' if (ret->{child.fixname} == NULL)\n') c_file.append(' return NULL;\n') c_file.append(' for (i = 0; i < len; i++)\n') c_file.append(' {\n') c_file.append(' yajl_val val;\n') c_file.append(' const char *tmpkey = keys[i];\n') c_file.append(' ret->keys[i] = strdup (tmpkey ? tmpkey : "");\n') c_file.append(' if (ret->keys[i] == NULL)\n') c_file.append(" return NULL;\n") c_file.append(' val = values[i];\n') c_file.append(f' ret->{child.fixname}[i] = make_{childname} (val, ctx, err);\n') c_file.append(f' if (ret->{child.fixname}[i] == NULL)\n') c_file.append(" return NULL;\n") c_file.append(' }\n') c_file.append(' }\n') def parse_obj_type_array(obj, c_file, prefix, obj_typename): if obj.subtypobj or obj.subtyp == 'object': if obj.subtypname: typename = obj.subtypname else: typename = helpers.get_name_substr(obj.name, prefix) c_file.append(' do\n') c_file.append(' {\n') c_file.append(f' yajl_val tmp = get_val (tree, "{obj.origname}", yajl_t_array);\n') c_file.append(' if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL)\n') c_file.append(' {\n') c_file.append(' size_t i;\n') c_file.append(' size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len;\n') c_file.append(' yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values;\n') c_file.append(f' ret->{obj.fixname}_len = len;\n') c_file.append(f' ret->{obj.fixname} = calloc (len + 1, sizeof (*ret->{obj.fixname}));\n') c_file.append(f' if (ret->{obj.fixname} == NULL)\n') c_file.append(' return NULL;\n') if obj.doublearray: c_file.append(f' ret->{obj.fixname}_item_lens = calloc ( len + 1, sizeof (size_t));\n') c_file.append(f' if (ret->{obj.fixname}_item_lens == NULL)\n') c_file.append(' return NULL;\n') c_file.append(' for (i = 0; i < len; i++)\n') c_file.append(' {\n') c_file.append(' yajl_val val = values[i];\n') if obj.doublearray: c_file.append(' size_t j;\n') c_file.append(f' ret->{obj.fixname}[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(val)->len + 1, sizeof (**ret->{obj.fixname}));\n') c_file.append(f' if (ret->{obj.fixname}[i] == NULL)\n') c_file.append(' return NULL;\n') c_file.append(' yajl_val *items = YAJL_GET_ARRAY_NO_CHECK(val)->values;\n') c_file.append(' for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(val)->len; j++)\n') c_file.append(' {\n') c_file.append(f' ret->{obj.fixname}[i][j] = make_{typename} (items[j], ctx, err);\n') c_file.append(f' if (ret->{obj.fixname}[i][j] == NULL)\n') c_file.append(" return NULL;\n") c_file.append(f' ret->{obj.fixname}_item_lens[i] += 1;\n') c_file.append(' };\n') else: c_file.append(f' ret->{obj.fixname}[i] = make_{typename} (val, ctx, err);\n') c_file.append(f' if (ret->{obj.fixname}[i] == NULL)\n') c_file.append(" return NULL;\n") c_file.append(' }\n') c_file.append(' }\n') c_file.append(' }\n') c_file.append(' while (0);\n') elif obj.subtyp == 'byte': c_file.append(' do\n') c_file.append(' {\n') c_file.append(f' yajl_val tmp = get_val (tree, "{obj.origname}", yajl_t_string);\n') c_file.append(' if (tmp != NULL)\n') c_file.append(' {\n') if obj.doublearray: c_file.append(' yajl_val *items = YAJL_GET_ARRAY_NO_CHECK(tmp)->values;\n') c_file.append(f' ret->{obj.fixname} = calloc ( YAJL_GET_ARRAY_NO_CHECK(tmp)->len + 1, sizeof (*ret->{obj.fixname}));\n') c_file.append(f' if (ret->{obj.fixname}[i] == NULL)\n') c_file.append(' return NULL;\n') c_file.append(' size_t j;\n') c_file.append(' for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(tmp)->len; j++)\n') c_file.append(' {\n') c_file.append(' char *str = YAJL_GET_STRING (itmes[j]);\n') c_file.append(f' ret->{obj.fixname}[j] = (uint8_t *)strdup (str ? str : "");\n') c_file.append(f' if (ret->{obj.fixname}[j] == NULL)\n') c_file.append(" return NULL;\n") c_file.append(' };\n') else: c_file.append(' char *str = YAJL_GET_STRING (tmp);\n') c_file.append(f' ret->{obj.fixname} = (uint8_t *)strdup (str ? str : "");\n') c_file.append(f' if (ret->{obj.fixname} == NULL)\n') c_file.append(' return NULL;\n') c_file.append(f' ret->{obj.fixname}_len = str != NULL ? strlen (str) : 0;\n') c_file.append(' }\n') c_file.append(' }\n') c_file.append(' while (0);\n') else: c_file.append(' do\n') c_file.append(' {\n') c_file.append(f' yajl_val tmp = get_val (tree, "{obj.origname}", yajl_t_array);\n') c_file.append(' if (tmp != NULL && YAJL_GET_ARRAY (tmp) != NULL)\n') c_file.append(' {\n') c_file.append(' size_t i;\n') c_file.append(' size_t len = YAJL_GET_ARRAY_NO_CHECK (tmp)->len;\n') c_file.append(' yajl_val *values = YAJL_GET_ARRAY_NO_CHECK (tmp)->values;\n') c_file.append(f' ret->{obj.fixname}_len = len;\n') c_file.append(f' ret->{obj.fixname} = calloc (len + 1, sizeof (*ret->{obj.fixname}));\n') c_file.append(f' if (ret->{obj.fixname} == NULL)\n') c_file.append(' return NULL;\n') if obj.doublearray: c_file.append(f' ret->{obj.fixname}_item_lens = calloc ( len + 1, sizeof (size_t));\n') c_file.append(f' if (ret->{obj.fixname}_item_lens == NULL)\n') c_file.append(' return NULL;\n') c_file.append(' for (i = 0; i < len; i++)\n') c_file.append(' {\n') if obj.doublearray: c_file.append(' yajl_val *items = YAJL_GET_ARRAY_NO_CHECK(values[i])->values;\n') c_file.append(f' ret->{obj.fixname}[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(values[i])->len + 1, sizeof (**ret->{obj.fixname}));\n') c_file.append(f' if (ret->{obj.fixname}[i] == NULL)\n') c_file.append(' return NULL;\n') c_file.append(' size_t j;\n') c_file.append(' for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(values[i])->len; j++)\n') c_file.append(' {\n') read_val_generator(c_file, 5, 'items[j]', \ f"ret->{obj.fixname}[i][j]", obj.subtyp, obj.origname, obj_typename) c_file.append(f' ret->{obj.fixname}_item_lens[i] += 1;\n') c_file.append(' };\n') else: read_val_generator(c_file, 4, 'values[i]', \ f"ret->{obj.fixname}[i]", obj.subtyp, obj.origname, obj_typename) c_file.append(' }\n') c_file.append(' }\n') c_file.append(' }\n') c_file.append(' while (0);\n') def parse_obj_type(obj, c_file, prefix, obj_typename): """ Description: generate c language for parse object type Interface: None History: 2019-06-17 """ if obj.typ == 'string': c_file.append(' do\n') c_file.append(' {\n') read_val_generator(c_file, 2, f'get_val (tree, "{obj.origname}", yajl_t_string)', \ f"ret->{obj.fixname}", obj.typ, obj.origname, obj_typename) c_file.append(' }\n') c_file.append(' while (0);\n') elif helpers.judge_data_type(obj.typ): c_file.append(' do\n') c_file.append(' {\n') read_val_generator(c_file, 2, f'get_val (tree, "{obj.origname}", yajl_t_number)', \ f"ret->{obj.fixname}", obj.typ, obj.origname, obj_typename) c_file.append(' }\n') c_file.append(' while (0);\n') elif helpers.judge_data_pointer_type(obj.typ): c_file.append(' do\n') c_file.append(' {\n') read_val_generator(c_file, 2, f'get_val (tree, "{obj.origname}", yajl_t_number)', \ f"ret->{obj.fixname}", obj.typ, obj.origname, obj_typename) c_file.append(' }\n') c_file.append(' while (0);\n') if obj.typ == 'boolean': c_file.append(' do\n') c_file.append(' {\n') read_val_generator(c_file, 2, f'get_val (tree, "{obj.origname}", yajl_t_true)', \ f"ret->{obj.fixname}", obj.typ, obj.origname, obj_typename) c_file.append(' }\n') c_file.append(' while (0);\n') if obj.typ == 'booleanPointer': c_file.append(' do\n') c_file.append(' {\n') read_val_generator(c_file, 2, f'get_val (tree, "{obj.origname}", yajl_t_true)', \ f"ret->{obj.fixname}", obj.typ, obj.origname, obj_typename) c_file.append(' }\n') c_file.append(' while (0);\n') elif obj.typ == 'object' or obj.typ == 'mapStringObject': if obj.subtypname is not None: typename = obj.subtypname else: typename = helpers.get_prefixed_name(obj.name, prefix) c_file.append( f' ret->{obj.fixname} = make_{typename} (get_val (tree, "{obj.origname}", yajl_t_object), ctx, err);\n') c_file.append(f" if (ret->{obj.fixname} == NULL && *err != 0)\n") c_file.append(" return NULL;\n") elif obj.typ == 'array': parse_obj_type_array(obj, c_file, prefix, obj_typename) elif helpers.valid_basic_map_name(obj.typ): c_file.append(' do\n') c_file.append(' {\n') c_file.append(f' yajl_val tmp = get_val (tree, "{obj.origname}", yajl_t_object);\n') c_file.append(' if (tmp != NULL)\n') c_file.append(' {\n') c_file.append(f' ret->{obj.fixname} = make_{helpers.make_basic_map_name(obj.typ)} (tmp, ctx, err);\n') c_file.append(f' if (ret->{obj.fixname} == NULL)\n') c_file.append(' {\n') c_file.append(' char *new_error = NULL;\n') c_file.append(f" if (asprintf (&new_error, \"Value error for key '{obj.origname}': %s\", *err ? *err : \"null\") < 0)\n") c_file.append(' new_error = strdup (' \ '"error allocating memory");\n') c_file.append(' free (*err);\n') c_file.append(' *err = new_error;\n') c_file.append(' return NULL;\n') c_file.append(' }\n') c_file.append(' }\n') c_file.append(' }\n') c_file.append(' while (0);\n') def parse_obj_arr_obj(obj, c_file, prefix, obj_typename): """ Description: generate c language for parse object or array object Interface: None History: 2019-06-17 """ nodes = obj.children if obj.typ == 'object' else obj.subtypobj required_to_check = [] for i in nodes or []: if obj.required and i.origname in obj.required and \ not helpers.judge_data_type(i.typ) and i.typ != 'boolean': required_to_check.append(i) parse_obj_type(i, c_file, prefix, obj_typename) for i in required_to_check: c_file.append(f' if (ret->{i.fixname} == NULL)\n') c_file.append(' {\n') c_file.append(f' if (asprintf (err, "Required field \'%s\' not present", "{i.origname}") < 0)\n') c_file.append(' *err = strdup ("error allocating memory");\n') c_file.append(" return NULL;\n") c_file.append(' }\n') if obj.typ == 'object' and obj.children is not None: # O(n^2) complexity, but the objects should not really be big... condition = "\n && ".join( \ [f'strcmp (tree->u.object.keys[i], "{i.origname}")' for i in obj.children]) c_file.append(""" if (tree->type == yajl_t_object) { size_t i; size_t j = 0; size_t cnt = tree->u.object.len; yajl_val resi = NULL; if (ctx->options & OPT_PARSE_FULLKEY) { resi = calloc (1, sizeof(*tree)); if (resi == NULL) return NULL; resi->type = yajl_t_object; resi->u.object.keys = calloc (cnt, sizeof (const char *)); if (resi->u.object.keys == NULL) { yajl_tree_free (resi); return NULL; } resi->u.object.values = calloc (cnt, sizeof (yajl_val)); if (resi->u.object.values == NULL) { yajl_tree_free (resi); return NULL; } } for (i = 0; i < tree->u.object.len; i++) {""" \ f"if ({condition})" \ """{ if (ctx->options & OPT_PARSE_FULLKEY) { resi->u.object.keys[j] = tree->u.object.keys[i]; tree->u.object.keys[i] = NULL; resi->u.object.values[j] = tree->u.object.values[i]; tree->u.object.values[i] = NULL; resi->u.object.len++; } j++; } } if (ctx->options & OPT_PARSE_STRICT) { if (j > 0 && ctx->errfile != NULL) (void) fprintf (ctx->errfile, "WARNING: unknown key found\\n"); } if (ctx->options & OPT_PARSE_FULLKEY) ret->_residual = resi; } """) def parse_json_to_c(obj, c_file, prefix): """ Description: generate c language for parse json file Interface: None History: 2019-06-17 """ if not helpers.judge_complex(obj.typ): return if obj.typ == 'object' or obj.typ == 'mapStringObject': if obj.subtypname: return obj_typename = typename = helpers.get_prefixed_name(obj.name, prefix) if obj.typ == 'array': obj_typename = typename = helpers.get_name_substr(obj.name, prefix) objs = obj.subtypobj if objs is None or obj.subtypname: return c_file.append(f"define_cleaner_function ({typename} *, free_{typename})\n") c_file.append(f"{typename} *\nmake_{typename} (yajl_val tree, const struct parser_context *ctx, parser_error *err)\n") c_file.append("{\n") c_file.append(f" __auto_cleanup(free_{typename}) {typename} *ret = NULL;\n") c_file.append(" *err = NULL;\n") c_file.append(" (void) ctx; /* Silence compiler warning. */\n") c_file.append(" if (tree == NULL)\n") c_file.append(" return NULL;\n") c_file.append(" ret = calloc (1, sizeof (*ret));\n") c_file.append(" if (ret == NULL)\n") c_file.append(" return NULL;\n") if obj.typ == 'mapStringObject': parse_map_string_obj(obj, c_file, prefix, obj_typename) if obj.typ == 'object' or (obj.typ == 'array' and obj.subtypobj): parse_obj_arr_obj(obj, c_file, prefix, obj_typename) c_file.append(' return move_ptr (ret);\n') c_file.append("}\n\n") def get_map_string_obj(obj, c_file, prefix): """ Description: c language generate map string object Interface: None History: 2019-06-17 """ child = obj.children[0] if helpers.valid_basic_map_name(child.typ): childname = helpers.make_basic_map_name(child.typ) else: if child.subtypname: childname = child.subtypname else: childname = helpers.get_prefixed_name(child.name, prefix) c_file.append(' size_t len = 0, i;\n') c_file.append(" if (ptr != NULL)\n") c_file.append(" len = ptr->len;\n") c_file.append(" if (!len && !(ctx->options & OPT_GEN_SIMPLIFY))\n") c_file.append(' yajl_gen_config (g, yajl_gen_beautify, 0);\n') c_file.append(" stat = yajl_gen_map_open ((yajl_gen) g);\n") c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(f' if (len || (ptr != NULL && ptr->keys != NULL && ptr->{child.fixname} != NULL))\n') c_file.append(' {\n') c_file.append(' for (i = 0; i < len; i++)\n') c_file.append(' {\n') c_file.append(' char *str = ptr->keys[i] ? ptr->keys[i] : "";\n') c_file.append(' stat = yajl_gen_string ((yajl_gen) g, \ (const unsigned char *)str, strlen (str));\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(f' stat = gen_{childname} (g, ptr->{child.fixname}[i], ctx, err);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(' }\n') c_file.append(' }\n') c_file.append(" stat = yajl_gen_map_close ((yajl_gen) g);\n") c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" if (!len && !(ctx->options & OPT_GEN_SIMPLIFY))\n") c_file.append(' yajl_gen_config (g, yajl_gen_beautify, 1);\n') def get_obj_arr_obj_array(obj, c_file, prefix): if obj.subtypobj or obj.subtyp == 'object': l = len(obj.origname) if obj.subtypname: typename = obj.subtypname else: typename = helpers.get_name_substr(obj.name, prefix) c_file.append(f' if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->{obj.fixname} != NULL))\n') c_file.append(' {\n') c_file.append(' size_t len = 0, i;\n') c_file.append(f' stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("{obj.origname}"), {int(l)} /* strlen ("{obj.origname}") */);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(f" if (ptr != NULL && ptr->{obj.fixname} != NULL)\n") c_file.append(f" len = ptr->{obj.fixname}_len;\n") c_file.append(" if (!len && !(ctx->options & OPT_GEN_SIMPLIFY))\n") c_file.append(' yajl_gen_config (g, yajl_gen_beautify, 0);\n') c_file.append(' stat = yajl_gen_array_open ((yajl_gen) g);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(' for (i = 0; i < len; i++)\n') c_file.append(' {\n') if obj.doublearray: c_file.append(' stat = yajl_gen_array_open ((yajl_gen) g);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" size_t j;\n") c_file.append(f' for (j = 0; j < ptr->{obj.fixname}_item_lens[i]; j++)\n') c_file.append(' {\n') c_file.append(f' stat = gen_{typename} (g, ptr->{obj.fixname}[i][j], ctx, err);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(' }\n') c_file.append(' stat = yajl_gen_array_close ((yajl_gen) g);\n') else: c_file.append(f' stat = gen_{typename} (g, ptr->{obj.fixname}[i], ctx, err);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(' }\n') c_file.append(' stat = yajl_gen_array_close ((yajl_gen) g);\n') c_file.append(" if (!len && !(ctx->options & OPT_GEN_SIMPLIFY))\n") c_file.append(' yajl_gen_config (g, yajl_gen_beautify, 1);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(' }\n') elif obj.subtyp == 'byte': l = len(obj.origname) c_file.append(f' if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->{obj.fixname} != NULL && ptr->{obj.fixname}_len))\n') c_file.append(' {\n') c_file.append(' const char *str = "";\n') c_file.append(' size_t len = 0;\n') c_file.append(f' stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("{obj.origname}"), {l} /* strlen ("{obj.origname}") */);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") if obj.doublearray: c_file.append(' stat = yajl_gen_array_open ((yajl_gen) g);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" {\n") c_file.append(" size_t i;\n") c_file.append(f" for (i = 0; i < ptr->{obj.fixname}_len; i++)\n") c_file.append(" {\n") c_file.append(f" if (ptr->{obj.fixname}[i] != NULL)\n") c_file.append(f" str = (const char *)ptr->{obj.fixname}[i];\n") c_file.append(" else ()\n") c_file.append(" str = "";\n") c_file.append(' stat = yajl_gen_string ((yajl_gen) g, \ (const unsigned char *)str, strlen(str));\n') c_file.append(" }\n") c_file.append(" }\n") c_file.append(' stat = yajl_gen_array_close ((yajl_gen) g);\n') else: c_file.append(f" if (ptr != NULL && ptr->{obj.fixname} != NULL)\n") c_file.append(" {\n") c_file.append(f" str = (const char *)ptr->{obj.fixname};\n") c_file.append(f" len = ptr->{obj.fixname}_len;\n") c_file.append(" }\n") c_file.append(' stat = yajl_gen_string ((yajl_gen) g, \ (const unsigned char *)str, len);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" }\n") else: l = len(obj.origname) c_file.append(f' if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->{obj.fixname} != NULL))\n') c_file.append(' {\n') c_file.append(' size_t len = 0, i;\n') c_file.append(f' stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("{obj.origname}"), {l} /* strlen ("{obj.origname}") */);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(f" if (ptr != NULL && ptr->{obj.fixname} != NULL)\n") c_file.append(f" len = ptr->{obj.fixname}_len;\n") c_file.append(" if (!len && !(ctx->options & OPT_GEN_SIMPLIFY))\n") c_file.append(' yajl_gen_config (g, yajl_gen_beautify, 0);\n') c_file.append(' stat = yajl_gen_array_open ((yajl_gen) g);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(' for (i = 0; i < len; i++)\n') c_file.append(' {\n') if obj.doublearray: typename = helpers.get_map_c_types(obj.subtyp) c_file.append(' stat = yajl_gen_array_open ((yajl_gen) g);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" size_t j;\n") c_file.append(f' for (j = 0; j < ptr->{obj.fixname}_item_lens[i]; j++)\n') c_file.append(' {\n') json_value_generator(c_file, 4, f"ptr->{obj.fixname}[i][j]", 'g', 'ctx', obj.subtyp) c_file.append(' }\n') c_file.append(' stat = yajl_gen_array_close ((yajl_gen) g);\n') else: json_value_generator(c_file, 3, f"ptr->{obj.fixname}[i]", 'g', 'ctx', obj.subtyp) c_file.append(' }\n') c_file.append(' stat = yajl_gen_array_close ((yajl_gen) g);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" if (!len && !(ctx->options & OPT_GEN_SIMPLIFY))\n") c_file.append(' yajl_gen_config (g, yajl_gen_beautify, 1);\n') c_file.append(' }\n') def get_obj_arr_obj(obj, c_file, prefix): """ Description: c language generate object or array object Interface: None History: 2019-06-17 """ if obj.typ == 'string': l = len(obj.origname) c_file.append(f' if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->{obj.fixname} != NULL))\n' ) c_file.append(' {\n') c_file.append(' char *str = "";\n') c_file.append(f' stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("{obj.origname}"), {l} /* strlen ("{obj.origname}") */);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(f" if (ptr != NULL && ptr->{obj.fixname} != NULL)\n") c_file.append(f" str = ptr->{obj.fixname};\n") json_value_generator(c_file, 2, "str", 'g', 'ctx', obj.typ) c_file.append(" }\n") elif helpers.judge_data_type(obj.typ): c_file.append(f' if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->{obj.fixname}_present))\n') c_file.append(' {\n') if obj.typ == 'double': numtyp = 'double' elif obj.typ.startswith("uint") or obj.typ == 'GID' or obj.typ == 'UID': numtyp = 'long long unsigned int' else: numtyp = 'long long int' l = len(obj.origname) c_file.append(f' {numtyp} num = 0;\n') c_file.append(f' stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("{obj.origname}"), {l} /* strlen ("{obj.origname}") */);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(f" if (ptr != NULL && ptr->{obj.fixname})\n") c_file.append(f" num = ({numtyp})ptr->{obj.fixname};\n") json_value_generator(c_file, 2, "num", 'g', 'ctx', obj.typ) c_file.append(" }\n") elif helpers.judge_data_pointer_type(obj.typ): c_file.append(f' if ((ptr != NULL && ptr->{obj.fixname} != NULL))\n') c_file.append(' {\n') numtyp = helpers.obtain_data_pointer_type(obj.typ) if numtyp == "": return l = len(obj.origname) c_file.append(f' {helpers.get_map_c_types(numtyp)} num = 0;\n') c_file.append(f' stat = yajl_gen_string ((yajl_gen) g, \ (const unsigned char *)("{obj.origname}"), {l} /* strlen ("{obj.origname}") */);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(f" if (ptr != NULL && ptr->{obj.fixname} != NULL)\n") c_file.append(" {\n") c_file.append(f" num = ({helpers.get_map_c_types(numtyp)})*(ptr->{obj.fixname});\n") c_file.append(" }\n") json_value_generator(c_file, 2, "num", 'g', 'ctx', numtyp) c_file.append(" }\n") elif obj.typ == 'boolean': c_file.append(f' if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->{obj.fixname}_present))\n') c_file.append(' {\n') c_file.append(' bool b = false;\n') l = len(obj.origname) c_file.append(f' stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("{obj.origname}"), {l} /* strlen ("{obj.origname}") */);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(f" if (ptr != NULL && ptr->{obj.fixname})\n") c_file.append(f" b = ptr->{obj.fixname};\n") c_file.append(" \n") json_value_generator(c_file, 2, "b", 'g', 'ctx', obj.typ) c_file.append(" }\n") elif obj.typ == 'object' or obj.typ == 'mapStringObject': l = len(obj.origname) if obj.subtypname: typename = obj.subtypname else: typename = helpers.get_prefixed_name(obj.name, prefix) c_file.append(f' if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->{obj.fixname} != NULL))\n') c_file.append(" {\n") c_file.append(f' stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("{obj.origname}"), {l} /* strlen ("{obj.origname}") */);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(f' stat = gen_{typename} (g, ptr != NULL ? ptr->{obj.fixname} : NULL, ctx, err);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" }\n") elif obj.typ == 'array': get_obj_arr_obj_array(obj, c_file, prefix) elif helpers.valid_basic_map_name(obj.typ): l = len(obj.origname) c_file.append(f' if ((ctx->options & OPT_GEN_KEY_VALUE) || (ptr != NULL && ptr->{obj.fixname} != NULL))\n') c_file.append(' {\n') c_file.append(f' stat = yajl_gen_string ((yajl_gen) g, (const unsigned char *)("{obj.fixname}"), {l} /* strlen ("{obj.fixname}") */);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(f' stat = gen_{helpers.make_basic_map_name(obj.typ)} (g, ptr ? ptr->{obj.fixname} : NULL, ctx, err);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" }\n") def get_c_json(obj, c_file, prefix): """ Description: c language generate json file Interface: None History: 2019-06-17 """ if not helpers.judge_complex(obj.typ) or obj.subtypname: return if obj.typ == 'object' or obj.typ == 'mapStringObject': typename = helpers.get_prefixed_name(obj.name, prefix) elif obj.typ == 'array': typename = helpers.get_name_substr(obj.name, prefix) objs = obj.subtypobj if objs is None: return c_file.append( f"yajl_gen_status\ngen_{typename} (yajl_gen g, const {typename} *ptr, const struct parser_context " \ "*ctx, parser_error *err)\n") c_file.append("{\n") c_file.append(" yajl_gen_status stat = yajl_gen_status_ok;\n") c_file.append(" *err = NULL;\n") c_file.append(" (void) ptr; /* Silence compiler warning. */\n") if obj.typ == 'mapStringObject': get_map_string_obj(obj, c_file, prefix) elif obj.typ == 'object' or (obj.typ == 'array' and obj.subtypobj): nodes = obj.children if obj.typ == 'object' else obj.subtypobj if nodes is None: c_file.append(' if (!(ctx->options & OPT_GEN_SIMPLIFY))\n') c_file.append(' yajl_gen_config (g, yajl_gen_beautify, 0);\n') c_file.append(" stat = yajl_gen_map_open ((yajl_gen) g);\n") c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") for i in nodes or []: get_obj_arr_obj(i, c_file, prefix) if obj.typ == 'object': if obj.children is not None: c_file.append(" if (ptr != NULL && ptr->_residual != NULL)\n") c_file.append(" {\n") c_file.append(" stat = gen_yajl_object_residual (ptr->_residual, g, err);\n") c_file.append(" if (yajl_gen_status_ok != stat)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" }\n") c_file.append(" stat = yajl_gen_map_close ((yajl_gen) g);\n") c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") if nodes is None: c_file.append(' if (!(ctx->options & OPT_GEN_SIMPLIFY))\n') c_file.append(' yajl_gen_config (g, yajl_gen_beautify, 1);\n') c_file.append(' return yajl_gen_status_ok;\n') c_file.append("}\n\n") def read_val_generator(c_file, level, src, dest, typ, keyname, obj_typename): """ Description: read value generateor Interface: None History: 2019-06-17 """ if helpers.valid_basic_map_name(typ): c_file.append(f"{' ' * level}yajl_val val = {src};\n") c_file.append(f"{' ' * level}if (val != NULL)\n") c_file.append(f'{" " * level} {{\n') c_file.append(f'{" " * (level + 1)}{dest} = make_{helpers.make_basic_map_name(typ)} (val, ctx, err);\n') c_file.append(f"{' ' * (level + 1)}if ({dest} == NULL)\n") c_file.append(f'{" " * (level + 1)} {{\n') c_file.append(f"{' ' * (level + 1)} char *new_error = NULL;\n") c_file.append(f"{' ' * (level + 1)} if (asprintf (&new_error, \"Value error for key '{keyname}': %s\", *err ? *err : \"null\") < 0)\n") c_file.append(f'{" " * (level + 1)} new_error = strdup ("error allocating memory");\n') c_file.append(f"{' ' * (level + 1)} free (*err);\n") c_file.append(f"{' ' * (level + 1)} *err = new_error;\n") c_file.append(f"{' ' * (level + 1)} return NULL;\n") c_file.append(f'{" " * (level + 1)} }}\n') c_file.append(f'{" " * (level)}}}\n') elif typ == 'string': c_file.append(f"{' ' * level}yajl_val val = {src};\n") c_file.append(f"{' ' * level}if (val != NULL)\n") c_file.append(f"{' ' * (level)} {{\n") c_file.append(f"{' ' * (level + 1)}char *str = YAJL_GET_STRING (val);\n") c_file.append(f"{' ' * (level + 1)}{dest} = strdup (str ? str : \"\");\n") c_file.append(f"{' ' * (level + 1)}if ({dest} == NULL)\n") c_file.append(f"{' ' * (level + 1)} return NULL;\n") c_file.append(f'{" " * level} }}\n') elif helpers.judge_data_type(typ): c_file.append(f"{' ' * level}yajl_val val = {src};\n") c_file.append(f"{' ' * level}if (val != NULL)\n") c_file.append(f'{" " * (level)} {{\n') if typ.startswith("uint") or \ (typ.startswith("int") and typ != "integer") or typ == "double": c_file.append(f"{' ' * (level + 1)}int invalid;\n") c_file.append(f"{' ' * (level + 1)}if (! YAJL_IS_NUMBER (val))\n") c_file.append(f'{" " * (level + 1)} {{\n') c_file.append(f"{' ' * (level + 1)} *err = strdup (\"invalid type\");\n") c_file.append(f"{' ' * (level + 1)} return NULL;\n") c_file.append(f'{" " * (level + 1)} }}\n') c_file.append(f'{" " * (level + 1)}invalid = common_safe_{typ} (YAJL_GET_NUMBER (val), &{dest});\n') elif typ == "integer": c_file.append(f"{' ' * (level + 1)}int invalid;\n") c_file.append(f"{' ' * (level + 1)}if (! YAJL_IS_NUMBER (val))\n") c_file.append(f'{" " * (level + 1)} {{\n') c_file.append(f"{' ' * (level + 1)} *err = strdup (\"invalid type\");\n") c_file.append(f"{' ' * (level + 1)} return NULL;\n") c_file.append(f'{" " * (level + 1)} }}\n') c_file.append(f'{" " * (level + 1)}invalid = common_safe_int (YAJL_GET_NUMBER (val), (int *)&{dest});\n') elif typ == "UID" or typ == "GID": c_file.append(f"{' ' * (level + 1)}int invalid;\n") c_file.append(f"{' ' * (level + 1)}if (! YAJL_IS_NUMBER (val))\n") c_file.append(f'{" " * (level + 1)} {{\n') c_file.append(f"{' ' * (level + 1)} *err = strdup (\"invalid type\");\n") c_file.append(f"{' ' * (level + 1)} return NULL;\n") c_file.append(f'{" " * (level + 1)} }}\n') c_file.append(f'{" " * (level + 1)}invalid = common_safe_uint (YAJL_GET_NUMBER (val), (unsigned int *)&{dest});\n') c_file.append(f"{' ' * (level + 1)}if (invalid)\n") c_file.append(f'{" " * (level + 1)} {{\n') c_file.append(f'{" " * (level + 1)} if (asprintf (err, "Invalid value \'%s\' with type \'{typ}\' for key \'{keyname}\': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0)\n') c_file.append(f'{" " * (level + 1)} *err = strdup ("error allocating memory");\n') c_file.append(f"{' ' * (level + 1)} return NULL;\n") c_file.append(f'{" " * (level + 1)}}}\n') if '[' not in dest: c_file.append(f"{' ' * (level + 1)}{dest}_present = 1;\n") c_file.append(f'{" " * (level)}}}\n') elif helpers.judge_data_pointer_type(typ): num_type = helpers.obtain_data_pointer_type(typ) if num_type == "": return c_file.append(f"{' ' * level}yajl_val val = {src};\n") c_file.append(f"{' ' * level}if (val != NULL)\n") c_file.append(f'{" " * (level)} {{\n') c_file.append(f'{" " * (level + 1)}{dest} = calloc (1, sizeof ({helpers.get_map_c_types(num_type)}));\n') c_file.append(f"{' ' * (level + 1)}if ({dest} == NULL)\n") c_file.append(f"{' ' * (level + 1)} return NULL;\n") c_file.append(f"{' ' * (level + 1)}int invalid;\n") c_file.append(f"{' ' * (level + 1)}if (! YAJL_IS_NUMBER (val))\n") c_file.append(f'{" " * (level + 1)} {{\n') c_file.append(f"{' ' * (level + 1)} *err = strdup (\"invalid type\");\n") c_file.append(f"{' ' * (level + 1)} return NULL;\n") c_file.append(f'{" " * (level + 1)}}}\n') c_file.append(f'{" " * (level + 1)}sinvalid = common_safe_{num_type} (YAJL_GET_NUMBER (val), {dest});\n') c_file.append(f"{' ' * (level + 1)}if (invalid)\n") c_file.append(f'{" " * (level + 1)} {{\n') c_file.append(f'{" " * (level + 1)} if (asprintf (err, "Invalid value \'%s\' with type \'{typ}\' ' \ f'for key \'{keyname}\': %s", YAJL_GET_NUMBER (val), strerror (-invalid)) < 0)\n') c_file.append(f'{" " * (level + 1)} *err = strdup ("error allocating memory");\n') c_file.append(f"{' ' * (level + 1)} return NULL;\n") c_file.append(f'{" " * (level + 1)}}}\n') c_file.append(f'{" " * (level)}}}\n') elif typ == 'boolean': c_file.append(f"{' ' * level}yajl_val val = {src};\n") c_file.append(f"{' ' * level}if (val != NULL)\n") c_file.append(f'{" " * (level)} {{\n') c_file.append(f"{' ' * (level + 1)}{dest} = YAJL_IS_TRUE(val);\n") if '[' not in dest: c_file.append(f"{' ' * (level + 1)}{dest}_present = 1;\n") c_file.append(f'{" " * (level)} }}\n') c_file.append(f"{' ' * level}else\n") c_file.append(f'{" " * (level)} {{\n') c_file.append(f"{' ' * (level + 1)}val = {src.replace('yajl_t_true', 'yajl_t_false')};\n") c_file.append(f"{' ' * (level + 1)}if (val != NULL)\n") c_file.append(f'{" " * (level+1)} {{\n') c_file.append(f"{' ' * (level + 2)}{dest} = 0;\n") c_file.append(f"{' ' * (level + 2)}{dest}_present = 1;\n") c_file.append(f'{" " * (level+1)} }}\n') c_file.append(f'{" " * (level)} }}\n') elif typ == 'booleanPointer': c_file.append(f"{' ' * level}yajl_val val = {src};\n") c_file.append(f"{' ' * level}if (val != NULL)\n") c_file.append(f'{" " * (level)} {{\n') c_file.append(f"{' ' * (level + 1)}{dest} = calloc (1, sizeof (bool));\n") c_file.append(f"{' ' * (level + 1)}if ({dest} == NULL)\n") c_file.append(f"{' ' * (level + 1)} return NULL;\n") c_file.append(f"{' ' * (level + 1)}*({dest}) = YAJL_IS_TRUE(val);\n") c_file.append(f'{" " * (level)} }}\n') c_file.append(f"{' ' * level}else\n") c_file.append(f'{" " * (level)} {{\n') c_file.append(f'{" " * (level + 1)}val = get_val (tree, "{keyname}", yajl_t_false);\n') c_file.append(f"{' ' * (level + 1)}if (val != NULL)\n") c_file.append(f'{" " * (level + 1)} {{\n') c_file.append(f"{' ' * (level + 2)}{dest} = calloc (1, sizeof (bool));\n") c_file.append(f"{' ' * (level + 2)}if ({dest} == NULL)\n") c_file.append(f"{' ' * (level + 2)} return NULL;\n") c_file.append(f"{' ' * (level + 2)}*({dest}) = YAJL_IS_TRUE(val);\n") c_file.append(f'{" " * (level + 1)}}}\n') c_file.append(f'{" " * (level)}}}\n') def json_value_generator(c_file, level, src, dst, ptx, typ): """ Description: json value generateor Interface: None History: 2019-06-17 """ if helpers.valid_basic_map_name(typ): c_file.append(f'{" " * (level)}stat = gen_{helpers.make_basic_map_name(typ)} ({dst}, {src}, {ptx}, err);\n') c_file.append(f"{' ' * level}if (stat != yajl_gen_status_ok)\n") c_file.append(f"{' ' * (level + 1)}GEN_SET_ERROR_AND_RETURN (stat, err);\n") elif typ == 'string': c_file.append(f'{" " * (level)}stat = yajl_gen_string ((yajl_gen){dst}, (const unsigned char *)({src}), strlen ({src}));\n') c_file.append(f"{' ' * level}if (stat != yajl_gen_status_ok)\n") c_file.append(f"{' ' * (level + 1)}GEN_SET_ERROR_AND_RETURN (stat, err);\n") elif helpers.judge_data_type(typ): if typ == 'double': c_file.append(f'{" " * (level)}stat = yajl_gen_double ((yajl_gen){dst}, {src});\n') elif typ.startswith("uint") or typ == 'GID' or typ == 'UID': c_file.append(f"{' ' * level}stat = map_uint ({dst}, {src});\n") else: c_file.append(f"{' ' * level}stat = map_int ({dst}, {src});\n") c_file.append(f"{' ' * level}if (stat != yajl_gen_status_ok)\n") c_file.append(f"{' ' * (level + 1)}GEN_SET_ERROR_AND_RETURN (stat, err);\n") elif typ == 'boolean': c_file.append(f'{" " * (level)}stat = yajl_gen_bool ((yajl_gen){dst}, (int)({src}));\n') c_file.append(f"{' ' * level}if (stat != yajl_gen_status_ok)\n") c_file.append(f"{' ' * (level + 1)}GEN_SET_ERROR_AND_RETURN (stat, err);\n") def make_c_array_free (i, c_file, prefix): if helpers.valid_basic_map_name(i.subtyp): free_func = helpers.make_basic_map_name(i.subtyp) c_file.append(f" if (ptr->{i.fixname} != NULL)\n") c_file.append(" {\n") c_file.append(" size_t i;\n") c_file.append(f" for (i = 0; i < ptr->{i.fixname}_len; i++)\n") c_file.append(" {\n") c_file.append(f" if (ptr->{i.fixname}[i] != NULL)\n") c_file.append(" {\n") c_file.append(f" free_{free_func} (ptr->{i.fixname}[i]);\n") c_file.append(f" ptr->{i.fixname}[i] = NULL;\n") c_file.append(" }\n") c_file.append(" }\n") c_file.append(f" free (ptr->{i.fixname});\n") c_file.append(f" ptr->{i.fixname} = NULL;\n") c_file.append(" }\n") elif i.subtyp == 'string': c_file_str(c_file, i) elif not helpers.judge_complex(i.subtyp): c_file.append(" {\n") if i.doublearray: c_file.append(" size_t i;\n") c_file.append(f" for (i = 0; i < ptr->{i.fixname}_len; i++)\n") c_file.append(" {\n") c_file.append(f" free (ptr->{i.fixname}[i]);\n") c_file.append(f" ptr->{i.fixname}[i] = NULL;\n") c_file.append(" }\n") c_file.append(f" free (ptr->{i.fixname}_item_lens);\n") c_file.append(f" ptr->{i.fixname}_item_lens = NULL;\n") c_file.append(f" free (ptr->{i.fixname});\n") c_file.append(f" ptr->{i.fixname} = NULL;\n") c_file.append(" }\n") elif i.subtyp == 'object' or i.subtypobj is not None: if i.subtypname is not None: free_func = i.subtypname else: free_func = helpers.get_name_substr(i.name, prefix) c_file.append(f" if (ptr->{i.fixname} != NULL)") c_file.append(" {\n") c_file.append(" size_t i;\n") c_file.append(f" for (i = 0; i < ptr->{i.fixname}_len; i++)\n") c_file.append(" {\n") if i.doublearray: c_file.append(" size_t j;\n") c_file.append(f" for (j = 0; j < ptr->{i.fixname}_item_lens[i]; j++)\n") c_file.append(" {\n") c_file.append(f" free_{free_func} (ptr->{i.fixname}[i][j]);\n") c_file.append(f" ptr->{i.fixname}[i][j] = NULL;\n") c_file.append(" }\n") c_file.append(f" free (ptr->{i.fixname}[i]);\n") c_file.append(f" ptr->{i.fixname}[i] = NULL;\n") else: c_file.append(f" if (ptr->{i.fixname}[i] != NULL)\n") c_file.append(" {\n") c_file.append(f" free_{free_func} (ptr->{i.fixname}[i]);\n") c_file.append(f" ptr->{i.fixname}[i] = NULL;\n") c_file.append(" }\n") c_file.append(" }\n") if i.doublearray: c_file.append(f" free (ptr->{i.fixname}_item_lens);\n") c_file.append(f" ptr->{i.fixname}_item_lens = NULL;\n") c_file.append(f" free (ptr->{i.fixname});\n") c_file.append(f" ptr->{i.fixname} = NULL;\n") c_file.append(" }\n") c_typ = helpers.obtain_pointer(i.name, i.subtypobj, prefix) if c_typ == "": return True if i.subobj is not None: c_typ = c_typ + "_element" c_file.append(f" free_{c_typ} (ptr->{i.fixname});\n") c_file.append(f" ptr->{i.fixname} = NULL;\n") return False def make_c_free (obj, c_file, prefix): """ Description: generate c free function Interface: None History: 2019-06-17 """ if not helpers.judge_complex(obj.typ) or obj.subtypname: return typename = helpers.get_prefixed_name(obj.name, prefix) case = obj.typ result = {'mapStringObject': lambda x: [], 'object': lambda x: x.children, 'array': lambda x: x.subtypobj}[case](obj) objs = result if obj.typ == 'array': if objs is None: return else: typename = helpers.get_name_substr(obj.name, prefix) c_file.append(f"void\nfree_{typename} ({typename} *ptr)\n") c_file.append("{\n") c_file.append(" if (ptr == NULL)\n") c_file.append(" return;\n") if obj.typ == 'mapStringObject': child = obj.children[0] if helpers.valid_basic_map_name(child.typ): childname = helpers.make_basic_map_name(child.typ) else: if child.subtypname: childname = child.subtypname else: childname = helpers.get_prefixed_name(child.name, prefix) c_file_map_str(c_file, child, childname) for i in objs or []: if helpers.valid_basic_map_name(i.typ): free_func = helpers.make_basic_map_name(i.typ) c_file.append(f" free_{free_func} (ptr->{i.fixname});\n") c_file.append(f" ptr->{i.fixname} = NULL;\n") if i.typ == 'mapStringObject': if i.subtypname: free_func = i.subtypname else: free_func = helpers.get_prefixed_name(i.name, prefix) c_file.append(f" free_{free_func} (ptr->{i.fixname});\n") c_file.append(f" ptr->{i.fixname} = NULL;\n") elif i.typ == 'array': if make_c_array_free (i, c_file, prefix): continue else: typename = helpers.get_prefixed_name(i.name, prefix) if i.typ == 'string' or i.typ == 'booleanPointer' or \ helpers.judge_data_pointer_type(i.typ): c_file.append(f" free (ptr->{i.fixname});\n") c_file.append(f" ptr->{i.fixname} = NULL;\n") elif i.typ == 'object': if i.subtypname is not None: typename = i.subtypname c_file.append(f" if (ptr->{i.fixname} != NULL)\n") c_file.append(" {\n") c_file.append(f" free_{typename} (ptr->{i.fixname});\n") c_file.append(f" ptr->{i.fixname} = NULL;\n") c_file.append(" }\n") if obj.typ == 'object': if obj.children is not None: c_file.append(" yajl_tree_free (ptr->_residual);\n") c_file.append(" ptr->_residual = NULL;\n") c_file.append(" free (ptr);\n") c_file.append("}\n\n") def c_file_map_str(c_file, child, childname): """ Description: generate c code for map string Interface: None History: 2019-10-31 """ c_file.append(f" if (ptr->keys != NULL && ptr->{child.fixname} != NULL)\n") c_file.append(" {\n") c_file.append(" size_t i;\n") c_file.append(" for (i = 0; i < ptr->len; i++)\n") c_file.append(" {\n") c_file.append(" free (ptr->keys[i]);\n") c_file.append(" ptr->keys[i] = NULL;\n") c_file.append(f" free_{childname} (ptr->{child.fixname}[i]);\n") c_file.append(f" ptr->{child.fixname}[i] = NULL;\n") c_file.append(" }\n") c_file.append(" free (ptr->keys);\n") c_file.append(" ptr->keys = NULL;\n") c_file.append(f" free (ptr->{child.fixname});\n") c_file.append(f" ptr->{child.fixname} = NULL;\n") c_file.append(" }\n") def c_file_str(c_file, i): """ Description: generate c code template Interface: None History: 2019-10-31 """ c_file.append(f" if (ptr->{i.fixname} != NULL)\n") c_file.append(" {\n") c_file.append(" size_t i;\n") c_file.append(f" for (i = 0; i < ptr->{i.fixname}_len; i++)\n") c_file.append(" {\n") if i.doublearray: c_file.append(" size_t j;\n") c_file.append(f" for (j = 0; j < ptr->{i.fixname}_item_lens[i]; j++)\n") c_file.append(" {\n") c_file.append(f" free (ptr->{i.fixname}[i][j]);\n") c_file.append(f" ptr->{i.fixname}[i][j] = NULL;\n") c_file.append(" }\n") c_file.append(f" if (ptr->{i.fixname}[i] != NULL)\n") c_file.append(" {\n") c_file.append(f" free (ptr->{i.fixname}[i]);\n") c_file.append(f" ptr->{i.fixname}[i] = NULL;\n") c_file.append(" }\n") c_file.append(" }\n") if i.doublearray: c_file.append(f" free (ptr->{i.fixname}_item_lens);\n") c_file.append(f" ptr->{i.fixname}_item_lens = NULL;\n") c_file.append(f" free (ptr->{i.fixname});\n") c_file.append(f" ptr->{i.fixname} = NULL;\n") c_file.append(" }\n") def src_reflect(structs, schema_info, c_file, root_typ): """ Description: reflect code Interface: None History: 2019-06-17 """ c_file.append(f"/* Generated from {schema_info.name.basename}. Do not edit! */\n\n") c_file.append("#ifndef _GNU_SOURCE\n") c_file.append("#define _GNU_SOURCE\n") c_file.append("#endif\n") c_file.append('#include \n') c_file.append('#include \n') c_file.append(f'#include "ocispec/{schema_info.header.basename}"\n\n') c_file.append('#define YAJL_GET_ARRAY_NO_CHECK(v) (&(v)->u.array)\n') c_file.append('#define YAJL_GET_OBJECT_NO_CHECK(v) (&(v)->u.object)\n') for i in structs: append_c_code(i, c_file, schema_info.prefix) length = len(structs) get_c_epilog(c_file, schema_info.prefix, root_typ, structs[length - 1]) def get_c_epilog_for_array_make_parse(c_file, prefix, typ, obj): c_typ = helpers.get_prefixed_pointer(obj.name, obj.subtyp, prefix) or \ helpers.get_map_c_types(obj.subtyp) if obj.subtypobj is not None: c_typ = helpers.get_name_substr(obj.name, prefix) if c_typ == "": return typename = helpers.get_top_array_type_name(obj.name, prefix) c_file.append(f"\ndefine_cleaner_function ({typename} *, free_{typename})\n" + f"{typename}\n" + f"*make_{typename} (yajl_val tree, const struct parser_context *ctx, parser_error *err)\n" + "{\n" + f" __auto_cleanup(free_{typename}) {typename} *ptr = NULL;\n" + f" size_t i, alen;\n" + f" "+ f" (void) ctx;\n" + f" "+ f" if (tree == NULL || err == NULL || YAJL_GET_ARRAY (tree) == NULL)\n" + f" return NULL;\n" + f" *err = NULL;\n" + f" alen = YAJL_GET_ARRAY_NO_CHECK (tree)->len;\n" + f" if (alen == 0)\n" + f" return NULL;\n" + f" ptr = calloc (1, sizeof ({typename}));\n" + f" if (ptr == NULL)\n" + f" return NULL;\n" + f" ptr->items = calloc (alen + 1, sizeof(*ptr->items));\n" + f" if (ptr->items == NULL)\n" + f" return NULL;\n" + f" ptr->len = alen;\n" ) if obj.doublearray: c_file.append(' ptr->subitem_lens = calloc ( alen + 1, sizeof (size_t));\n') c_file.append(' if (ptr->subitem_lens == NULL)\n') c_file.append(' return NULL;') c_file.append("""\n for (i = 0; i < alen; i++) { yajl_val work = YAJL_GET_ARRAY_NO_CHECK (tree)->values[i]; """); if obj.subtypobj or obj.subtyp == 'object': if obj.subtypname: subtypename = obj.subtypname else: subtypename = helpers.get_name_substr(obj.name, prefix) if obj.doublearray: c_file.append(' size_t j;\n') c_file.append(' ptr->items[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(work)->len + 1, sizeof (**ptr->items));\n') c_file.append(' if (ptr->items[i] == NULL)\n') c_file.append(' return NULL;\n') c_file.append(' yajl_val *tmps = YAJL_GET_ARRAY_NO_CHECK(work)->values;\n') c_file.append(' for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(work)->len; j++)\n') c_file.append(' {\n') c_file.append(f' ptr->items[i][j] = make_{subtypename} (tmps[j], ctx, err);\n') c_file.append(' if (ptr->items[i][j] == NULL)\n') c_file.append(" return NULL;\n") c_file.append(' ptr->subitem_lens[i] += 1;\n') c_file.append(' }\n') else: c_file.append(f' ptr->items[i] = make_{subtypename} (work, ctx, err);\n') c_file.append(' if (ptr->items[i] == NULL)\n') c_file.append(" return NULL;\n") elif obj.subtyp == 'byte': if obj.doublearray: c_file.append(' char *str = YAJL_GET_STRING (work);\n') c_file.append(' ptr->items[j] = (uint8_t *)strdup (str ? str : "");\n') c_file.append(' if (ptr->items[j] == NULL)\n') c_file.append(" return NULL;\n") else: c_file.append(' char *str = YAJL_GET_STRING (tree);\n') c_file.append(' memcpy(ptr->items, str ? str : "", strlen(str ? str : ""));\n') c_file.append(' break;\n') else: if obj.doublearray: c_file.append(' ptr->items[i] = calloc ( YAJL_GET_ARRAY_NO_CHECK(work)->len + 1, sizeof (**ptr->items));\n') c_file.append(' if (ptr->items[i] == NULL)\n') c_file.append(' return NULL;\n') c_file.append(' size_t j;\n') c_file.append(' yajl_val *tmps = YAJL_GET_ARRAY_NO_CHECK(work)->values;\n') c_file.append(' for (j = 0; j < YAJL_GET_ARRAY_NO_CHECK(work)->len; j++)\n') c_file.append(' {\n') read_val_generator(c_file, 3, 'tmps[j]', \ "ptr->items[i][j]", obj.subtyp, obj.origname, c_typ) c_file.append(' ptr->subitem_lens[i] += 1;\n') c_file.append(' }\n') else: read_val_generator(c_file, 2, 'work', \ "ptr->items[i]", obj.subtyp, obj.origname, c_typ) c_file.append("""\n } return move_ptr(ptr); } """) def get_c_epilog_for_array_make_free(c_file, prefix, typ, obj): c_typ = helpers.get_prefixed_pointer(obj.name, obj.subtyp, prefix) or \ helpers.get_map_c_types(obj.subtyp) if obj.subtypobj is not None: c_typ = helpers.get_name_substr(obj.name, prefix) if c_typ == "": return typename = helpers.get_top_array_type_name(obj.name, prefix) c_file.append(f"\n\nvoid free_{typename} ({typename} *ptr)" + """ { size_t i; if (ptr == NULL) return; for (i = 0; i < ptr->len; i++) { """) if helpers.valid_basic_map_name(obj.subtyp): free_func = helpers.make_basic_map_name(obj.subtyp) c_file.append(" if (ptr->items[i] != NULL)\n") c_file.append(" {\n") c_file.append(f" free_{free_func} (ptr->items[i]);\n") c_file.append(" ptr->items[i] = NULL;\n") c_file.append(" }\n") elif obj.subtyp == 'string': if obj.doublearray: c_file.append(" size_t j;\n") c_file.append(" for (j = 0; j < ptr->subitem_lens[i]; j++)\n") c_file.append(" {\n") c_file.append(" free (ptr->items[i][j]);\n") c_file.append(" ptr->items[i][j] = NULL;\n") c_file.append(" }\n") c_file.append(" free (ptr->items[i]);\n") c_file.append(" ptr->items[i] = NULL;\n") else: c_file.append(" free (ptr->items[i]);\n") c_file.append(" ptr->items[i] = NULL;\n") elif not helpers.judge_complex(obj.subtyp): if obj.doublearray: c_file.append(" free (ptr->items[i]);\n") c_file.append(" ptr->items[i] = NULL;\n") elif obj.subtyp == 'object' or obj.subtypobj is not None: if obj.subtypname is not None: free_func = obj.subtypname else: free_func = helpers.get_name_substr(obj.name, prefix) if obj.doublearray: c_file.append(" size_t j;\n") c_file.append(" for (j = 0; j < ptr->subitem_lens[i]; j++)\n") c_file.append(" {\n") c_file.append(f" free_{free_func} (ptr->items[i][j]);\n") c_file.append(" ptr->items[i][j] = NULL;\n") c_file.append(" }\n") c_file.append(" free (ptr->items[i]);\n") c_file.append(" ptr->items[i] = NULL;\n") else: c_file.append(f" free_{free_func} (ptr->items[i]);\n") c_file.append(" ptr->items[i] = NULL;\n") c_file.append(""" } """) if obj.doublearray: c_file.append(" free (ptr->subitem_lens);\n") c_file.append(" ptr->subitem_lens = NULL;\n") c_typ = helpers.obtain_pointer(obj.name, obj.subtypobj, prefix) if c_typ != "": if obj.subobj is not None: c_typ = c_typ + "_element" c_file.append(f" free_{c_typ} (ptr->items);\n") c_file.append(" ptr->items = NULL;\n") return else: c_file.append(""" free (ptr->items); ptr->items = NULL; """) c_file.append("""\n free (ptr); } """) def get_c_epilog_for_array_make_gen(c_file, prefix, typ, obj): c_typ = helpers.get_prefixed_pointer(obj.name, obj.subtyp, prefix) or \ helpers.get_map_c_types(obj.subtyp) if obj.subtypobj is not None: c_typ = helpers.get_name_substr(obj.name, prefix) if c_typ == "": return typename = helpers.get_top_array_type_name(obj.name, prefix) c_file.append(f"yajl_gen_status gen_{typename} (yajl_gen g, const {typename} *ptr, const struct parser_context *ctx," + """ parser_error *err) { yajl_gen_status stat; size_t i; if (ptr == NULL) return yajl_gen_status_ok; *err = NULL; """) if obj.subtypobj or obj.subtyp == 'object': c_file.append("""\n stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < ptr->len; i++) { """) if obj.subtypname: subtypename = obj.subtypname else: subtypename = helpers.get_name_substr(obj.name, prefix) c_file.append(' {\n') if obj.doublearray: c_file.append(' stat = yajl_gen_array_open ((yajl_gen) g);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" size_t j;\n") c_file.append(' for (j = 0; j < ptr->subitem_lens[i]; j++)\n') c_file.append(' {\n') c_file.append(f' stat = gen_{subtypename} (g, ptr->items[i][j], ctx, err);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(' }\n') c_file.append(' stat = yajl_gen_array_close ((yajl_gen) g);\n') else: c_file.append(f' stat = gen_{subtypename} (g, ptr->items[i], ctx, err);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append("""\n } } stat = yajl_gen_array_close ((yajl_gen) g); """) elif obj.subtyp == 'byte': c_file.append(' {\n') c_file.append(' const char *str = NULL;\n') if obj.doublearray: c_file.append(' stat = yajl_gen_array_open ((yajl_gen) g);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" {\n") c_file.append(" size_t i;\n") c_file.append(" for (i = 0; i < ptr->len; i++)\n") c_file.append(" {\n") c_file.append(" if (ptr->items[i] != NULL)\n") c_file.append(" str = (const char *)ptr->items[i];\n") c_file.append(" else ()\n") c_file.append(" str = "";\n") c_file.append(' stat = yajl_gen_string ((yajl_gen) g, \ (const unsigned char *)str, strlen(str));\n') c_file.append(" }\n") c_file.append(" }\n") c_file.append(' stat = yajl_gen_array_close ((yajl_gen) g);\n') else: c_file.append(" if (ptr != NULL && ptr->items != NULL)\n") c_file.append(" {\n") c_file.append(" str = (const char *)ptr->items;\n") c_file.append(" }\n") c_file.append(' stat = yajl_gen_string ((yajl_gen) g, \ (const unsigned char *)str, ptr->len);\n') c_file.append(' }\n') else: c_file.append("""\n stat = yajl_gen_array_open ((yajl_gen) g); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); for (i = 0; i < ptr->len; i++) { """) c_file.append(' {\n') if obj.doublearray: c_file.append(' stat = yajl_gen_array_open ((yajl_gen) g);\n') c_file.append(" if (stat != yajl_gen_status_ok)\n") c_file.append(" GEN_SET_ERROR_AND_RETURN (stat, err);\n") c_file.append(" size_t j;\n") c_file.append(' for (j = 0; j < ptr->subitem_lens[i]; j++)\n') c_file.append(' {\n') json_value_generator(c_file, 4, "ptr->items[i][j]", 'g', 'ctx', obj.subtyp) c_file.append(' }\n') c_file.append(' stat = yajl_gen_array_close ((yajl_gen) g);\n') else: json_value_generator(c_file, 3, "ptr->items[i]", 'g', 'ctx', obj.subtyp) c_file.append("""\n } } stat = yajl_gen_array_close ((yajl_gen) g); """) c_file.append("""\n if (ptr->len > 0 && !(ctx->options & OPT_GEN_SIMPLIFY)) yajl_gen_config (g, yajl_gen_beautify, 1); if (stat != yajl_gen_status_ok) GEN_SET_ERROR_AND_RETURN (stat, err); return yajl_gen_status_ok; } """) def get_c_epilog_for_array(c_file, prefix, typ, obj): typename = helpers.get_top_array_type_name(obj.name, prefix) get_c_epilog_for_array_make_parse(c_file, prefix, typ, obj) get_c_epilog_for_array_make_free(c_file, prefix, typ, obj) get_c_epilog_for_array_make_gen(c_file, prefix, typ, obj) def get_c_epilog(c_file, prefix, typ, obj): """ Description: generate c language epilogue Interface: None History: 2019-06-17 """ typename = prefix if typ != 'array' and typ != 'object': return if typ == 'array': typename = helpers.get_top_array_type_name(obj.name, prefix) get_c_epilog_for_array(c_file, prefix, typ, obj) c_file.append(f"\n{typename} *\n{typename}_parse_file (const char *filename, const struct parser_context *ctx, parser_error *err)" "\n{" f"\n{typename} *ptr = NULL;" + """size_t filesize; __auto_free char *content = NULL; if (filename == NULL || err == NULL) return NULL; *err = NULL; content = read_file (filename, &filesize); if (content == NULL) { if (asprintf (err, "cannot read the file: %s", filename) < 0) *err = strdup ("error allocating memory"); return NULL; }""" + f"ptr = {typename}_parse_data (content, ctx, err);" + """return ptr; } """) c_file.append( f"{typename} * \n" + f"{typename}_parse_file_stream (FILE *stream, const struct parser_context *ctx, parser_error *err)\n{{" + f"{typename} *ptr = NULL;"+ """\nsize_t filesize; __auto_free char *content = NULL; if (stream == NULL || err == NULL) return NULL; *err = NULL; content = fread_file (stream, &filesize); if (content == NULL) { *err = strdup ("cannot read the file"); return NULL; }\n""" + f"ptr = {typename}_parse_data (content, ctx, err);" + """return ptr; } """) c_file.append(""" define_cleaner_function (yajl_val, yajl_tree_free) """ + f"\n {typename} * " + f"{typename}_parse_data (const char *jsondata, const struct parser_context *ctx, parser_error *err)\n {{ \n" + f" {typename} *ptr = NULL;" + """__auto_cleanup(yajl_tree_free) yajl_val tree = NULL; char errbuf[1024]; struct parser_context tmp_ctx = { 0 }; if (jsondata == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); tree = yajl_tree_parse (jsondata, errbuf, sizeof (errbuf)); if (tree == NULL) { if (asprintf (err, "cannot parse the data: %s", errbuf) < 0) *err = strdup ("error allocating memory"); return NULL; }\n""" + f"ptr = make_{typename} (tree, ctx, err);" + "return ptr; \n}\n" ) c_file.append("""\nstatic void\ncleanup_yajl_gen (yajl_gen g) { if (!g) return; yajl_gen_clear (g); yajl_gen_free (g); } define_cleaner_function (yajl_gen, cleanup_yajl_gen) """) c_file.append("\n char * \n" + f"{typename}_generate_json (const {typename} *ptr, const struct parser_context *ctx, parser_error *err)" + """{ __auto_cleanup(cleanup_yajl_gen) yajl_gen g = NULL; struct parser_context tmp_ctx = { 0 }; const unsigned char *gen_buf = NULL; char *json_buf = NULL; size_t gen_len = 0; if (ptr == NULL || err == NULL) return NULL; *err = NULL; if (ctx == NULL) ctx = (const struct parser_context *)(&tmp_ctx); if (!json_gen_init(&g, ctx)) { *err = strdup ("Json_gen init failed"); return json_buf; } \n """ + f"if (yajl_gen_status_ok != gen_{typename} (g, ptr, ctx, err))" + """ { if (*err == NULL) *err = strdup ("Failed to generate json"); return json_buf; } yajl_gen_get_buf (g, &gen_buf, &gen_len); if (gen_buf == NULL) { *err = strdup ("Error to get generated json"); return json_buf; } json_buf = calloc (1, gen_len + 1); if (json_buf == NULL) { *err = strdup ("Cannot allocate memory"); return json_buf; } (void) memcpy (json_buf, gen_buf, gen_len); json_buf[gen_len] = '\\0'; return json_buf; } """) crun-1.16.1/libocispec/src/yajl/0000775000000000000000000000000014025721605014603 5ustar0000000000000000crun-1.16.1/libocispec/src/yajl/yajl_common.h0000664000000000000000000000501414025721605017263 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __YAJL_COMMON_H__ #define __YAJL_COMMON_H__ #include #ifdef __cplusplus extern "C" { #endif #define YAJL_MAX_DEPTH 128 /* msft dll export gunk. To build a DLL on windows, you * must define WIN32, YAJL_SHARED, and YAJL_BUILD. To use a shared * DLL, you must define YAJL_SHARED and WIN32 */ #if (defined(_WIN32) || defined(WIN32)) && defined(YAJL_SHARED) # ifdef YAJL_BUILD # define YAJL_API __declspec(dllexport) # else # define YAJL_API __declspec(dllimport) # endif #else # if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 # define YAJL_API __attribute__ ((visibility("default"))) # else # define YAJL_API # endif #endif /** pointer to a malloc function, supporting client overriding memory * allocation routines */ typedef void * (*yajl_malloc_func)(void *ctx, size_t sz); /** pointer to a free function, supporting client overriding memory * allocation routines */ typedef void (*yajl_free_func)(void *ctx, void * ptr); /** pointer to a realloc function which can resize an allocation. */ typedef void * (*yajl_realloc_func)(void *ctx, void * ptr, size_t sz); /** A structure which can be passed to yajl_*_alloc routines to allow the * client to specify memory allocation functions to be used. */ typedef struct { /** pointer to a function that can allocate uninitialized memory */ yajl_malloc_func malloc; /** pointer to a function that can resize memory allocations */ yajl_realloc_func realloc; /** pointer to a function that can free memory allocated using * reallocFunction or mallocFunction */ yajl_free_func free; /** a context pointer that will be passed to above allocation routines */ void * ctx; } yajl_alloc_funcs; #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/yajl/yajl_gen.h0000664000000000000000000001605314025721605016551 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /** * \file yajl_gen.h * Interface to YAJL's JSON generation facilities. */ #include #ifndef __YAJL_GEN_H__ #define __YAJL_GEN_H__ #include #ifdef __cplusplus extern "C" { #endif /** generator status codes */ typedef enum { /** no error */ yajl_gen_status_ok = 0, /** at a point where a map key is generated, a function other than * yajl_gen_string was called */ yajl_gen_keys_must_be_strings, /** YAJL's maximum generation depth was exceeded. see * YAJL_MAX_DEPTH */ yajl_max_depth_exceeded, /** A generator function (yajl_gen_XXX) was called while in an error * state */ yajl_gen_in_error_state, /** A complete JSON document has been generated */ yajl_gen_generation_complete, /** yajl_gen_double was passed an invalid floating point value * (infinity or NaN). */ yajl_gen_invalid_number, /** A print callback was passed in, so there is no internal * buffer to get from */ yajl_gen_no_buf, /** returned from yajl_gen_string() when the yajl_gen_validate_utf8 * option is enabled and an invalid was passed by client code. */ yajl_gen_invalid_string } yajl_gen_status; /** an opaque handle to a generator */ typedef struct yajl_gen_t * yajl_gen; /** a callback used for "printing" the results. */ typedef void (*yajl_print_t)(void * ctx, const char * str, size_t len); /** configuration parameters for the parser, these may be passed to * yajl_gen_config() along with option specific argument(s). In general, * all configuration parameters default to *off*. */ typedef enum { /** generate indented (beautiful) output */ yajl_gen_beautify = 0x01, /** * Set an indent string which is used when yajl_gen_beautify * is enabled. Maybe something like \\t or some number of * spaces. The default is four spaces ' '. */ yajl_gen_indent_string = 0x02, /** * Set a function and context argument that should be used to * output generated json. the function should conform to the * yajl_print_t prototype while the context argument is a * void * of your choosing. * * example: * yajl_gen_config(g, yajl_gen_print_callback, myFunc, myVoidPtr); */ yajl_gen_print_callback = 0x04, /** * Normally the generator does not validate that strings you * pass to it via yajl_gen_string() are valid UTF8. Enabling * this option will cause it to do so. */ yajl_gen_validate_utf8 = 0x08, /** * the forward solidus (slash or '/' in human) is not required to be * escaped in json text. By default, YAJL will not escape it in the * iterest of saving bytes. Setting this flag will cause YAJL to * always escape '/' in generated JSON strings. */ yajl_gen_escape_solidus = 0x10 } yajl_gen_option; /** allow the modification of generator options subsequent to handle * allocation (via yajl_alloc) * \returns zero in case of errors, non-zero otherwise */ YAJL_API int yajl_gen_config(yajl_gen g, yajl_gen_option opt, ...); /** allocate a generator handle * \param allocFuncs an optional pointer to a structure which allows * the client to overide the memory allocation * used by yajl. May be NULL, in which case * malloc/free/realloc will be used. * * \returns an allocated handle on success, NULL on failure (bad params) */ YAJL_API yajl_gen yajl_gen_alloc(const yajl_alloc_funcs * allocFuncs); /** free a generator handle */ YAJL_API void yajl_gen_free(yajl_gen handle); YAJL_API yajl_gen_status yajl_gen_integer(yajl_gen hand, long long int number); /** generate a floating point number. number may not be infinity or * NaN, as these have no representation in JSON. In these cases the * generator will return 'yajl_gen_invalid_number' */ YAJL_API yajl_gen_status yajl_gen_double(yajl_gen hand, double number); YAJL_API yajl_gen_status yajl_gen_number(yajl_gen hand, const char * num, size_t len); YAJL_API yajl_gen_status yajl_gen_string(yajl_gen hand, const unsigned char * str, size_t len); YAJL_API yajl_gen_status yajl_gen_null(yajl_gen hand); YAJL_API yajl_gen_status yajl_gen_bool(yajl_gen hand, int boolean); YAJL_API yajl_gen_status yajl_gen_map_open(yajl_gen hand); YAJL_API yajl_gen_status yajl_gen_map_close(yajl_gen hand); YAJL_API yajl_gen_status yajl_gen_array_open(yajl_gen hand); YAJL_API yajl_gen_status yajl_gen_array_close(yajl_gen hand); /** access the null terminated generator buffer. If incrementally * outputing JSON, one should call yajl_gen_clear to clear the * buffer. This allows stream generation. */ YAJL_API yajl_gen_status yajl_gen_get_buf(yajl_gen hand, const unsigned char ** buf, size_t * len); /** clear yajl's output buffer, but maintain all internal generation * state. This function will not "reset" the generator state, and is * intended to enable incremental JSON outputing. */ YAJL_API void yajl_gen_clear(yajl_gen hand); /** Reset the generator state. Allows a client to generate multiple * json entities in a stream. The "sep" string will be inserted to * separate the previously generated entity from the current, * NULL means *no separation* of entites (clients beware, generating * multiple JSON numbers without a separator, for instance, will result in ambiguous output) * * Note: this call will not clear yajl's output buffer. This * may be accomplished explicitly by calling yajl_gen_clear() */ YAJL_API void yajl_gen_reset(yajl_gen hand, const char * sep); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/yajl/yajl_parse.h0000664000000000000000000002314014025721605017105 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /** * \file yajl_parse.h * Interface to YAJL's JSON stream parsing facilities. */ #include #ifndef __YAJL_PARSE_H__ #define __YAJL_PARSE_H__ #include #ifdef __cplusplus extern "C" { #endif /** error codes returned from this interface */ typedef enum { /** no error was encountered */ yajl_status_ok, /** a client callback returned zero, stopping the parse */ yajl_status_client_canceled, /** An error occurred during the parse. Call yajl_get_error for * more information about the encountered error */ yajl_status_error } yajl_status; /** attain a human readable, english, string for an error */ YAJL_API const char * yajl_status_to_string(yajl_status code); /** an opaque handle to a parser */ typedef struct yajl_handle_t * yajl_handle; /** yajl is an event driven parser. this means as json elements are * parsed, you are called back to do something with the data. The * functions in this table indicate the various events for which * you will be called back. Each callback accepts a "context" * pointer, this is a void * that is passed into the yajl_parse * function which the client code may use to pass around context. * * All callbacks return an integer. If non-zero, the parse will * continue. If zero, the parse will be canceled and * yajl_status_client_canceled will be returned from the parse. * * \attention { * A note about the handling of numbers: * * yajl will only convert numbers that can be represented in a * double or a 64 bit (long long) int. All other numbers will * be passed to the client in string form using the yajl_number * callback. Furthermore, if yajl_number is not NULL, it will * always be used to return numbers, that is yajl_integer and * yajl_double will be ignored. If yajl_number is NULL but one * of yajl_integer or yajl_double are defined, parsing of a * number larger than is representable in a double or 64 bit * integer will result in a parse error. * } */ typedef struct { int (* yajl_null)(void * ctx); int (* yajl_boolean)(void * ctx, int boolVal); int (* yajl_integer)(void * ctx, long long integerVal); int (* yajl_double)(void * ctx, double doubleVal); /** A callback which passes the string representation of the number * back to the client. Will be used for all numbers when present */ int (* yajl_number)(void * ctx, const char * numberVal, size_t numberLen); /** strings are returned as pointers into the JSON text when, * possible, as a result, they are _not_ null padded */ int (* yajl_string)(void * ctx, const unsigned char * stringVal, size_t stringLen); int (* yajl_start_map)(void * ctx); int (* yajl_map_key)(void * ctx, const unsigned char * key, size_t stringLen); int (* yajl_end_map)(void * ctx); int (* yajl_start_array)(void * ctx); int (* yajl_end_array)(void * ctx); } yajl_callbacks; /** allocate a parser handle * \param callbacks a yajl callbacks structure specifying the * functions to call when different JSON entities * are encountered in the input text. May be NULL, * which is only useful for validation. * \param afs memory allocation functions, may be NULL for to use * C runtime library routines (malloc and friends) * \param ctx a context pointer that will be passed to callbacks. */ YAJL_API yajl_handle yajl_alloc(const yajl_callbacks * callbacks, yajl_alloc_funcs * afs, void * ctx); /** configuration parameters for the parser, these may be passed to * yajl_config() along with option specific argument(s). In general, * all configuration parameters default to *off*. */ typedef enum { /** Ignore javascript style comments present in * JSON input. Non-standard, but rather fun * arguments: toggled off with integer zero, on otherwise. * * example: * yajl_config(h, yajl_allow_comments, 1); // turn comment support on */ yajl_allow_comments = 0x01, /** * When set the parser will verify that all strings in JSON input are * valid UTF8 and will emit a parse error if this is not so. When set, * this option makes parsing slightly more expensive (~7% depending * on processor and compiler in use) * * example: * yajl_config(h, yajl_dont_validate_strings, 1); // disable utf8 checking */ yajl_dont_validate_strings = 0x02, /** * By default, upon calls to yajl_complete_parse(), yajl will * ensure the entire input text was consumed and will raise an error * otherwise. Enabling this flag will cause yajl to disable this * check. This can be useful when parsing json out of a that contains more * than a single JSON document. */ yajl_allow_trailing_garbage = 0x04, /** * Allow multiple values to be parsed by a single handle. The * entire text must be valid JSON, and values can be seperated * by any kind of whitespace. This flag will change the * behavior of the parser, and cause it continue parsing after * a value is parsed, rather than transitioning into a * complete state. This option can be useful when parsing multiple * values from an input stream. */ yajl_allow_multiple_values = 0x08, /** * When yajl_complete_parse() is called the parser will * check that the top level value was completely consumed. I.E., * if called whilst in the middle of parsing a value * yajl will enter an error state (premature EOF). Setting this * flag suppresses that check and the corresponding error. */ yajl_allow_partial_values = 0x10 } yajl_option; /** allow the modification of parser options subsequent to handle * allocation (via yajl_alloc) * \returns zero in case of errors, non-zero otherwise */ YAJL_API int yajl_config(yajl_handle h, yajl_option opt, ...); /** free a parser handle */ YAJL_API void yajl_free(yajl_handle handle); /** Parse some json! * \param hand - a handle to the json parser allocated with yajl_alloc * \param jsonText - a pointer to the UTF8 json text to be parsed * \param jsonTextLength - the length, in bytes, of input text */ YAJL_API yajl_status yajl_parse(yajl_handle hand, const unsigned char * jsonText, size_t jsonTextLength); /** Parse any remaining buffered json. * Since yajl is a stream-based parser, without an explicit end of * input, yajl sometimes can't decide if content at the end of the * stream is valid or not. For example, if "1" has been fed in, * yajl can't know whether another digit is next or some character * that would terminate the integer token. * * \param hand - a handle to the json parser allocated with yajl_alloc */ YAJL_API yajl_status yajl_complete_parse(yajl_handle hand); /** get an error string describing the state of the * parse. * * If verbose is non-zero, the message will include the JSON * text where the error occurred, along with an arrow pointing to * the specific char. * * \returns A dynamically allocated string will be returned which should * be freed with yajl_free_error */ YAJL_API unsigned char * yajl_get_error(yajl_handle hand, int verbose, const unsigned char * jsonText, size_t jsonTextLength); /** * get the amount of data consumed from the last chunk passed to YAJL. * * In the case of a successful parse this can help you understand if * the entire buffer was consumed (which will allow you to handle * "junk at end of input"). * * In the event an error is encountered during parsing, this function * affords the client a way to get the offset into the most recent * chunk where the error occurred. 0 will be returned if no error * was encountered. */ YAJL_API size_t yajl_get_bytes_consumed(yajl_handle hand); /** free an error returned from yajl_get_error */ YAJL_API void yajl_free_error(yajl_handle hand, unsigned char * str); #ifdef __cplusplus } #endif #endif crun-1.16.1/libocispec/src/yajl/yajl_tree.h0000664000000000000000000001600314025721605016732 0ustar0000000000000000/* * Copyright (c) 2010-2011 Florian Forster * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /** * \file yajl_tree.h * * Parses JSON data and returns the data in tree form. * * \author Florian Forster * \date August 2010 * * This interface makes quick parsing and extraction of * smallish JSON docs trivial: * * \include example/parse_config.c */ #ifndef YAJL_TREE_H #define YAJL_TREE_H 1 #include #ifdef __cplusplus extern "C" { #endif /** possible data types that a yajl_val_s can hold */ typedef enum { yajl_t_string = 1, yajl_t_number = 2, yajl_t_object = 3, yajl_t_array = 4, yajl_t_true = 5, yajl_t_false = 6, yajl_t_null = 7, /** The any type isn't valid for yajl_val_s.type, but can be * used as an argument to routines like yajl_tree_get(). */ yajl_t_any = 8 } yajl_type; #define YAJL_NUMBER_INT_VALID 0x01 #define YAJL_NUMBER_DOUBLE_VALID 0x02 /** A pointer to a node in the parse tree */ typedef struct yajl_val_s * yajl_val; /** * A JSON value representation capable of holding one of the seven * types above. For "string", "number", "object", and "array" * additional data is available in the union. The "YAJL_IS_*" * and "YAJL_GET_*" macros below allow type checking and convenient * value extraction. */ struct yajl_val_s { /** Type of the value contained. Use the "YAJL_IS_*" macros to check for a * specific type. */ yajl_type type; /** Type-specific data. You may use the "YAJL_GET_*" macros to access these * members. */ union { char * string; struct { long long i; /*< integer value, if representable. */ double d; /*< double value, if representable. */ char *r; /*< unparsed number in string form. */ /** Signals whether the \em i and \em d members are * valid. See \c YAJL_NUMBER_INT_VALID and * \c YAJL_NUMBER_DOUBLE_VALID. */ unsigned int flags; } number; struct { const char **keys; /*< Array of keys */ yajl_val *values; /*< Array of values. */ size_t len; /*< Number of key-value-pairs. */ } object; struct { yajl_val *values; /*< Array of elements. */ size_t len; /*< Number of elements. */ } array; } u; }; /** * Parse a string. * * Parses an null-terminated string containing JSON data and returns a pointer * to the top-level value (root of the parse tree). * * \param input Pointer to a null-terminated utf8 string containing * JSON data. * \param error_buffer Pointer to a buffer in which an error message will * be stored if \em yajl_tree_parse fails, or * \c NULL. The buffer will be initialized before * parsing, so its content will be destroyed even if * \em yajl_tree_parse succeeds. * \param error_buffer_size Size of the memory area pointed to by * \em error_buffer_size. If \em error_buffer_size is * \c NULL, this argument is ignored. * * \returns Pointer to the top-level value or \c NULL on error. The memory * pointed to must be freed using \em yajl_tree_free. In case of an error, a * null terminated message describing the error in more detail is stored in * \em error_buffer if it is not \c NULL. */ YAJL_API yajl_val yajl_tree_parse (const char *input, char *error_buffer, size_t error_buffer_size); /** * Free a parse tree returned by "yajl_tree_parse". * * \param v Pointer to a JSON value returned by "yajl_tree_parse". Passing NULL * is valid and results in a no-op. */ YAJL_API void yajl_tree_free (yajl_val v); /** * Access a nested value inside a tree. * * \param parent the node under which you'd like to extract values. * \param path A null terminated array of strings, each the name of an object key * \param type the yajl_type of the object you seek, or yajl_t_any if any will do. * * \returns a pointer to the found value, or NULL if we came up empty. * * Future Ideas: it'd be nice to move path to a string and implement support for * a teeny tiny micro language here, so you can extract array elements, do things * like .first and .last, even .length. Inspiration from JSONPath and css selectors? * No it wouldn't be fast, but that's not what this API is about. */ YAJL_API yajl_val yajl_tree_get(yajl_val parent, const char ** path, yajl_type type); /* Various convenience macros to check the type of a `yajl_val` */ #define YAJL_IS_STRING(v) (((v) != NULL) && ((v)->type == yajl_t_string)) #define YAJL_IS_NUMBER(v) (((v) != NULL) && ((v)->type == yajl_t_number)) #define YAJL_IS_INTEGER(v) (YAJL_IS_NUMBER(v) && ((v)->u.number.flags & YAJL_NUMBER_INT_VALID)) #define YAJL_IS_DOUBLE(v) (YAJL_IS_NUMBER(v) && ((v)->u.number.flags & YAJL_NUMBER_DOUBLE_VALID)) #define YAJL_IS_OBJECT(v) (((v) != NULL) && ((v)->type == yajl_t_object)) #define YAJL_IS_ARRAY(v) (((v) != NULL) && ((v)->type == yajl_t_array )) #define YAJL_IS_TRUE(v) (((v) != NULL) && ((v)->type == yajl_t_true )) #define YAJL_IS_FALSE(v) (((v) != NULL) && ((v)->type == yajl_t_false )) #define YAJL_IS_NULL(v) (((v) != NULL) && ((v)->type == yajl_t_null )) /** Given a yajl_val_string return a ptr to the bare string it contains, * or NULL if the value is not a string. */ #define YAJL_GET_STRING(v) (YAJL_IS_STRING(v) ? (v)->u.string : NULL) /** Get the string representation of a number. You should check type first, * perhaps using YAJL_IS_NUMBER */ #define YAJL_GET_NUMBER(v) ((v)->u.number.r) /** Get the double representation of a number. You should check type first, * perhaps using YAJL_IS_DOUBLE */ #define YAJL_GET_DOUBLE(v) ((v)->u.number.d) /** Get the 64bit (long long) integer representation of a number. You should * check type first, perhaps using YAJL_IS_INTEGER */ #define YAJL_GET_INTEGER(v) ((v)->u.number.i) /** Get a pointer to a yajl_val_object or NULL if the value is not an object. */ #define YAJL_GET_OBJECT(v) (YAJL_IS_OBJECT(v) ? &(v)->u.object : NULL) /** Get a pointer to a yajl_val_array or NULL if the value is not an object. */ #define YAJL_GET_ARRAY(v) (YAJL_IS_ARRAY(v) ? &(v)->u.array : NULL) #ifdef __cplusplus } #endif #endif /* YAJL_TREE_H */ crun-1.16.1/libocispec/src/yajl/yajl_version.h.cmake0000664000000000000000000000061714025721605020543 0ustar0000000000000000#ifndef YAJL_VERSION_H_ #define YAJL_VERSION_H_ #include #define YAJL_MAJOR ${YAJL_MAJOR} #define YAJL_MINOR ${YAJL_MINOR} #define YAJL_MICRO ${YAJL_MICRO} #define YAJL_VERSION ((YAJL_MAJOR * 10000) + (YAJL_MINOR * 100) + YAJL_MICRO) #ifdef __cplusplus extern "C" { #endif extern int YAJL_API yajl_version(void); #ifdef __cplusplus } #endif #endif /* YAJL_VERSION_H_ */ crun-1.16.1/libocispec/tests/0000755000000000000000000000000014656670214014226 5ustar0000000000000000crun-1.16.1/libocispec/tests/data/0000755000000000000000000000000014656670214015137 5ustar0000000000000000crun-1.16.1/libocispec/tests/data/image_index_config.json0000664000000000000000000000135613677106237021640 0ustar0000000000000000{ "schemaVersion": 2, "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7143, "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", "platform": { "architecture": "ppc64le", "os": "linux", "os.version": "1.0.0", "os.features": [ "fast", "simple" ] } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "platform": { "architecture": "amd64", "os": "linux" } } ], "annotations": { "com.example.key1": "value1", "com.example.key2": "value2" } } crun-1.16.1/libocispec/tests/data/image_layout_config.json0000664000000000000000000000004413677106237022037 0ustar0000000000000000{ "imageLayoutVersion": "1.0.0" } crun-1.16.1/libocispec/tests/data/image_config_mapstringobject.json0000664000000000000000000000277113677106237023726 0ustar0000000000000000{ "created": "2015-10-31T22:22:56.015925234Z", "author": "Alyssa P. Hacker ", "architecture": "amd64", "os": "linux", "config": { "User": "1:1", "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "FOO=docker_is_a_really", "BAR=great_tool_you_know" ], "Entrypoint": [ "/bin/sh" ], "Cmd": [ "--foreground", "--config", "/etc/my-app.d/default.cfg" ], "Volumes": null, "ExposedPorts": { "8080/tcp": {} }, "StopSignal": "SIGKILL", "WorkingDir": "/home/alice", "Labels": { "com.example.project.git.url": "https://example.com/project.git", "com.example.project.git.commit": "45a939b2999782a3f005621a8d0f29aa387e1d6b" } }, "rootfs": { "diff_ids": [ "sha256:9d3dd9504c685a304985025df4ed0283e47ac9ffa9bd0326fddf4d59513f0827", "sha256:2b689805fbd00b2db1df73fae47562faac1a626d5f61744bfe29946ecff5d73d" ], "type": "layers" }, "history": [ { "created": "2015-10-31T22:22:54.690851953Z", "created_by": "/bin/sh -c #(nop) ADD file:a3bc1e842b69636f9df5256c49c5374fb4eef1e281fe3f282c65fb853ee171c5 in /" }, { "created": "2015-10-31T22:22:55.613815829Z", "created_by": "/bin/sh -c #(nop) CMD [\"sh\"]", "empty_layer": true } ] } crun-1.16.1/libocispec/tests/data/config.json0000644000000000000000000001343714332154664017304 0ustar0000000000000000{ "ociVersion": "1.0.0-rc5", "platform": { "os": "linux", "arch": "amd64" }, "process": { "terminal": true, "consoleSize": { "height": 0, "width": 0 }, "user": { "uid": 101 }, "args": [ "ARGS1", "sh" ], "env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm" ], "cwd": "/cwd", "capabilities": { "bounding": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "effective": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "inheritable": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "permitted": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "ambient": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ] }, "rlimits": [ { "type": "RLIMIT_NOFILE", "hard": 1024, "soft": 1024 } ], "noNewPrivileges": true }, "root": { "path": "rootfs", "readonly": true }, "hostname": "runc", "mounts": [ { "destination": "/proc", "type": "proc", "source": "proc" }, { "destination": "/dev", "type": "tmpfs", "source": "tmpfs", "options": [ "nosuid", "strictatime", "mode=755", "size=65536k" ] }, { "destination": "/dev/pts", "type": "devpts", "source": "devpts", "options": [ "nosuid", "noexec", "newinstance", "ptmxmode=0666", "mode=0620", "gid=5" ] }, { "destination": "/dev/shm", "type": "tmpfs", "source": "shm", "options": [ "nosuid", "noexec", "nodev", "mode=1777", "size=65536k" ] }, { "destination": "/dev/mqueue", "type": "mqueue", "source": "mqueue", "options": [ "nosuid", "noexec", "nodev" ] }, { "destination": "/sys", "type": "sysfs", "source": "sysfs", "options": [ "nosuid", "noexec", "nodev", "ro" ] }, { "destination": "/sys/fs/cgroup", "type": "cgroup", "source": "cgroup", "options": [ "nosuid", "noexec", "nodev", "relatime", "ro" ] } ], "hooks": {}, "solaris": { "anet": [ { "allowedAddress": "172.17.0.2/16", "configureAllowedAddress": "true", "defrouter": "172.17.0.1/16", "linkProtection": "mac-nospoof, ip-nospoof", "linkname": "net0", "lowerLink": "net2", "macAddress": "02:42:f8:52:c7:16" } ] }, "linux": { "seccomp" : { "defaultAction": "SCMP_ACT_ALLOW", "flags" : [] }, "sysctl": { "net.ipv4.ip_forward": "1", "net.core.somaxconn": "256" }, "resources": { "blockIO": { "weight": 10, "leafWeight": 10, "weightDevice": [ { "major": 8, "minor": 0, "weight": 500, "leafWeight": 300 }, { "major": 8, "minor": 16, "weight": 500 } ], "throttleReadBpsDevice": [ { "major": 8, "minor": 0, "rate": 600 } ], "throttleWriteIOPSDevice": [ { "major": 8, "minor": 16, "rate": 300 } ] }, "devices": [ { "allow": false, "access": "rwm" } ] }, "namespaces": [ { "type": "pid" }, { "type": "network" }, { "type": "ipc" }, { "type": "uts" }, { "type": "mount" } ], "maskedPaths": [ "/proc/kcore", "/proc/latency_stats", "/proc/timer_list", "/proc/timer_stats", "/proc/sched_debug", "/sys/firmware" ], "readonlyPaths": [ "/proc/asound", "/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger" ] } } crun-1.16.1/libocispec/tests/data/image_manifest.json0000664000000000000000000000144713677106237021013 0ustar0000000000000000{ "schemaVersion": 2, "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 675598, "digest": "sha256:9d3dd9504c685a304985025df4ed0283e47ac9ffa9bd0326fddf4d59513f0827" }, { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 156, "digest": "sha256:2b689805fbd00b2db1df73fae47562faac1a626d5f61744bfe29946ecff5d73d" }, { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 148, "digest": "sha256:c57089565e894899735d458f0fd4bb17a0f1e0df8d72da392b85c9b35ee777cd" } ], "annotations": { "key1": "value1", "key2": "value2" } } crun-1.16.1/libocispec/tests/data/image_config.json0000664000000000000000000000311713677106237020446 0ustar0000000000000000{ "created": "2015-10-31T22:22:56.015925234Z", "author": "Alyssa P. Hacker ", "architecture": "amd64", "os": "linux", "config": { "User": "1:1", "ExposedPorts": { "8080/tcp": {} }, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "FOO=docker_is_a_really", "BAR=great_tool_you_know" ], "Entrypoint": [ "/bin/sh" ], "Cmd": [ "--foreground", "--config", "/etc/my-app.d/default.cfg" ], "Volumes": { "/var/job-result-data": {}, "/var/log/my-app-logs": {} }, "StopSignal": "SIGKILL", "WorkingDir": "/home/alice", "Labels": { "com.example.project.git.url": "https://example.com/project.git", "com.example.project.git.commit": "45a939b2999782a3f005621a8d0f29aa387e1d6b" } }, "rootfs": { "diff_ids": [ "sha256:9d3dd9504c685a304985025df4ed0283e47ac9ffa9bd0326fddf4d59513f0827", "sha256:2b689805fbd00b2db1df73fae47562faac1a626d5f61744bfe29946ecff5d73d" ], "type": "layers" }, "history": [ { "created": "2015-10-31T22:22:54.690851953Z", "created_by": "/bin/sh -c #(nop) ADD file:a3bc1e842b69636f9df5256c49c5374fb4eef1e281fe3f282c65fb853ee171c5 in /" }, { "created": "2015-10-31T22:22:55.613815829Z", "created_by": "/bin/sh -c #(nop) CMD [\"sh\"]", "empty_layer": true } ] } crun-1.16.1/libocispec/tests/data/config.nocwd.json0000664000000000000000000000557413677106237020426 0ustar0000000000000000{ "ociVersion": "1.0.0-rc2-dev", "platform": { "os": "linux", "arch": "amd64" }, "process": { "terminal": true, "consoleSize": { "height": 0, "width": 0 }, "user": { "uid": 101, "gid": 0 }, "args": [ "ARGS1", "sh" ], "env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm" ], "capabilities": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "rlimits": [ { "type": "RLIMIT_NOFILE", "hard": 1024, "soft": 1024 } ], "noNewPrivileges": true }, "root": { "path": "rootfs", "readonly": true }, "hostname": "runc", "mounts": [ { "destination": "/proc", "type": "proc", "source": "proc" }, { "destination": "/dev", "type": "tmpfs", "source": "tmpfs", "options": [ "nosuid", "strictatime", "mode=755", "size=65536k" ] }, { "destination": "/dev/pts", "type": "devpts", "source": "devpts", "options": [ "nosuid", "noexec", "newinstance", "ptmxmode=0666", "mode=0620", "gid=5" ] }, { "destination": "/dev/shm", "type": "tmpfs", "source": "shm", "options": [ "nosuid", "noexec", "nodev", "mode=1777", "size=65536k" ] }, { "destination": "/dev/mqueue", "type": "mqueue", "source": "mqueue", "options": [ "nosuid", "noexec", "nodev" ] }, { "destination": "/sys", "type": "sysfs", "source": "sysfs", "options": [ "nosuid", "noexec", "nodev", "ro" ] }, { "destination": "/sys/fs/cgroup", "type": "cgroup", "source": "cgroup", "options": [ "nosuid", "noexec", "nodev", "relatime", "ro" ] } ], "hooks": {}, "solaris": { "anet": [ { "allowedAddress": "172.17.0.2/16", "configureAllowedAddress": "true", "defrouter": "172.17.0.1/16", "linkProtection": "mac-nospoof, ip-nospoof", "linkname": "net0", "lowerLink": "net2", "macAddress": "02:42:f8:52:c7:16" } ] }, "linux": { "sysctl": { "net.ipv4.ip_forward": "1", "net.core.somaxconn": "256" }, "resources": { "devices": [ { "allow": false, "access": "rwm" } ] }, "namespaces": [ { "type": "pid" }, { "type": "network" }, { "type": "ipc" }, { "type": "uts" }, { "type": "mount" } ], "maskedPaths": [ "/proc/kcore", "/proc/latency_stats", "/proc/timer_list", "/proc/timer_stats", "/proc/sched_debug", "/sys/firmware" ], "readonlyPaths": [ "/proc/asound", "/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger" ] } } crun-1.16.1/libocispec/tests/data/image_manifest_item.json0000664000000000000000000000102613677106237022022 0ustar0000000000000000[ { "Config":"5b117edd0b767986092e9f721ba2364951b0a271f53f1f41aff9dd1861c2d4fe.json", "RepoTags":null, "Layers":[ "e20c5c3444dd86d3e7ce9ddbc1e0cdc0ed02c08ea110612490578d05c153f1aa/layer.tar", "450bfc2e8e428446718353669503dc0d4337508d0704a28c0a06973cdf90f18b/layer.tar", "e5ffeddba503ff2220cf4587030131c2cee5aef6083df1d2559e3d576bf04c99/layer.tar", "6de415c70d8eb466e8c4db907c7c151882632fd851f38ae90a89226c3ecf21f6/layer.tar", "080c8e26809e5a3b25826ba37fff877cdd76d900857018e4b28bb0f19ab83325/layer.tar" ] } ] crun-1.16.1/libocispec/tests/data/residual_image_layout_config.json0000664000000000000000000000052513724156735023734 0ustar0000000000000000{ "imageLayoutVersion": "1.0.0", "residual_int": 1, "residual_float": 1.1, "residual_string": "residual", "residual_true": true, "residual_false": false, "residual_array": [ 1, 2, 3, 4, 5, 6 ], "residual_obj": { "key1": "value1", "key2": "value2", "key3": "value3" } } crun-1.16.1/libocispec/tests/data/null_value_config.json0000664000000000000000000000015214160576556021531 0ustar0000000000000000{ "imageLayoutVersion": "1.0.0", "just-key": null, "obj-item": { "key1": null } } crun-1.16.1/libocispec/tests/data/doublearray.json0000664000000000000000000000262214002226462020332 0ustar0000000000000000{ "strarrays": [ [ "stra", "strb", "strc" ], [ "str2a", "str2b" ], [ "str3a" ] ], "intarrays": [ [ 1 ], [ 1, 2 ], [ 1, 2, 3 ] ], "boolarrays": [ [ true, false ], [ false, true ], [ true ], [ false ] ], "objectarrays": [ [ { "first": true, "second": "item1" }, { "first": false, "second": "item2" }, { "first": true, "second": "item3" } ], [ { "first": false, "second": "item11" }, { "first": true, "second": "item12" }, { "first": false, "second": "item13" } ] ], "refobjarrays": [ [ { "item1": "first1", "item2": 1, "item3": false }, { "item1": "first2", "item2": 2, "item3": true }, { "item1": "first3", "item2": 3, "item3": false } ], [ { "item1": "second1", "item2": 11, "item3": true }, { "item1": "second2", "item2": 12, "item3": false }, { "item1": "second3", "item2": 13, "item3": true } ] ] } crun-1.16.1/libocispec/tests/data/top_array_int.json0000664000000000000000000000001214002226462020662 0ustar0000000000000000[1, 2, 3] crun-1.16.1/libocispec/tests/data/top_array_string.json0000664000000000000000000000004114002226462021400 0ustar0000000000000000[ "topstr1", "topstr2" ] crun-1.16.1/libocispec/tests/data/top_double_array_int.json0000664000000000000000000000004714002226462022224 0ustar0000000000000000[ [1, 2, 3], [1, 2], [1] ] crun-1.16.1/libocispec/tests/data/top_double_array_obj.json0000664000000000000000000000043114002226462022201 0ustar0000000000000000[ [ {"first": true, "second": 11, "third": "doubleobj11"}, {"first": false, "second": 12, "third": "doubleobj12"} ], [ {"first": false, "second": 21, "third": "doubleobj21"}, {"first": true, "second": 22, "third": "doubleobj22"} ] ] crun-1.16.1/libocispec/tests/data/top_double_array_refobj.json0000664000000000000000000000040114013506342022673 0ustar0000000000000000[ [ {"item1": "test11", "item2": 11, "item3": true}, {"item1": "test12", "item2": 12, "item3": false} ], [ {"item1": "test21", "item2": 21, "item3": false}, {"item1": "test22", "item2": 22, "item3": true} ] ] crun-1.16.1/libocispec/tests/data/top_double_array_string.json0000664000000000000000000000014014002226462022732 0ustar0000000000000000[ ["doublestr11"], ["doublestr21", "doublestr22"], ["doublestr31", "doublestr32"] ] crun-1.16.1/libocispec/tests/test-1.c0000644000000000000000000001110114332154664015476 0ustar0000000000000000/* Copyright (C) 2017, 2019 Giuseppe Scrivano libocispec 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. libocispec 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 libocispec. If not, see . */ #include "config.h" #include #include #include #include #include "ocispec/runtime_spec_schema_config_schema.h" int main () { parser_error err; runtime_spec_schema_config_schema *container = runtime_spec_schema_config_schema_parse_file ("tests/data/config.json", 0, &err); runtime_spec_schema_config_schema *container_gen = NULL; char *json_buf = NULL; if (container == NULL) { printf ("error %s\n", err); exit (1); } json_buf = runtime_spec_schema_config_schema_generate_json(container, 0, &err); if (json_buf == NULL) { printf("gen error %s\n", err); exit (1); } container_gen = runtime_spec_schema_config_schema_parse_data(json_buf, 0, &err); if (container == NULL) { printf ("parse error %s\n", err); exit (1); } if (strcmp (container->hostname, "runc") && strcmp(container->hostname, container_gen->hostname)) exit (5); if (strcmp (container->process->cwd, "/cwd") && strcmp (container->process->cwd, container_gen->process->cwd)) exit (51); if (container->process->user->uid != 101 || container_gen->process->user->uid != 101) exit (52); if (!container->process->terminal_present) exit (53); if (!container->process->user->uid_present || container_gen->process->user->gid_present) exit (6); if (strcmp (container->process->args[0], "ARGS1") && strcmp (container->process->args[0], container_gen->process->args[0])) exit (61); if (strcmp (container->mounts[0]->destination, "/proc") && strcmp (container->mounts[0]->destination, container_gen->mounts[0]->destination)) exit (62); if (container->linux->resources->block_io->weight_device[0]->major != 8 || container_gen->linux->resources->block_io->weight_device[0]->major != 8) exit (5); if (container->linux->resources->block_io->weight_device[0]->minor != 0 || container_gen->linux->resources->block_io->weight_device[0]->minor != 0) exit (5); if (container->linux->resources->block_io->weight_device[0]->weight != 500 || container_gen->linux->resources->block_io->weight_device[0]->weight != 500) exit (5); if (container->linux->resources->block_io->weight_device[0]->leaf_weight != 300 || container_gen->linux->resources->block_io->weight_device[0]->leaf_weight != 300) exit (5); if (container->linux->resources->block_io->throttle_read_bps_device[0]->major != 8 || container_gen->linux->resources->block_io->throttle_read_bps_device[0]->major != 8) exit (5); if (container->linux->resources->block_io->throttle_read_bps_device[0]->minor != 0 || container_gen->linux->resources->block_io->throttle_read_bps_device[0]->minor != 0) exit (5); if (container->linux->resources->block_io->throttle_read_bps_device[0]->rate != 600 || container_gen->linux->resources->block_io->throttle_read_bps_device[0]->rate != 600) exit (5); if (container->linux->resources->block_io->throttle_write_iops_device[0]->major != 8 || container_gen->linux->resources->block_io->throttle_write_iops_device[0]->major != 8) exit (5); if (container->linux->resources->block_io->throttle_write_iops_device[0]->minor != 16 || container_gen->linux->resources->block_io->throttle_write_iops_device[0]->minor != 16) exit (5); if (container->linux->resources->block_io->throttle_write_iops_device[0]->rate != 300 || container_gen->linux->resources->block_io->throttle_write_iops_device[0]->rate != 300) exit (5); if (container->linux->namespaces_len != 5 || container_gen->linux->namespaces_len != 5) exit (5); if (strcmp(container->linux->namespaces[2]->type, "ipc") && strcmp(container->linux->namespaces[2]->type, container_gen->linux->namespaces[2]->type)) exit (5); if (container->linux->seccomp == NULL || container->linux->seccomp->flags == NULL || container->linux->seccomp->flags_len != 0) exit (5); free(json_buf); free_runtime_spec_schema_config_schema (container); free_runtime_spec_schema_config_schema (container_gen); exit (0); } crun-1.16.1/libocispec/tests/test-10.c0000644000000000000000000005167314332154664015600 0ustar0000000000000000/* Copyright (C) 2020 duguhaotian libocispec 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. libocispec 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 libocispec. If not, see . */ #include "config.h" #include #include #include #include #include "ocispec/basic_test_double_array.h" #include "ocispec/basic_test_top_array_int.h" #include "ocispec/basic_test_top_array_string.h" #include "ocispec/basic_test_top_double_array_int.h" #include "ocispec/basic_test_top_double_array_obj.h" #include "ocispec/basic_test_top_double_array_string.h" #include "ocispec/basic_test_top_double_array_refobj.h" int do_test_object_double_array() { parser_error err = NULL; struct parser_context ctx = { 0 }; int ret = 0; basic_test_double_array *test_data = basic_test_double_array_parse_file( "tests/data/doublearray.json", &ctx, &err); char *json_buf = NULL; size_t i, j; if (test_data == NULL) { printf ("error %s\n", err); free(err); return 1; } // check double array of string if (test_data->strarrays_len != 3) { printf("invalid strarrays len\n"); ret = 1; goto out; } char *expect_strs[3][4] = { {"stra", "strb", "strc", NULL}, {"str2a", "str2b", NULL}, {"str3a", NULL}, }; size_t str_lens[3] = {3, 2, 1}; for (i = 0; i < 3; i++) { if (test_data->strarrays[i] == NULL || test_data->strarrays_item_lens == NULL) { printf("item %zu is null\n", i); ret = 1; goto out; } if (test_data->strarrays_item_lens[i] != str_lens[i]) { printf("double array str item %zu is expect len: %zu, get: %zu\n", i, str_lens[i], test_data->strarrays_item_lens[i]); ret = 1; goto out; } for (j = 0; j < 4 && expect_strs[i][j] != NULL; j++) { if (test_data->strarrays[i][j] == NULL || strcmp(test_data->strarrays[i][j], expect_strs[i][j]) != 0) { printf("item %zu: expect: %s, get: %s\n", i, expect_strs[i][j], test_data->strarrays[i][j]); ret = 1; goto out; } } } // check double array of int32 if (test_data->intarrays_len != 3) { printf("invalid intarrays len\n"); ret = 1; goto out; } int32_t expect_ints[3][4] = { {1}, {1, 2}, {1, 2, 3}, }; size_t int_lens[3] = {1, 2, 3}; for (i = 0; i < 3; i++) { if (test_data->intarrays[i] == NULL || test_data->intarrays_item_lens == NULL) { printf("item %zu is null\n", i); ret = 1; goto out; } if (test_data->intarrays_item_lens[i] != int_lens[i]) { printf("double array int item %zu is expect len: %zu, get: %zu\n", i, int_lens[i], test_data->intarrays_item_lens[i]); ret = 1; goto out; } for (j = 0; j < 4 && expect_ints[i][j] != 0; j++) { if (test_data->intarrays[i][j] != expect_ints[i][j]) { printf("item %zu: expect: %d, get: %d\n", i, expect_ints[i][j], test_data->intarrays[i][j]); ret = 1; goto out; } } } // check bool array of int32 if (test_data->boolarrays_len != 4) { printf("invalid bool arrays len\n"); ret = 1; goto out; } int32_t expect_bools[4][2] = { {true, false}, {false, true}, {true}, {false}, }; size_t bool_lens[4] = {2, 2, 1, 1}; for (i = 0; i < 4; i++) { if (test_data->boolarrays[i] == NULL || test_data->boolarrays_item_lens == NULL) { printf("item %zu is null\n", i); ret = 1; goto out; } if (test_data->boolarrays_item_lens[i] != bool_lens[i]) { printf("double array bool item %zu is expect len: %zu, get: %zu\n", i, bool_lens[i], test_data->boolarrays_item_lens[i]); ret = 1; goto out; } for (j = 0; j < bool_lens[i]; j++) { if (test_data->boolarrays[i][j] != expect_bools[i][j]) { printf("item %zu: expect: %d, get: %d\n", i, expect_bools[i][j], test_data->boolarrays[i][j]); ret = 1; goto out; } } } // check object array of int32 if (test_data->objectarrays_len != 2) { printf("invalid object arrays len\n"); ret = 1; goto out; } bool obj_firsts[2][3] = { {true, false, true}, {false, true, false}, }; char *obj_seconds[2][3] = { {"item1", "item2", "item3"}, {"item11", "item12", "item13"}, }; for (i = 0; i < 2; i++) { if (test_data->objectarrays[i] == NULL || test_data->objectarrays_item_lens == NULL) { printf("object array item %zu: is null\n", i); ret = 1; goto out; } for (j = 0; j < 3; j++) { if (obj_firsts[i][j] != test_data->objectarrays[i][j]->first) { printf("item %zu -> %zu: expect: %d, get: %d\n", i, j, obj_firsts[i][j], test_data->objectarrays[i][j]->first); ret = 1; goto out; } if (test_data->objectarrays[i][j]->second == NULL || strcmp(obj_seconds[i][j], test_data->objectarrays[i][j]->second) != 0) { printf("item %zu -> %zu: expect: %s, get: %s\n", i, j, obj_seconds[i][j], test_data->objectarrays[i][j]->second); ret = 1; goto out; } } } // check ref object array of int32 if (test_data->refobjarrays_len != 2) { printf("invalid ref object arrays len\n"); ret = 1; goto out; } char *refobj_item1[2][3] = { {"first1", "first2", "first3"}, {"second1", "second2", "second3"}, }; int32_t refobj_item2[2][3] = { {1, 2, 3}, {11, 12, 13}, }; bool refobj_item3[2][3] = { {false, true, false}, {true, false, true}, }; for (i = 0; i < 2; i++) { if (test_data->refobjarrays[i] == NULL || test_data->refobjarrays_item_lens == NULL) { printf("object array item %zu: is null\n", i); ret = 1; goto out; } for (j = 0; j < 3; j++) { if (refobj_item3[i][j] != test_data->refobjarrays[i][j]->item3) { printf("item %zu -> %zu: expect: %d, get: %d\n", i, j, refobj_item3[i][j], test_data->refobjarrays[i][j]->item3); ret = 1; goto out; } if (refobj_item2[i][j] != test_data->refobjarrays[i][j]->item2) { printf("item %zu -> %zu: expect: %d, get: %d\n", i, j, refobj_item2[i][j], test_data->refobjarrays[i][j]->item2); ret = 1; goto out; } if (test_data->refobjarrays[i][j]->item1 == NULL || strcmp(refobj_item1[i][j], test_data->refobjarrays[i][j]->item1) != 0) { printf("item %zu -> %zu: expect: %s, get: %s\n", i, j, refobj_item1[i][j], test_data->refobjarrays[i][j]->item1); ret = 1; goto out; } } } printf("double array of object check parse sucess\n"); // update test data, and check generate json free(test_data->strarrays[0][0]); test_data->strarrays[0][0] = strdup("stringtestflag"); test_data->intarrays[0][0] = 8888; free(test_data->objectarrays[0][0]->second); test_data->objectarrays[0][0]->second = strdup("objectteststr"); free(test_data->refobjarrays[0][0]->item1); test_data->refobjarrays[0][0]->item1 = strdup("objectrefstr"); json_buf = basic_test_double_array_generate_json(test_data, &ctx, &err); if (json_buf == NULL) { printf("gen error %s\n", err); ret = 1; goto out; } printf("%s\n", json_buf); // origin json str should same with generate new json str, if (strstr(json_buf, "stringtestflag") == NULL) { ret = 51; goto out; } if (strstr(json_buf, "objectteststr") == NULL) { ret = 52; goto out; } if (strstr(json_buf, "objectrefstr") == NULL) { ret = 53; goto out; } if (strstr(json_buf, "8888") == NULL) { ret = 54; goto out; } out: free(err); free(json_buf); free_basic_test_double_array(test_data); return ret; } int do_test_top_array_of_int() { parser_error err = NULL; struct parser_context ctx = { 0 }; int ret = 0; basic_test_top_array_int_container *test_data = basic_test_top_array_int_container_parse_file( "tests/data/top_array_int.json", &ctx, &err); char *json_buf = NULL; if (test_data == NULL) { printf("top int array parse error %s\n", err); free(err); return 1; } size_t i; uint8_t expect[3] = {1, 2, 3}; if (test_data->len != 3) { printf("top int array expect len: 3, get: %zu\n", test_data->len); ret = 1; goto out; } for (i = 0; i < 3; i++) { if (test_data->items[i] != expect[i]) { printf("item %zu: top int array expect: %u, get: %u\n", i, expect[i], test_data->items[i]); ret = 1; goto out; } } test_data->items[0] = 111; json_buf = basic_test_top_array_int_container_generate_json(test_data, &ctx, &err); if (json_buf == NULL) { printf("gen error %s\n", err); ret = 1; goto out; } if (strstr(json_buf, "111") == NULL) { printf("change not work %s\n", err); ret = 1; goto out; } out: free(err); free_basic_test_top_array_int_container(test_data); free(json_buf); return ret; } int do_test_top_array_of_string() { parser_error err = NULL; struct parser_context ctx = { 0 }; int ret = 0; basic_test_top_array_string_container *test_data = basic_test_top_array_string_container_parse_file( "tests/data/top_array_string.json", &ctx, &err); char *json_buf = NULL; if (test_data == NULL) { printf("top int array parse error %s\n", err); free(err); return 1; } size_t i; char *expect[3] = {"topstr1", "topstr2"}; if (test_data->len != 2) { printf("top int array expect len: 3, get: %zu\n", test_data->len); ret = 1; goto out; } for (i = 0; i < 2; i++) { if (test_data->items[i] == NULL || strcmp(test_data->items[i], expect[i]) != 0) { printf("item %zu: top int array expect: %s, get: %s\n", i, expect[i], test_data->items[i]); ret = 1; goto out; } } free(test_data->items[0]); test_data->items[0] = strdup("hello"); json_buf = basic_test_top_array_string_container_generate_json(test_data, &ctx, &err); if (json_buf == NULL) { printf("gen error %s\n", err); ret = 1; goto out; } if (strstr(json_buf, "hello") == NULL) { printf("change not work %s\n", err); ret = 1; goto out; } out: free(err); free_basic_test_top_array_string_container(test_data); free(json_buf); return ret; } int do_test_top_double_array_of_string() { parser_error err = NULL; struct parser_context ctx = { 0 }; int ret = 0; basic_test_top_double_array_string_container *test_data = basic_test_top_double_array_string_container_parse_file( "tests/data/top_double_array_string.json", &ctx, &err); char *json_buf = NULL; if (test_data == NULL) { printf("top string double array parse error %s\n", err); free(err); return 1; } size_t i; char *expect[3][2] = {{"doublestr11"}, {"doublestr21", "doublestr22"}, {"doublestr31", "doublestr32"}}; size_t expect_lens[3] = {1, 2, 2}; if (test_data->len != 3) { printf("top string double array expect len: 3, get: %zu\n", test_data->len); ret = 1; goto out; } for (i = 0; i < 3; i++) { size_t j; if (test_data->subitem_lens[i] != expect_lens[i]) { printf("item %zu: top string double array expect len: %zu, get: %zu\n", i, expect_lens[i], test_data->subitem_lens[i]); ret = 1; goto out; } for (j = 0; j < expect_lens[i]; j++) { if (test_data->items[i][j] == NULL || strcmp(test_data->items[i][j], expect[i][j]) != 0) { printf("item %zu: top int array expect: %s, get: %s\n", i, expect[i][j], test_data->items[i][j]); ret = 1; goto out; } } } free(test_data->items[0][0]); test_data->items[0][0] = strdup("hello"); json_buf = basic_test_top_double_array_string_container_generate_json(test_data, &ctx, &err); if (json_buf == NULL) { printf("gen error %s\n", err); ret = 1; goto out; } if (strstr(json_buf, "hello") == NULL) { printf("change not work %s\n", err); ret = 1; goto out; } out: free_basic_test_top_double_array_string_container(test_data); free(err); free(json_buf); return ret; } int do_test_top_double_array_of_int() { parser_error err = NULL; struct parser_context ctx = { 0 }; int ret = 0; basic_test_top_double_array_int_container *test_data = basic_test_top_double_array_int_container_parse_file( "tests/data/top_double_array_int.json", &ctx, &err); char *json_buf = NULL; if (test_data == NULL) { printf("top int double array parse error %s\n", err); free(err); return 1; } size_t i; int32_t expect[3][3] = {{1, 2, 3}, {1, 2}, {1}}; size_t expect_lens[3] = {3, 2, 1}; if (test_data->len != 3) { printf("top int double array expect len: 3, get: %zu\n", test_data->len); ret = 1; goto out; } for (i = 0; i < 3; i++) { size_t j; if (test_data->subitem_lens[i] != expect_lens[i]) { printf("item %zu: top int double array expect len: %zu, get: %zu\n", i, expect_lens[i], test_data->subitem_lens[i]); ret = 1; goto out; } for (j = 0; j < expect_lens[i]; j++) { if (test_data->items[i][j] != expect[i][j]) { printf("item %zu: top int array expect: %d, get: %d\n", i, expect[i][j], test_data->items[i][j]); ret = 1; goto out; } } } test_data->items[0][0] = 888; json_buf = basic_test_top_double_array_int_container_generate_json(test_data, &ctx, &err); if (json_buf == NULL) { printf("gen error %s\n", err); ret = 1; goto out; } if (strstr(json_buf, "888") == NULL) { printf("change not work %s\n", err); ret = 1; goto out; } out: free(err); free_basic_test_top_double_array_int_container(test_data); free(json_buf); return ret; } int do_test_top_double_array_of_obj() { parser_error err = NULL; struct parser_context ctx = { 0 }; int ret = 0; basic_test_top_double_array_obj_container *test_data = basic_test_top_double_array_obj_container_parse_file( "tests/data/top_double_array_obj.json", &ctx, &err); char *json_buf = NULL; if (test_data == NULL) { printf("top int double array parse error %s\n", err); free(err); return 1; } size_t i; bool expect_bools[2][2] = {{true, false}, {false, true}}; int32_t expect_ints[2][2] = {{11, 12}, {21, 22}}; char *expect_strs[2][2] = {{"doubleobj11", "doubleobj12"}, {"doubleobj21", "doubleobj22"}}; size_t expect_lens[3] = {2, 2}; if (test_data->len != 2) { printf("top obj double array expect len: 2, get: %zu\n", test_data->len); ret = 1; goto out; } for (i = 0; i < 2; i++) { size_t j; if (test_data->subitem_lens[i] != expect_lens[i]) { printf("item %zu: top obj double array expect len: %zu, get: %zu\n", i, expect_lens[i], test_data->subitem_lens[i]); ret = 1; goto out; } for (j = 0; j < expect_lens[i]; j++) { if (test_data->items[i][j]->first != expect_bools[i][j]) { printf("item %zu: top int array first expect: %d, get: %d\n", i, expect_bools[i][j], test_data->items[i][j]->first); ret = 1; goto out; } if (test_data->items[i][j]->second != expect_ints[i][j]) { printf("item %zu: top int array second expect: %d, get: %d\n", i, expect_ints[i][j], test_data->items[i][j]->second); ret = 1; goto out; } if (test_data->items[i][j]->third == NULL || strcmp(test_data->items[i][j]->third, expect_strs[i][j]) != 0) { printf("item %zu: top int array third expect: %s, get: %s\n", i, expect_strs[i][j], test_data->items[i][j]->third); ret = 1; goto out; } } } test_data->items[0][0]->second = 999; free(test_data->items[0][1]->third); test_data->items[0][1]->third = strdup("hello"); json_buf = basic_test_top_double_array_obj_container_generate_json(test_data, &ctx, &err); if (json_buf == NULL) { printf("gen error %s\n", err); ret = 1; goto out; } if (strstr(json_buf, "999") == NULL) { printf("change second not work %s\n", err); ret = 1; goto out; } if (strstr(json_buf, "hello") == NULL) { printf("change third not work %s\n", err); ret = 1; goto out; } out: free(err); free_basic_test_top_double_array_obj_container(test_data); free(json_buf); return ret; } int do_test_top_double_array_of_refobj() { parser_error err = NULL; struct parser_context ctx = { 0 }; int ret = 0; basic_test_top_double_array_refobj_container *test_data = basic_test_top_double_array_refobj_container_parse_file( "tests/data/top_double_array_refobj.json", &ctx, &err); char *json_buf = NULL; if (test_data == NULL) { printf("top int double array parse error %s\n", err); free(err); return 1; } size_t i; bool expect_bools[2][2] = {{true, false}, {false, true}}; int32_t expect_ints[2][2] = {{11, 12}, {21, 22}}; char *expect_strs[2][2] = {{"test11", "test12"}, {"test21", "test22"}}; size_t expect_lens[3] = {2, 2}; if (test_data->len != 2) { printf("top obj double array expect len: 2, get: %zu\n", test_data->len); ret = 1; goto out; } for (i = 0; i < 2; i++) { size_t j; if (test_data->subitem_lens[i] != expect_lens[i]) { printf("item %zu: top obj double array expect len: %zu, get: %zu\n", i, expect_lens[i], test_data->subitem_lens[i]); ret = 1; goto out; } for (j = 0; j < expect_lens[i]; j++) { if (test_data->items[i][j]->item3 != expect_bools[i][j]) { printf("item %zu: top int array first expect: %d, get: %d\n", i, expect_bools[i][j], test_data->items[i][j]->item3); ret = 1; goto out; } if (test_data->items[i][j]->item2 != expect_ints[i][j]) { printf("item %zu: top int array second expect: %d, get: %d\n", i, expect_ints[i][j], test_data->items[i][j]->item2); ret = 1; goto out; } if (test_data->items[i][j]->item1 == NULL || strcmp(test_data->items[i][j]->item1, expect_strs[i][j]) != 0) { printf("item %zu: top int array third expect: %s, get: %s\n", i, expect_strs[i][j], test_data->items[i][j]->item1); ret = 1; goto out; } } } test_data->items[0][0]->item2 = 999; free(test_data->items[0][1]->item1); test_data->items[0][1]->item1 = strdup("hello"); json_buf = basic_test_top_double_array_refobj_container_generate_json(test_data, &ctx, &err); if (json_buf == NULL) { printf("gen error %s\n", err); ret = 1; goto out; } if (strstr(json_buf, "999") == NULL) { printf("change second not work %s\n", err); ret = 1; goto out; } if (strstr(json_buf, "hello") == NULL) { printf("change third not work %s\n", err); ret = 1; goto out; } out: free(err); free_basic_test_top_double_array_refobj_container(test_data); free(json_buf); return ret; } int main () { int ret; ret = do_test_object_double_array(); if (ret != 0) { printf("do_test_object_double_array failed with: %d\n", ret); exit(ret); } ret = do_test_top_array_of_int(); if (ret != 0) { printf("do_test_top_array_of_int failed with: %d\n", ret); exit(ret); } ret = do_test_top_array_of_string(); if (ret != 0) { printf("do_test_top_array_of_string failed with: %d\n", ret); exit(ret); } ret = do_test_top_double_array_of_string(); if (ret != 0) { printf("do_test_top_double_array_of_string failed with: %d\n", ret); exit(ret); } ret = do_test_top_double_array_of_int(); if (ret != 0) { printf("do_test_top_double_array_of_int failed with: %d\n", ret); exit(ret); } ret = do_test_top_double_array_of_obj(); if (ret != 0) { printf("do_test_top_double_array_of_obj failed with: %d\n", ret); exit(ret); } ret = do_test_top_double_array_of_refobj(); if (ret != 0) { printf("do_test_top_double_array_of_refobj failed with: %d\n", ret); exit(ret); } return 0; } crun-1.16.1/libocispec/tests/test-11.c0000644000000000000000000000430214332154664015564 0ustar0000000000000000/* Copyright (C) 2021 duguhaotian libocispec 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. libocispec 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 libocispec. If not, see . */ #include "config.h" #include #include #include #include #include "ocispec/image_spec_schema_image_layout_schema.h" #ifndef OPT_PARSE_FULLKEY # define OPT_PARSE_FULLKEY 0x08 #endif int main () { parser_error err; struct parser_context ctx; ctx.options = OPT_PARSE_FULLKEY; image_spec_schema_image_layout_schema *image_layout = image_spec_schema_image_layout_schema_parse_file ("tests/data/null_value_config.json", &ctx, &err); image_spec_schema_image_layout_schema *image_layout_gen = NULL; char *json_buf = NULL; if (image_layout == NULL) { printf ("error %s\n", err); exit (1); } json_buf = image_spec_schema_image_layout_schema_generate_json(image_layout, &ctx, &err); if (json_buf == NULL) { printf("gen error %s\n", err); free(err); exit (1); } image_layout_gen = image_spec_schema_image_layout_schema_parse_data(json_buf, 0, &err); if (image_layout_gen == NULL) { printf("parse error %s\n", err); free(err); exit(1); } if (strcmp (image_layout->image_layout_version, "1.0.0") && strcmp (image_layout->image_layout_version, image_layout_gen->image_layout_version)) exit (5); printf("%s\n", json_buf); // origin json str should same with generate new json str, if (strstr(json_buf, "just-key\": null") == NULL) exit (51); if (strstr(json_buf, "key1\": null") == NULL) exit (52); free(json_buf); free_image_spec_schema_image_layout_schema (image_layout); free_image_spec_schema_image_layout_schema (image_layout_gen); exit (0); } crun-1.16.1/libocispec/tests/test-2.c0000644000000000000000000000205314332154664015505 0ustar0000000000000000/* Copyright (C) 2017, 2019 Giuseppe Scrivano libocispec 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. libocispec 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 libocispec. If not, see . */ #include "config.h" #include #include #include #include #include "ocispec/runtime_spec_schema_config_schema.h" int main () { parser_error err; runtime_spec_schema_config_schema *container = runtime_spec_schema_config_schema_parse_file ("tests/data/config.nocwd.json", 0, &err); if (container != NULL) { exit (4); } exit (0); } crun-1.16.1/libocispec/tests/test-3.c0000644000000000000000000000545514332154664015517 0ustar0000000000000000/* Copyright (C) 2017 Wang Long libocispec 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. libocispec 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 libocispec. If not, see . */ #include "config.h" #include #include #include #include #include "ocispec/image_spec_schema_config_schema.h" int main () { parser_error err; image_spec_schema_config_schema *image = image_spec_schema_config_schema_parse_file ("tests/data/image_config.json", 0, &err); image_spec_schema_config_schema *image_gen = NULL; char *json_buf = NULL; if (image == NULL) { printf ("error %s\n", err); exit (1); } json_buf = image_spec_schema_config_schema_generate_json(image, 0, &err); if (json_buf == NULL) { printf("gen error %s\n", err); exit (1); } image_gen = image_spec_schema_config_schema_parse_data(json_buf, 0, &err); if (image_gen == NULL) { printf("parse error %s\n", err); exit(1); } if (strcmp (image->author, "Alyssa P. Hacker ") && strcmp (image->author, image_gen->author)) exit (5); if (strcmp (image->created, "2015-10-31T22:22:56.015925234Z") && strcmp (image->created, image_gen->created)) exit (5); if (strcmp (image->os, "linux") && strcmp (image->os, image_gen->os)) exit (5); if (strcmp (image->architecture, "amd64") && strcmp (image->architecture, image_gen->architecture)) exit (5); if (strcmp (image->config->user, "1:1") && strcmp (image->config->user, image_gen->config->user)) exit (5); if (strcmp (image->config->env[1], "FOO=docker_is_a_really") && strcmp (image->config->env[1], image_gen->config->env[1])) exit (5); if (strcmp (image->config->entrypoint[0], "/bin/sh") && strcmp (image->config->entrypoint[0], image_gen->config->entrypoint[0])) exit (5); if (image->config->volumes->len != 2 || image_gen->config->volumes->len != 2) exit (5); if (strcmp (image->config->volumes->keys[0], "/var/job-result-data") && strcmp (image->config->volumes->keys[0], image_gen->config->volumes->keys[0])) exit (5); if (strcmp (image->config->volumes->keys[1], "/var/log/my-app-logs") && strcmp (image->config->volumes->keys[1], image_gen->config->volumes->keys[1])) exit (5); free(json_buf); free_image_spec_schema_config_schema (image); free_image_spec_schema_config_schema(image_gen); exit (0); } crun-1.16.1/libocispec/tests/test-4.c0000644000000000000000000000737714332154664015525 0ustar0000000000000000/* Copyright (C) 2017 Wang Long libocispec 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. libocispec 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 libocispec. If not, see . */ #include "config.h" #include #include #include #include #include "ocispec/image_spec_schema_image_index_schema.h" int main () { parser_error err; image_spec_schema_image_index_schema *image_index = image_spec_schema_image_index_schema_parse_file ("tests/data/image_index_config.json", 0, &err); image_spec_schema_image_index_schema *image_index_gen = NULL; char *json_buf = NULL; if (image_index == NULL) { printf ("error %s\n", err); exit (1); } json_buf = image_spec_schema_image_index_schema_generate_json(image_index, 0, &err); if (json_buf == NULL) { printf("gen error %s\n", err); exit (1); } image_index_gen = image_spec_schema_image_index_schema_parse_data(json_buf, 0, &err); if (image_index_gen == NULL) { printf("parse error %s\n", err); exit(1); } if (image_index->schema_version != 2 || image_index_gen->schema_version != 2) exit (5); if (image_index->annotations->len != 2 || image_index_gen->annotations->len != 2) exit (5); if (image_index->annotations->len != 2 || image_index_gen->annotations->len != 2) exit (5); if (strcmp (image_index->annotations->keys[0], "com.example.key1") && \ strcmp (image_index->annotations->keys[0], image_index_gen->annotations->keys[0])) exit (5); if (strcmp (image_index->annotations->values[1], "value2") && \ strcmp (image_index->annotations->values[1], image_index_gen->annotations->values[1])) exit (5); if (strcmp (image_index->manifests[0]->media_type, "application/vnd.oci.image.manifest.v1+json") && \ strcmp (image_index->manifests[0]->media_type, image_index_gen->manifests[0]->media_type)) exit (5); if (image_index->manifests[0]->size != 7143 || image_index_gen->manifests[0]->size != 7143) exit (5); if (strcmp (image_index->manifests[0]->digest, "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f") && \ strcmp (image_index->manifests[0]->digest, image_index_gen->manifests[0]->digest)) exit (5); if (strcmp (image_index->manifests[0]->platform->os, "linux") && \ strcmp (image_index->manifests[0]->platform->os, image_index_gen->manifests[0]->platform->os)) exit (5); if (strcmp (image_index->manifests[0]->platform->os_version, "1.0.0") && \ strcmp (image_index->manifests[0]->platform->os_version, image_index_gen->manifests[0]->platform->os_version)) exit (5); if (image_index->manifests[0]->platform->os_features_len != 2 || image_index_gen->manifests[0]->platform->os_features_len != 2) exit (5); if (strcmp (image_index->manifests[0]->platform->os_features[1], "simple") && \ strcmp (image_index->manifests[0]->platform->os_features[1], image_index_gen->manifests[0]->platform->os_features[1])) exit (5); if (strcmp (image_index->manifests[0]->platform->architecture, "ppc64le") && \ strcmp (image_index->manifests[0]->platform->architecture, image_index_gen->manifests[0]->platform->architecture)) exit (5); free(json_buf); free_image_spec_schema_image_index_schema (image_index); free_image_spec_schema_image_index_schema (image_index_gen); exit (0); } crun-1.16.1/libocispec/tests/test-5.c0000644000000000000000000000347114332154664015515 0ustar0000000000000000/* Copyright (C) 2017 Wang Long libocispec 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. libocispec 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 libocispec. If not, see . */ #include "config.h" #include #include #include #include #include "ocispec/image_spec_schema_image_layout_schema.h" int main () { parser_error err; image_spec_schema_image_layout_schema *image_layout = image_spec_schema_image_layout_schema_parse_file ("tests/data/image_layout_config.json", 0, &err); image_spec_schema_image_layout_schema *image_layout_gen = NULL; char *json_buf = NULL; if (image_layout == NULL) { printf ("error %s\n", err); exit (1); } json_buf = image_spec_schema_image_layout_schema_generate_json(image_layout, 0, &err); if (json_buf == NULL) { printf("gen error %s\n", err); exit (1); } image_layout_gen = image_spec_schema_image_layout_schema_parse_data(json_buf, 0, &err); if (image_layout_gen == NULL) { printf("parse error %s\n", err); exit(1); } if (strcmp (image_layout->image_layout_version, "1.0.0") && strcmp (image_layout->image_layout_version, image_layout_gen->image_layout_version)) exit (5); free(json_buf); free_image_spec_schema_image_layout_schema (image_layout); free_image_spec_schema_image_layout_schema (image_layout_gen); exit (0); } crun-1.16.1/libocispec/tests/test-6.c0000644000000000000000000000523414332154664015515 0ustar0000000000000000/* Copyright (C) 2017 Yifeng Tan libocispec 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. libocispec 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 libocispec. If not, see . */ #include "config.h" #include #include #include #include #include "ocispec/image_spec_schema_image_manifest_schema.h" int main () { parser_error err; image_spec_schema_image_manifest_schema *manifest = image_spec_schema_image_manifest_schema_parse_file ("tests/data/image_manifest.json", 0, &err); image_spec_schema_image_manifest_schema *manifest_gen = NULL; char *json_buf = NULL; if (manifest == NULL) { printf ("error %s\n", err); exit (1); } json_buf = image_spec_schema_image_manifest_schema_generate_json(manifest, 0, &err); if (json_buf == NULL) { printf("gen error %s\n", err); exit (1); } manifest_gen = image_spec_schema_image_manifest_schema_parse_data(json_buf, 0, &err); if (manifest_gen == NULL) { printf("parse error %s\n", err); exit(1); } if (manifest->schema_version != 2 || manifest_gen->schema_version != 2) exit (5); if (strcmp (manifest->config->media_type, "application/vnd.oci.image.config.v1+json") && strcmp (manifest->config->media_type, manifest_gen->config->media_type)) exit (5); if (manifest->config->size != 1470 || manifest_gen->config->size != 1470) exit (5); if (manifest->layers_len != 3 || manifest_gen->layers_len != 3) exit (5); if (strcmp (manifest->layers[1]->digest, "sha256:2b689805fbd00b2db1df73fae47562faac1a626d5f61744bfe29946ecff5d73d") || \ strcmp (manifest->layers[1]->digest, manifest_gen->layers[1]->digest)) exit (5); if (manifest->annotations->len != 2 || manifest_gen->annotations->len != 2) exit (5); if (strcmp(manifest->annotations->keys[1], "key2") && strcmp(manifest->annotations->keys[1], manifest_gen->annotations->keys[1])) exit (5); if (strcmp(manifest->annotations->values[1], "value2") && strcmp(manifest->annotations->values[1], manifest_gen->annotations->values[1])) exit (5); free(json_buf); free_image_spec_schema_image_manifest_schema (manifest); free_image_spec_schema_image_manifest_schema (manifest_gen); exit (0); } crun-1.16.1/libocispec/tests/test-7.c0000644000000000000000000000365214332154664015520 0ustar0000000000000000/* Copyright (C) 2017 Wang Long libocispec 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. libocispec 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 libocispec. If not, see . */ #include "config.h" #include #include #include #include #include "ocispec/image_spec_schema_config_schema.h" int main () { parser_error err; image_spec_schema_config_schema *image = image_spec_schema_config_schema_parse_file ("tests/data/image_config_mapstringobject.json", 0, &err); image_spec_schema_config_schema *image_gen = NULL; char *json_buf = NULL; if (image == NULL) { printf ("error %s\n", err); exit (1); } json_buf = image_spec_schema_config_schema_generate_json(image, 0, &err); if (json_buf == NULL) { printf("gen error %s\n", err); exit (1); } image_gen = image_spec_schema_config_schema_parse_data(json_buf, 0, &err); if (image_gen == NULL) { printf("parse error %s\n", err); exit(1); } if (image->config->volumes != NULL || image_gen->config->volumes != NULL) exit (5); if (image->config->exposed_ports->len != 1 || image_gen->config->exposed_ports->len != 1) exit (5); if (strcmp (image->config->exposed_ports->keys[0], "8080/tcp") && strcmp (image->config->exposed_ports->keys[0], image_gen->config->exposed_ports->keys[0])) exit (5); free(json_buf); free_image_spec_schema_config_schema (image); free_image_spec_schema_config_schema (image_gen); exit (0); } crun-1.16.1/libocispec/tests/test-8.c0000644000000000000000000000551614332154664015522 0ustar0000000000000000/* Copyright (C) 2017 YiFeng Tan libocispec 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. libocispec 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 libocispec. If not, see . */ #include "config.h" #include #include #include #include #include "ocispec/image_manifest_items_image_manifest_items_schema.h" int main () { parser_error err = NULL; image_manifest_items_image_manifest_items_schema_container *image_items = image_manifest_items_image_manifest_items_schema_container_parse_file ("tests/data/image_manifest_item.json", 0, &err); image_manifest_items_image_manifest_items_schema_container *image_items_gen = NULL; char *json_buf = NULL; if (image_items == NULL) { printf ("error %s\n", err); exit (1); } json_buf = image_manifest_items_image_manifest_items_schema_container_generate_json ( (const image_manifest_items_image_manifest_items_schema_container*)image_items, 0, &err); if (json_buf == NULL) { printf ("gen error %s\n", err); exit (1); } printf("%s\n", json_buf); image_items_gen = image_manifest_items_image_manifest_items_schema_container_parse_data ( json_buf, 0, &err); if (image_items_gen == NULL) { printf ("parse error %s\n", err); exit (1); } if (image_items->len != 1 || image_items->len != image_items_gen->len) exit (5); if (!image_items->items[0]->config || strcmp (image_items->items[0]->config, image_items_gen->items[0]->config) || \ strcmp (image_items_gen->items[0]->config, "5b117edd0b767986092e9f721ba2364951b0a271f53f1f41aff9dd1861c2d4fe.json")) exit (6); if (image_items->items[0]->layers_len != 5 || image_items->items[0]->layers_len != image_items_gen->items[0]->layers_len || \ strcmp (image_items->items[0]->layers[2], image_items_gen->items[0]->layers[2]) || \ strcmp (image_items_gen->items[0]->layers[2], "e5ffeddba503ff2220cf4587030131c2cee5aef6083df1d2559e3d576bf04c99/layer.tar")) exit (7); if (image_items->items[0]->repo_tags_len != 0 || image_items->items[0]->repo_tags_len != image_items_gen->items[0]->repo_tags_len || \ image_items->items[0]->repo_tags != NULL) exit (8); free (json_buf); free_image_manifest_items_image_manifest_items_schema_container (image_items); free_image_manifest_items_image_manifest_items_schema_container (image_items_gen); exit (0); } crun-1.16.1/libocispec/tests/test-9.c0000644000000000000000000000547214332154664015524 0ustar0000000000000000/* Copyright (C) 2020 duguhaotian libocispec 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. libocispec 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 libocispec. If not, see . */ #include "config.h" #include #include #include #include #include "ocispec/image_spec_schema_image_layout_schema.h" #ifndef OPT_PARSE_FULLKEY # define OPT_PARSE_FULLKEY 0x08 #endif int main () { parser_error err; struct parser_context ctx; ctx.options = OPT_PARSE_FULLKEY; image_spec_schema_image_layout_schema *image_layout = image_spec_schema_image_layout_schema_parse_file ("tests/data/residual_image_layout_config.json", &ctx, &err); image_spec_schema_image_layout_schema *image_layout_gen = NULL; char *json_buf = NULL; if (image_layout == NULL) { printf ("error %s\n", err); exit (1); } json_buf = image_spec_schema_image_layout_schema_generate_json(image_layout, &ctx, &err); if (json_buf == NULL) { printf("gen error %s\n", err); free(err); exit (1); } image_layout_gen = image_spec_schema_image_layout_schema_parse_data(json_buf, 0, &err); if (image_layout_gen == NULL) { printf("parse error %s\n", err); free(err); exit(1); } if (strcmp (image_layout->image_layout_version, "1.0.0") && strcmp (image_layout->image_layout_version, image_layout_gen->image_layout_version)) exit (5); printf("%s\n", json_buf); // origin json str should same with generate new json str, if (strstr(json_buf, "residual_int") == NULL) exit (51); if (strstr(json_buf, "residual_float") == NULL) exit (52); if (strstr(json_buf, "residual_string") == NULL) exit (53); if (strstr(json_buf, "residual_true") == NULL) exit (54); if (strstr(json_buf, "residual_false") == NULL) exit (55); if (strstr(json_buf, "residual_array") == NULL) exit (56); if (strstr(json_buf, "residual_obj") == NULL) exit (57); if (strstr(json_buf, "key1") == NULL || strstr(json_buf, "key2") == NULL || strstr(json_buf, "key3") == NULL) exit (58); if (strstr(json_buf, "value1") == NULL || strstr(json_buf, "value2") == NULL || strstr(json_buf, "value3") == NULL) exit (59); free(json_buf); free_image_spec_schema_image_layout_schema (image_layout); free_image_spec_schema_image_layout_schema (image_layout_gen); exit (0); } crun-1.16.1/libocispec/tests/test-spec/0000775000000000000000000000000014002226462016122 5ustar0000000000000000crun-1.16.1/libocispec/tests/test-spec/imageManifestItems/0000775000000000000000000000000013677106237021713 5ustar0000000000000000crun-1.16.1/libocispec/tests/test-spec/imageManifestItems/image-manifest-items-schema.json0000664000000000000000000000123013677106237030045 0ustar0000000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "manifest item set", "type": "array", "items": { "title": "manifest item", "type": "object", "description": "manifest item for image save and load", "properties": { "Config": { "description": "", "id": "", "type": "string" }, "Layers": { "type": "array", "minItems": 1, "items": { "type": "string" } }, "RepoTags": { "type": "array", "minItems": 1, "items": { "type": "string" } }, "Parent": { "description": "", "id": "", "type": "string" } }, "required": [ "Config", "Layers" ] } } crun-1.16.1/libocispec/tests/test-spec/basic/0000775000000000000000000000000014013506342017203 5ustar0000000000000000crun-1.16.1/libocispec/tests/test-spec/basic/test_top_double_array_refobj.json0000664000000000000000000000035314013506342026017 0ustar0000000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "top double array of ref object", "type": "array", "items": { "type": "array", "items": { "$ref": "test_double_array_item.json" } } } crun-1.16.1/libocispec/tests/test-spec/basic/test_double_array.json0000664000000000000000000000213214002226462023603 0ustar0000000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "manifest item set", "type": "object", "properties": { "strarrays": { "type": "array", "items": { "type": "array", "items": { "type": "string" } } }, "intarrays": { "type": "array", "items": { "type": "array", "items": { "type": "int32" } } }, "boolarrays": { "type": "array", "items": { "type": "array", "items": { "type": "boolean" } } }, "objectarrays": { "type": "array", "items": { "type": "array", "items": { "type": "object", "properties": { "first": { "type": "boolean" }, "second": { "type": "string" } } } } }, "refobjarrays": { "type": "array", "items": { "type": "array", "items": { "$ref": "test_double_array_item.json" } } } } } crun-1.16.1/libocispec/tests/test-spec/basic/test_double_array_item.json0000664000000000000000000000046314002226462024626 0ustar0000000000000000{ "description": "description array item object, use by double array", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "item1": { "type": "string" }, "item2": { "type": "int32" }, "item3": { "type": "boolean" } } } crun-1.16.1/libocispec/tests/test-spec/basic/test_top_array_int.json0000664000000000000000000000022314002226462024004 0ustar0000000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "top array of int", "type": "array", "items": { "type": "int32" } } crun-1.16.1/libocispec/tests/test-spec/basic/test_top_array_string.json0000664000000000000000000000022714002226462024524 0ustar0000000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "top array of string", "type": "array", "items": { "type": "string" } } crun-1.16.1/libocispec/tests/test-spec/basic/test_top_double_array_int.json0000664000000000000000000000031114002226462025334 0ustar0000000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "top double array of string", "type": "array", "items": { "type": "array", "items": { "type": "int32" } } } crun-1.16.1/libocispec/tests/test-spec/basic/test_top_double_array_obj.json0000664000000000000000000000065414002226462025326 0ustar0000000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "top double array of string", "type": "array", "items": { "type": "array", "items": { "type": "object", "properties": { "first": { "type": "boolean" }, "second": { "type": "int32" }, "third": { "type": "string" } } } } } crun-1.16.1/libocispec/tests/test-spec/basic/test_top_double_array_string.json0000664000000000000000000000031214002226462026051 0ustar0000000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "top double array of string", "type": "array", "items": { "type": "array", "items": { "type": "string" } } } crun-1.16.1/libocispec/Makefile.am0000644000000000000000000002325014654642634015125 0ustar0000000000000000DIST_SUBDIRS = yajl SUBDIRS = yajl AM_CFLAGS = $(WARN_CFLAGS) -I$(top_srcdir)/src -I$(top_builddir)/src if HAVE_EMBEDDED_YAJL AM_CFLAGS += -I$(top_srcdir)/yajl/src/headers endif HAVE_EMBEDDED_YAJL CLEANFILES = $(man_MANS) src/runtime_spec_stamp src/image_spec_stamp src/image_manifest_stamp src/basic-test_stamp GITIGNOREFILES = build-aux/ gtk-doc.make config.h.in aclocal.m4 if ENABLE_LIBOCISPEC_INSTALL lib_LTLIBRARIES = libocispec.la lib_LIBRARIES = libocispec.a else noinst_LTLIBRARIES = libocispec.la noinst_LIBRARIES = libocispec.a endif SOURCE_FILES = \ src/ocispec/image_spec_schema_config_schema.c \ src/ocispec/image_spec_schema_content_descriptor.c \ src/ocispec/image_spec_schema_defs.c \ src/ocispec/image_spec_schema_defs_descriptor.c \ src/ocispec/image_spec_schema_image_index_schema.c \ src/ocispec/image_spec_schema_image_layout_schema.c \ src/ocispec/image_spec_schema_image_manifest_schema.c \ src/ocispec/runtime_spec_schema_config_linux.c \ src/ocispec/runtime_spec_schema_config_zos.c \ src/ocispec/runtime_spec_schema_config_schema.c \ src/ocispec/runtime_spec_schema_config_solaris.c \ src/ocispec/runtime_spec_schema_config_vm.c \ src/ocispec/runtime_spec_schema_config_windows.c \ src/ocispec/runtime_spec_schema_defs.c \ src/ocispec/runtime_spec_schema_defs_linux.c \ src/ocispec/runtime_spec_schema_defs_zos.c \ src/ocispec/runtime_spec_schema_defs_vm.c \ src/ocispec/runtime_spec_schema_defs_windows.c \ src/ocispec/runtime_spec_schema_state_schema.c \ src/ocispec/runtime_spec_schema_features_linux.c \ src/ocispec/runtime_spec_schema_features_schema.c \ src/ocispec/image_manifest_items_image_manifest_items_schema.c \ src/ocispec/basic_test_double_array_item.c \ src/ocispec/basic_test_double_array.c \ src/ocispec/basic_test_top_array_int.c \ src/ocispec/basic_test_top_array_string.c \ src/ocispec/basic_test_top_double_array_int.c \ src/ocispec/basic_test_top_double_array_obj.c \ src/ocispec/basic_test_top_double_array_refobj.c \ src/ocispec/basic_test_top_double_array_string.c HEADER_FILES = $(SOURCE_FILES:.c=.h) if ENABLE_LIBOCISPEC_INSTALL ocispec_includedir = $(includedir)/ocispec ocispec_include_HEADERS = $(HEADER_FILES) \ src/ocispec/json_common.h \ src/ocispec/read-file.h endif src/runtime_spec_stamp: src/ocispec/json_common.h src/ocispec/json_common.c $(PYTHON) $(srcdir)/src/ocispec/generate.py --gen-ref --root=${srcdir} --out=${builddir}/src/ocispec ${srcdir}/runtime-spec/schema @touch $@ src/image_spec_stamp: src/ocispec/json_common.h src/ocispec/json_common.c $(PYTHON) $(srcdir)/src/ocispec/generate.py --gen-ref --root=${srcdir} --out=${builddir}/src/ocispec ${srcdir}/image-spec/schema @touch $@ src/image_manifest_stamp: src/ocispec/json_common.h src/ocispec/json_common.c $(PYTHON) $(srcdir)/src/ocispec/generate.py --gen-ref --root=${srcdir}/tests/test-spec --out=${builddir}/src/ocispec ${srcdir}/tests/test-spec/imageManifestItems @touch $@ src/basic-test_stamp: src/ocispec/json_common.h src/ocispec/json_common.c $(PYTHON) $(srcdir)/src/ocispec/generate.py --gen-ref --root=${srcdir}/tests/test-spec --out=${builddir}/src/ocispec ${srcdir}/tests/test-spec/basic @touch $@ src/ocispec/image_spec_schema_config_schema.c \ src/ocispec/image_spec_schema_content_descriptor.c \ src/ocispec/image_spec_schema_defs.c \ src/ocispec/image_spec_schema_defs_descriptor.c \ src/ocispec/image_spec_schema_image_index_schema.c \ src/ocispec/image_spec_schema_image_layout_schema.c \ src/ocispec/image_spec_schema_image_manifest_schema.c \ src/ocispec/image_spec_schema_config_schema.h \ src/ocispec/image_spec_schema_content_descriptor.h \ src/ocispec/image_spec_schema_defs.h \ src/ocispec/image_spec_schema_defs_descriptor.h \ src/ocispec/image_spec_schema_image_index_schema.h \ src/ocispec/image_spec_schema_image_layout_schema.h \ src/ocispec/image_spec_schema_image_manifest_schema.h: src/image_spec_stamp src/ocispec/runtime_spec_schema_config_linux.h \ src/ocispec/runtime_spec_schema_config_schema.h \ src/ocispec/runtime_spec_schema_config_solaris.h \ src/ocispec/runtime_spec_schema_config_vm.h \ src/ocispec/runtime_spec_schema_config_windows.h \ src/ocispec/runtime_spec_schema_defs.h \ src/ocispec/runtime_spec_schema_defs_linux.h \ src/ocispec/runtime_spec_schema_defs_zos.h \ src/ocispec/runtime_spec_schema_features_linux.h \ src/ocispec/runtime_spec_schema_features_schema.h \ src/ocispec/runtime_spec_schema_features_linux.c \ src/ocispec/runtime_spec_schema_features_schema.c \ src/ocispec/runtime_spec_schema_defs_vm.h \ src/ocispec/runtime_spec_schema_defs_windows.h \ src/ocispec/runtime_spec_schema_state_schema.h \ src/ocispec/runtime_spec_schema_config_linux.c \ src/ocispec/runtime_spec_schema_config_zos.c \ src/ocispec/runtime_spec_schema_config_schema.c \ src/ocispec/runtime_spec_schema_config_solaris.c \ src/ocispec/runtime_spec_schema_config_vm.c \ src/ocispec/runtime_spec_schema_config_windows.c \ src/ocispec/runtime_spec_schema_defs.c \ src/ocispec/runtime_spec_schema_defs_linux.c \ src/ocispec/runtime_spec_schema_defs_vm.c \ src/ocispec/runtime_spec_schema_defs_zos.c \ src/ocispec/runtime_spec_schema_defs_windows.c \ src/ocispec/runtime_spec_schema_state_schema.c: src/runtime_spec_stamp src/ocispec/image_manifest_items_image_manifest_items_schema.h \ src/ocispec/image_manifest_items_image_manifest_items_schema.c: src/image_manifest_stamp src/ocispec/basic_test_double_array_item.h \ src/ocispec/basic_test_double_array.h \ src/ocispec/basic_test_top_array_int.h \ src/ocispec/basic_test_top_array_string.h \ src/ocispec/basic_test_top_double_array_int.h \ src/ocispec/basic_test_top_double_array_obj.h \ src/ocispec/basic_test_top_double_array_refobj.h \ src/ocispec/basic_test_top_double_array_string.h \ src/ocispec/basic_test_double_array_item.c \ src/ocispec/basic_test_double_array.c \ src/ocispec/basic_test_top_array_int.c \ src/ocispec/basic_test_top_array_string.c \ src/ocispec/basic_test_top_double_array_int.c \ src/ocispec/basic_test_top_double_array_obj.c \ src/ocispec/basic_test_top_double_array_refobj.c \ src/ocispec/basic_test_top_double_array_string.c: src/basic-test_stamp $(HEADER_FILES): %.h: %.c src/ocispec/generate.py BUILT_SOURCES = $(HEADER_FILES) $(SOURCE_FILES) libocispec_la_SOURCES = $(BUILT_SOURCES) \ src/ocispec/read-file.c \ src/ocispec/json_common.c TMP_H_FILES = $(HEADER_FILES:.h=.h.tmp) TMP_C_FILES = $(SOURCE_FILES:.c=.c.tmp) CLEANFILES += $(HEADER_FILES) $(SOURCE_FILES) $(TMP_H_FILES) $(TMP_C_FILES) TESTS_LDADD = libocispec.la $(SELINUX_LIBS) if HAVE_EMBEDDED_YAJL TESTS_LDADD += yajl/libyajl.la else TESTS_LDADD += $(YAJL_LIBS) endif libocispec_a_SOURCES = libocispec.a: libocispec.la $(BUILT_SOURCES) src/runtime_spec_stamp src/image_spec_stamp src/image_manifest_stamp src/basic-test_stamp $(LIBTOOL) --mode=link $(GCC) libocispec.la -o libocispec.a if ENABLE_LIBOCISPEC_INSTALL pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = ocispec.pc endif tests_test_1_SOURCES = tests/test-1.c tests_test_1_LDADD = $(TESTS_LDADD) tests_test_2_SOURCES = tests/test-2.c tests_test_2_LDADD = $(TESTS_LDADD) tests_test_3_SOURCES = tests/test-3.c tests_test_3_LDADD = $(TESTS_LDADD) tests_test_4_SOURCES = tests/test-4.c tests_test_4_LDADD = $(TESTS_LDADD) tests_test_5_SOURCES = tests/test-5.c tests_test_5_LDADD = $(TESTS_LDADD) tests_test_6_SOURCES = tests/test-6.c tests_test_6_LDADD = $(TESTS_LDADD) tests_test_7_SOURCES = tests/test-7.c tests_test_7_LDADD = $(TESTS_LDADD) tests_test_8_SOURCES = tests/test-8.c tests_test_8_LDADD = $(TESTS_LDADD) tests_test_9_SOURCES = tests/test-9.c tests_test_9_LDADD = $(TESTS_LDADD) tests_test_10_SOURCES = tests/test-10.c tests_test_10_LDADD = $(TESTS_LDADD) tests_test_11_SOURCES = tests/test-11.c tests_test_11_LDADD = $(TESTS_LDADD) src_ocispec_validate_SOURCES = src/ocispec/validate.c src_ocispec_validate_LDADD = $(TESTS_LDADD) TESTS = tests/test-1 \ tests/test-2 \ tests/test-3 \ tests/test-4 \ tests/test-5 \ tests/test-6 \ tests/test-7 \ tests/test-8 \ tests/test-9 \ tests/test-10 \ tests/test-11 noinst_PROGRAMS = src/ocispec/validate $(TESTS) $(abs_top_builddir)/tests/data: $(abs_top_srcdir)/tests/data if test $(abs_top_srcdir) != $(abs_top_builddir) && test ! -d $@; then rm -f $@; ln -s $< $@; fi distcheck check: $(abs_top_builddir)/tests/data -include $(top_srcdir)/git.mk EXTRA_DIST = autogen.sh \ tests/data/image_index_config.json \ tests/data/image_layout_config.json \ tests/data/image_config_mapstringobject.json \ tests/data/config.json \ tests/data/image_manifest.json \ tests/data/image_config.json \ tests/data/config.nocwd.json \ tests/data/image_manifest_item.json \ tests/data/residual_image_layout_config.json \ tests/data/null_value_config.json \ tests/data/doublearray.json \ tests/data/top_array_int.json \ tests/data/top_array_string.json \ tests/data/top_double_array_int.json \ tests/data/top_double_array_obj.json \ tests/data/top_double_array_refobj.json \ tests/data/top_double_array_string.json \ tests/test-spec \ src/ocispec/generate.py \ src/ocispec/headers.py \ src/ocispec/helpers.py \ src/ocispec/sources.py \ $(HEADER_FILES) \ src/ocispec/read-file.h \ runtime-spec \ image-spec \ src/ocispec/json_common.h \ src/ocispec/json_common.c \ src/yajl sync: (cd image-spec; git pull https://github.com/opencontainers/image-spec) (cd runtime-spec; git pull https://github.com/opencontainers/runtime-spec) (cd yajl; git pull https://github.com/containers/yajl main) generate: src/runtime_spec_stamp src/image_spec_stamp src/image_manifest_stamp src/basic-test_stamp #Needed by phony: generate-rust install-node-deps: (npm install @apidevtools/json-schema-ref-parser) (npm install quicktype-core) generate-rust: (node rust-gen.js) crun-1.16.1/libocispec/configure0000755000000000000000000165266114656670150015013 0ustar0000000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for libocispec 0.3. # # 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 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: giuseppe@scrivano.org about your system, including any $0: error possibly output before this message. Then install $0: a modern shell, or manually run the script under such a $0: shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libocispec' PACKAGE_TARNAME='libocispec' PACKAGE_VERSION='0.3' PACKAGE_STRING='libocispec 0.3' PACKAGE_BUGREPORT='giuseppe@scrivano.org' PACKAGE_URL='' # 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" enable_option_checking=no ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS pkgpyexecdir pyexecdir pkgpythondir pythondir PYTHON_PLATFORM PYTHON_EXEC_PREFIX PYTHON_PREFIX PYTHON_VERSION PYTHON OCI_IMAGE_MANIFEST_ITEMS_EXTENSIONS OCI_IMAGE_MANIFEST_EXTENSIONS OCI_IMAGE_LAYOUT_EXTENSIONS OCI_IMAGE_INDEX_EXTENSIONS OCI_IMAGE_EXTENSIONS OCI_RUNTIME_EXTENSIONS ENABLE_LIBOCISPEC_INSTALL_FALSE ENABLE_LIBOCISPEC_INSTALL_TRUE YAJL_LIBS YAJL_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG HAVE_EMBEDDED_YAJL_FALSE HAVE_EMBEDDED_YAJL_TRUE subdirs MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR am__untar am__tar AMTAR am__leading_dot SET_MAKE mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL AWK RANLIB STRIP ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock enable_dependency_tracking enable_silent_rules enable_maintainer_mode enable_embedded_yajl enable_libocispec_install ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP LT_SYS_LIBRARY_PATH PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR YAJL_CFLAGS YAJL_LIBS OCI_RUNTIME_EXTENSIONS OCI_IMAGE_EXTENSIONS OCI_IMAGE_INDEX_EXTENSIONS OCI_IMAGE_LAYOUT_EXTENSIONS OCI_IMAGE_MANIFEST_EXTENSIONS OCI_IMAGE_MANIFEST_ITEMS_EXTENSIONS PYTHON' ac_subdirs_all='yajl' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures libocispec 0.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/libocispec] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of libocispec 0.3:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-shared[=PKGS] build shared libraries [default=no] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --disable-maintainer-mode disable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-embedded-yajl Statically link a modified yajl version --enable-libocispec-install Enable libocispec installation Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor LT_SYS_LIBRARY_PATH User-defined run-time library search path. 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 YAJL_CFLAGS C compiler flags for YAJL, overriding pkg-config YAJL_LIBS linker flags for YAJL, overriding pkg-config OCI_RUNTIME_EXTENSIONS extensions for the OCI runtime parser OCI_IMAGE_EXTENSIONS extensions for the OCI image parser OCI_IMAGE_INDEX_EXTENSIONS extensions for the OCI image index parser OCI_IMAGE_LAYOUT_EXTENSIONS extensions for the OCI image layout parser OCI_IMAGE_MANIFEST_EXTENSIONS extensions for the OCI image manifest parser OCI_IMAGE_MANIFEST_ITEMS_EXTENSIONS extensions for the OCI image manifest items parser PYTHON the Python interpreter 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 libocispec configure 0.3 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 giuseppe@scrivano.org ## ## ------------------------------------ ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func 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 libocispec $as_me 0.3, 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 ac_config_headers="$ac_config_headers config.h" ac_aux_dir= for ac_dir in build-aux "$srcdir"/build-aux; 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 build-aux \"$srcdir\"/build-aux" "$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. # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac 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 # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=no fi enable_dlopen=no enable_win32_dll=no # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } { $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 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # 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 # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='libocispec' VERSION='0.3' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar plaintar pax cpio none' # The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether UID '$am_uid' is supported by ustar format" >&5 $as_echo_n "checking whether UID '$am_uid' is supported by ustar format... " >&6; } if test $am_uid -le $am_max_uid; 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; } _am_tools=none fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GID '$am_gid' is supported by ustar format" >&5 $as_echo_n "checking whether GID '$am_gid' is supported by ustar format... " >&6; } if test $am_gid -le $am_max_gid; 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; } _am_tools=none fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5 $as_echo_n "checking how to create a ustar tar archive... " >&6; } # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_ustar-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do { echo "$as_me:$LINENO: $_am_tar --version" >&5 ($_am_tar --version) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && break done am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"' am__tar_="$_am_tar --format=ustar -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 ustar -w "$$tardir"' am__tar_='pax -L -x ustar -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H ustar -L' am__tar_='find "$tardir" -print | cpio -o -H ustar -L' am__untar='cpio -i -H ustar -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_ustar}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5 (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -rf conftest.dir if test -s conftest.tar; then { echo "$as_me:$LINENO: $am__untar &5 ($am__untar &5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: cat conftest.dir/file" >&5 (cat conftest.dir/file) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } grep GrepMe conftest.dir/file >/dev/null 2>&1 && break fi done rm -rf conftest.dir if ${am_cv_prog_tar_ustar+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_prog_tar_ustar=$_am_tool fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5 $as_echo "$am_cv_prog_tar_ustar" >&6; } depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' subdirs="$subdirs yajl" # Check whether --enable-embedded-yajl was given. if test "${enable_embedded_yajl+set}" = set; then : enableval=$enable_embedded_yajl; case "${enableval}" in yes) embedded_yajl=true ;; no) embedded_yajl=false ;; *) as_fn_error $? "bad value ${enableval} for --enable-embedded-yajl" "$LINENO" 5 ;; esac else embedded_yajl=false fi if test x"$embedded_yajl" = xtrue; then HAVE_EMBEDDED_YAJL_TRUE= HAVE_EMBEDDED_YAJL_FALSE='#' else HAVE_EMBEDDED_YAJL_TRUE='#' HAVE_EMBEDDED_YAJL_FALSE= fi 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 if test -z "$HAVE_EMBEDDED_YAJL_TRUE"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yajl_tree_get" >&5 $as_echo_n "checking for library containing yajl_tree_get... " >&6; } if ${ac_cv_search_yajl_tree_get+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char yajl_tree_get (); int main () { return yajl_tree_get (); ; return 0; } _ACEOF for ac_lib in '' yajl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_yajl_tree_get=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_yajl_tree_get+:} false; then : break fi done if ${ac_cv_search_yajl_tree_get+:} false; then : else ac_cv_search_yajl_tree_get=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_yajl_tree_get" >&5 $as_echo "$ac_cv_search_yajl_tree_get" >&6; } ac_res=$ac_cv_search_yajl_tree_get if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_YAJL 1" >>confdefs.h else as_fn_error $? "*** libyajl headers not found" "$LINENO" 5 fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for YAJL" >&5 $as_echo_n "checking for YAJL... " >&6; } if test -n "$YAJL_CFLAGS"; then pkg_cv_YAJL_CFLAGS="$YAJL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yajl >= 2.0.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "yajl >= 2.0.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_YAJL_CFLAGS=`$PKG_CONFIG --cflags "yajl >= 2.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$YAJL_LIBS"; then pkg_cv_YAJL_LIBS="$YAJL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yajl >= 2.0.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "yajl >= 2.0.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_YAJL_LIBS=`$PKG_CONFIG --libs "yajl >= 2.0.0" 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 YAJL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "yajl >= 2.0.0" 2>&1` else YAJL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "yajl >= 2.0.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$YAJL_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (yajl >= 2.0.0) were not met: $YAJL_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables YAJL_CFLAGS and YAJL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "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. Alternatively, you may set the environment variables YAJL_CFLAGS and YAJL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else YAJL_CFLAGS=$pkg_cv_YAJL_CFLAGS YAJL_LIBS=$pkg_cv_YAJL_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi # Optionally install the library. # Check whether --enable-libocispec-install was given. if test "${enable_libocispec_install+set}" = set; then : enableval=$enable_libocispec_install; case "${enableval}" in yes) libocispec_install=true ;; no) libocispec_install=false ;; *) as_fn_error $? "bad value ${enableval} for --enable-libocispec-install" "$LINENO" 5 ;; esac else libocispec_install=false fi if test x"$libocispec_install" = xtrue; then ENABLE_LIBOCISPEC_INSTALL_TRUE= ENABLE_LIBOCISPEC_INSTALL_FALSE='#' else ENABLE_LIBOCISPEC_INSTALL_TRUE='#' ENABLE_LIBOCISPEC_INSTALL_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed 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 ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version is >= 3" >&5 $as_echo_n "checking whether $PYTHON version is >= 3... " >&6; } prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '3'.split('.'))) + [0, 0, 0] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] sys.exit(sys.hexversion < minverhex)" if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 ($PYTHON -c "$prog") >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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_fn_error $? "Python interpreter is too old" "$LINENO" 5 fi am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 3" >&5 $as_echo_n "checking for a Python interpreter with version >= 3... " >&6; } if ${am_cv_pathless_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else for am_cv_pathless_PYTHON in python python2 python3 python3.15 python3.14 python3.13 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do test "$am_cv_pathless_PYTHON" = none && break prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '3'.split('.'))) + [0, 0, 0] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] sys.exit(sys.hexversion < minverhex)" if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5 ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then : break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 $as_echo "$am_cv_pathless_PYTHON" >&6; } # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. set dummy $am_cv_pathless_PYTHON; 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_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # 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_PYTHON="$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 PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi am_display_PYTHON=$am_cv_pathless_PYTHON fi if test "$PYTHON" = :; then as_fn_error $? "no suitable Python interpreter found" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 $as_echo_n "checking for $am_display_PYTHON version... " >&6; } if ${am_cv_python_version+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_python_version=`$PYTHON -c "import sys; print('%u.%u' % sys.version_info[:2])"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 $as_echo "$am_cv_python_version" >&6; } PYTHON_VERSION=$am_cv_python_version PYTHON_PREFIX='${prefix}' PYTHON_EXEC_PREFIX='${exec_prefix}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 $as_echo_n "checking for $am_display_PYTHON platform... " >&6; } if ${am_cv_python_platform+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 $as_echo "$am_cv_python_platform" >&6; } PYTHON_PLATFORM=$am_cv_python_platform # Just factor out some code duplication. am_python_setup_sysconfig="\ import sys # Prefer sysconfig over distutils.sysconfig, for better compatibility # with python 3.x. See automake bug#10227. try: import sysconfig except ImportError: can_use_sysconfig = 0 else: can_use_sysconfig = 1 # Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: # try: from platform import python_implementation if python_implementation() == 'CPython' and sys.version[:3] == '2.7': can_use_sysconfig = 0 except ImportError: pass" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 $as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } if ${am_cv_python_pythondir+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$prefix" = xNONE then am_py_prefix=$ac_default_prefix else am_py_prefix=$prefix fi am_cv_python_pythondir=`$PYTHON -c " $am_python_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') sys.stdout.write(sitedir)"` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` ;; *) case $am_py_prefix in /usr|/System*) ;; *) am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 $as_echo "$am_cv_python_pythondir" >&6; } pythondir=$am_cv_python_pythondir pkgpythondir=\${pythondir}/$PACKAGE { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 $as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } if ${am_cv_python_pyexecdir+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$exec_prefix" = xNONE then am_py_exec_prefix=$am_py_prefix else am_py_exec_prefix=$exec_prefix fi am_cv_python_pyexecdir=`$PYTHON -c " $am_python_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') sys.stdout.write(sitedir)"` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` ;; *) case $am_py_exec_prefix in /usr|/System*) ;; *) am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 $as_echo "$am_cv_python_pyexecdir" >&6; } pyexecdir=$am_cv_python_pyexecdir pkgpyexecdir=\${pyexecdir}/$PACKAGE fi ac_config_files="$ac_config_files Makefile ocispec.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -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 -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_EMBEDDED_YAJL_TRUE}" && test -z "${HAVE_EMBEDDED_YAJL_FALSE}"; then as_fn_error $? "conditional \"HAVE_EMBEDDED_YAJL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_LIBOCISPEC_INSTALL_TRUE}" && test -z "${ENABLE_LIBOCISPEC_INSTALL_FALSE}"; then as_fn_error $? "conditional \"ENABLE_LIBOCISPEC_INSTALL\" 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 libocispec $as_me 0.3, 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="\\ libocispec config.status 0.3 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 # # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" _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" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "ocispec.pc") CONFIG_FILES="$CONFIG_FILES ocispec.pc" ;; *) 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 "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; 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 # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file, --srcdir, and --disable-option-checking arguments # so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" shift for ac_arg do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ | --c=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; --disable-option-checking) ;; *) case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" # Pass --silent if test "$silent" = yes; then ac_sub_configure_args="--silent $ac_sub_configure_args" fi # Always prepend --disable-option-checking to silence warnings, since # different subdirs can have different --enable and --with options. ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 $as_echo "$ac_msg" >&6 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 cd "$ac_dir" # Check for guested configure; otherwise get Cygnus style configure. if test -f "$ac_srcdir/configure.gnu"; then ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then ac_sub_configure=$ac_srcdir/configure elif test -f "$ac_srcdir/configure.in"; then # This should be Cygnus configure. ac_sub_configure=$ac_aux_dir/configure else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative name. ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 fi cd "$ac_popdir" done 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 crun-1.16.1/libocispec/configure.ac0000644000000000000000000000405314654642634015357 0ustar0000000000000000AC_PREREQ([2.63]) AC_INIT([libocispec], [0.3], [giuseppe@scrivano.org]) AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) AC_USE_SYSTEM_EXTENSIONS LT_INIT([disable-shared]) AM_INIT_AUTOMAKE([1.11 -Wno-portability foreign tar-ustar no-dist-gzip dist-xz subdir-objects]) AM_MAINTAINER_MODE([enable]) AM_SILENT_RULES([yes]) AM_EXTRA_RECURSIVE_TARGETS([yajl]) AC_CONFIG_SUBDIRS([yajl]) AC_ARG_ENABLE(embedded-yajl, AS_HELP_STRING([--enable-embedded-yajl], [Statically link a modified yajl version]), [ case "${enableval}" in yes) embedded_yajl=true ;; no) embedded_yajl=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-embedded-yajl) ;; esac],[embedded_yajl=false]) AM_CONDITIONAL([HAVE_EMBEDDED_YAJL], [test x"$embedded_yajl" = xtrue]) AM_COND_IF([HAVE_EMBEDDED_YAJL], [], [ AC_SEARCH_LIBS(yajl_tree_get, [yajl], [AC_DEFINE([HAVE_YAJL], 1, [Define if libyajl is available])], [AC_MSG_ERROR([*** libyajl headers not found])]) PKG_CHECK_MODULES([YAJL], [yajl >= 2.0.0]) ]) # Optionally install the library. AC_ARG_ENABLE(libocispec-install, AS_HELP_STRING([--enable-libocispec-install], [Enable libocispec installation]), [ case "${enableval}" in yes) libocispec_install=true ;; no) libocispec_install=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-libocispec-install) ;; esac],[libocispec_install=false]) AM_CONDITIONAL([ENABLE_LIBOCISPEC_INSTALL], [test x"$libocispec_install" = xtrue]) AC_ARG_VAR(OCI_RUNTIME_EXTENSIONS, [extensions for the OCI runtime parser]) AC_ARG_VAR(OCI_IMAGE_EXTENSIONS, [extensions for the OCI image parser]) AC_ARG_VAR(OCI_IMAGE_INDEX_EXTENSIONS, [extensions for the OCI image index parser]) AC_ARG_VAR(OCI_IMAGE_LAYOUT_EXTENSIONS, [extensions for the OCI image layout parser]) AC_ARG_VAR(OCI_IMAGE_MANIFEST_EXTENSIONS, [extensions for the OCI image manifest parser]) AC_ARG_VAR(OCI_IMAGE_MANIFEST_ITEMS_EXTENSIONS, [extensions for the OCI image manifest items parser]) AC_PROG_SED AC_PROG_CC AM_PROG_CC_C_O AM_PATH_PYTHON([3]) AC_CONFIG_FILES([ Makefile ocispec.pc ]) AC_OUTPUT crun-1.16.1/libocispec/aclocal.m40000644000000000000000000020363114656670147014736 0ustar0000000000000000# generated automatically by aclocal 1.16.2 -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 11 (pkg-config-0.29.1) dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a dnl configuration script generated by Autoconf, you may include it under dnl the same distribution terms that you use for the rest of that dnl program. dnl PKG_PREREQ(MIN-VERSION) dnl ----------------------- dnl Since: 0.29 dnl dnl Verify that the version of the pkg-config macros are at least dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's dnl installed version of pkg-config, this checks the developer's version dnl of pkg.m4 when generating configure. dnl dnl To ensure that this macro is defined, also add: dnl m4_ifndef([PKG_PREREQ], dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], [m4_define([PKG_MACROS_VERSION], [0.29.1]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) dnl ---------------------------------- dnl Since: 0.16 dnl dnl Search for the pkg-config tool and set the PKG_CONFIG variable to dnl first found in the path. Checks that the version of pkg-config found dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is dnl used since that's the first version where most current features of dnl pkg-config existed. 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 ])dnl PKG_PROG_PKG_CONFIG dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------------------------------- dnl Since: 0.18 dnl dnl Check to see whether a particular set of modules exists. Similar to dnl PKG_CHECK_MODULES(), but does not set variables or print errors. dnl dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) dnl only at the first occurence in configure.ac, so if the first place dnl it's called might be skipped (such as if it is within an "if", you dnl 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]) dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) dnl --------------------------------------------- dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting dnl pkg_failed based on the result. 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 ])dnl _PKG_CONFIG dnl _PKG_SHORT_ERRORS_SUPPORTED dnl --------------------------- dnl Internal check to see if pkg-config supports short errors. 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 ])dnl _PKG_SHORT_ERRORS_SUPPORTED dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl -------------------------------------------------------------- dnl Since: 0.4.0 dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES might not happen, you should be sure to include an dnl 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 ])dnl PKG_CHECK_MODULES dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl --------------------------------------------------------------------- dnl Since: 0.29 dnl dnl Checks for existence of MODULES and gathers its build flags with dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags dnl and VARIABLE-PREFIX_LIBS from --libs. dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to dnl include an explicit call to PKG_PROG_PKG_CONFIG in your dnl configure.ac. AC_DEFUN([PKG_CHECK_MODULES_STATIC], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl _save_PKG_CONFIG=$PKG_CONFIG PKG_CONFIG="$PKG_CONFIG --static" PKG_CHECK_MODULES($@) PKG_CONFIG=$_save_PKG_CONFIG[]dnl ])dnl PKG_CHECK_MODULES_STATIC dnl PKG_INSTALLDIR([DIRECTORY]) dnl ------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable pkgconfigdir as the location where a module dnl should install pkg-config .pc files. By default the directory is dnl $libdir/pkgconfig, but the default can be changed by passing dnl DIRECTORY. The user can override through the --with-pkgconfigdir dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_INSTALLDIR dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) dnl -------------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable noarch_pkgconfigdir as the location where a dnl module should install arch-independent pkg-config .pc files. By dnl default the directory is $datadir/pkgconfig, but the default can be dnl changed by passing DIRECTORY. The user can override through the dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_NOARCH_INSTALLDIR dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------- dnl Since: 0.28 dnl dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], dnl [DESCRIPTION], [DEFAULT]) dnl ------------------------------------------ dnl dnl Prepare a "--with-" configure option using the lowercase dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and dnl PKG_CHECK_MODULES in a single macro. AC_DEFUN([PKG_WITH_MODULES], [ m4_pushdef([with_arg], m4_tolower([$1])) m4_pushdef([description], [m4_default([$5], [build with ]with_arg[ support])]) m4_pushdef([def_arg], [m4_default([$6], [auto])]) m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) m4_case(def_arg, [yes],[m4_pushdef([with_without], [--without-]with_arg)], [m4_pushdef([with_without],[--with-]with_arg)]) AC_ARG_WITH(with_arg, AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, [AS_TR_SH([with_]with_arg)=def_arg]) AS_CASE([$AS_TR_SH([with_]with_arg)], [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], [auto],[PKG_CHECK_MODULES([$1],[$2], [m4_n([def_action_if_found]) $3], [m4_n([def_action_if_not_found]) $4])]) m4_popdef([with_arg]) m4_popdef([description]) m4_popdef([def_arg]) ])dnl PKG_WITH_MODULES dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [DESCRIPTION], [DEFAULT]) dnl ----------------------------------------------- dnl dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES dnl check._[VARIABLE-PREFIX] is exported as make variable. AC_DEFUN([PKG_HAVE_WITH_MODULES], [ PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) AM_CONDITIONAL([HAVE_][$1], [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) ])dnl PKG_HAVE_WITH_MODULES dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [DESCRIPTION], [DEFAULT]) dnl ------------------------------------------------------ dnl dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make dnl and preprocessor variable. AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], [ PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) ])dnl PKG_HAVE_DEFINE_WITH_MODULES # Copyright (C) 2002-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' 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.16.2], [], [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.16.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_COND_IF -*- Autoconf -*- # Copyright (C) 2008-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_COND_IF # _AM_COND_ELSE # _AM_COND_ENDIF # -------------- # These macros are only used for tracing. m4_define([_AM_COND_IF]) m4_define([_AM_COND_ELSE]) m4_define([_AM_COND_ENDIF]) # AM_COND_IF(COND, [IF-TRUE], [IF-FALSE]) # --------------------------------------- # If the shell condition COND is true, execute IF-TRUE, otherwise execute # IF-FALSE. Allow automake to learn about conditional instantiating macros # (the AC_CONFIG_FOOS). AC_DEFUN([AM_COND_IF], [m4_ifndef([_AM_COND_VALUE_$1], [m4_fatal([$0: no such condition "$1"])])dnl _AM_COND_IF([$1])dnl if test -z "$$1_TRUE"; then : m4_n([$2])[]dnl m4_ifval([$3], [_AM_COND_ELSE([$1])dnl else $3 ])dnl _AM_COND_ENDIF([$1])dnl fi[]dnl ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _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. # This creates each '.Po' and '.Plo' makefile fragment that we'll 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" MAKE="${MAKE-make}"])]) # AM_EXTRA_RECURSIVE_TARGETS -*- Autoconf -*- # Copyright (C) 2012-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_EXTRA_RECURSIVE_TARGETS # -------------------------- # Define the list of user recursive targets. This macro exists only to # be traced by Automake, which will ensure that a proper definition of # user-defined recursive targets (and associated rules) is propagated # into all the generated Makefiles. # TODO: We should really reject non-literal arguments here... AC_DEFUN([AM_EXTRA_RECURSIVE_TARGETS], []) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # --------------------------------------------------------------------------- # Adds support for distributing Python modules and packages. To # install modules, copy them to $(pythondir), using the python_PYTHON # automake variable. To install a package with the same name as the # automake package, install to $(pkgpythondir), or use the # pkgpython_PYTHON automake variable. # # The variables $(pyexecdir) and $(pkgpyexecdir) are provided as # locations to install python extension modules (shared libraries). # Another macro is required to find the appropriate flags to compile # extension modules. # # If your package is configured with a different prefix to python, # users will have to add the install directory to the PYTHONPATH # environment variable, or create a .pth file (see the python # documentation for details). # # If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will # cause an error if the version of python installed on the system # doesn't meet the requirement. MINIMUM-VERSION should consist of # numbers and dots only. AC_DEFUN([AM_PATH_PYTHON], [ dnl Find a Python interpreter. Python versions prior to 2.0 are not dnl supported. (2.0 was released on October 16, 2000). m4_define_default([_AM_PYTHON_INTERPRETER_LIST], [python python2 python3 dnl python3.15 python3.14 python3.13 python3.12 python3.11 python3.10 dnl python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl python3.2 python3.1 python3.0 dnl python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl python2.0]) AC_ARG_VAR([PYTHON], [the Python interpreter]) m4_if([$1],[],[ dnl No version check is needed. # Find any Python interpreter. if test -z "$PYTHON"; then AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) fi am_display_PYTHON=python ], [ dnl A version check is needed. if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. AC_MSG_CHECKING([whether $PYTHON version is >= $1]) AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) AC_MSG_ERROR([Python interpreter is too old])]) am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. AC_CACHE_CHECK([for a Python interpreter with version >= $1], [am_cv_pathless_PYTHON],[ for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do test "$am_cv_pathless_PYTHON" = none && break AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) done]) # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) fi am_display_PYTHON=$am_cv_pathless_PYTHON fi ]) if test "$PYTHON" = :; then dnl Run any user-specified action, or abort. m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) else dnl Query Python for its version number. Although site.py simply uses dnl sys.version[:3], printing that failed with Python 3.10, since the dnl trailing zero was eliminated. So now we output just the major dnl and minor version numbers, as numbers. Apparently the tertiary dnl version is not of interest. AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], [am_cv_python_version=`$PYTHON -c "import sys; print('%u.%u' % sys.version_info[[:2]])"`]) AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) dnl Use the values of $prefix and $exec_prefix for the corresponding dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made dnl distinct variables so they can be overridden if need be. However, dnl general consensus is that you shouldn't need this ability. AC_SUBST([PYTHON_PREFIX], ['${prefix}']) AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) dnl At times (like when building shared libraries) you may want dnl to know which OS platform Python thinks this is. AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) # Just factor out some code duplication. am_python_setup_sysconfig="\ import sys # Prefer sysconfig over distutils.sysconfig, for better compatibility # with python 3.x. See automake bug#10227. try: import sysconfig except ImportError: can_use_sysconfig = 0 else: can_use_sysconfig = 1 # Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: # try: from platform import python_implementation if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': can_use_sysconfig = 0 except ImportError: pass" dnl Set up 4 directories: dnl pythondir -- where to install python scripts. This is the dnl site-packages directory, not the python standard library dnl directory like in previous automake betas. This behavior dnl is more consistent with lispdir.m4 for example. dnl Query distutils for this directory. AC_CACHE_CHECK([for $am_display_PYTHON script directory], [am_cv_python_pythondir], [if test "x$prefix" = xNONE then am_py_prefix=$ac_default_prefix else am_py_prefix=$prefix fi am_cv_python_pythondir=`$PYTHON -c " $am_python_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') sys.stdout.write(sitedir)"` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` ;; *) case $am_py_prefix in /usr|/System*) ;; *) am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac ]) AC_SUBST([pythondir], [$am_cv_python_pythondir]) dnl pkgpythondir -- $PACKAGE directory under pythondir. Was dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is dnl more consistent with the rest of automake. AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) dnl pyexecdir -- directory for installing python extension modules dnl (shared libraries) dnl Query distutils for this directory. AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], [am_cv_python_pyexecdir], [if test "x$exec_prefix" = xNONE then am_py_exec_prefix=$am_py_prefix else am_py_exec_prefix=$exec_prefix fi am_cv_python_pyexecdir=`$PYTHON -c " $am_python_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') sys.stdout.write(sitedir)"` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` ;; *) case $am_py_exec_prefix in /usr|/System*) ;; *) am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac ]) AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) dnl Run any user-specified action. $2 fi ]) # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) # --------------------------------------------------------------------------- # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. # Run ACTION-IF-FALSE otherwise. # This test uses sys.hexversion instead of the string equivalent (first # word of sys.version), in order to cope with versions such as 2.2c1. # This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). AC_DEFUN([AM_PYTHON_CHECK_VERSION], [prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] sys.exit(sys.hexversion < minverhex)" AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) crun-1.16.1/libocispec/Makefile.in0000644000000000000000000026223014656670151015136 0ustar0000000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @HAVE_EMBEDDED_YAJL_TRUE@am__append_1 = -I$(top_srcdir)/yajl/src/headers @HAVE_EMBEDDED_YAJL_TRUE@am__append_2 = yajl/libyajl.la @HAVE_EMBEDDED_YAJL_FALSE@am__append_3 = $(YAJL_LIBS) TESTS = tests/test-1$(EXEEXT) tests/test-2$(EXEEXT) \ tests/test-3$(EXEEXT) tests/test-4$(EXEEXT) \ tests/test-5$(EXEEXT) tests/test-6$(EXEEXT) \ tests/test-7$(EXEEXT) tests/test-8$(EXEEXT) \ tests/test-9$(EXEEXT) tests/test-10$(EXEEXT) \ tests/test-11$(EXEEXT) noinst_PROGRAMS = src/ocispec/validate$(EXEEXT) $(am__EXEEXT_1) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__ocispec_include_HEADERS_DIST) \ $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = ocispec.pc CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = tests/test-1$(EXEEXT) tests/test-2$(EXEEXT) \ tests/test-3$(EXEEXT) tests/test-4$(EXEEXT) \ tests/test-5$(EXEEXT) tests/test-6$(EXEEXT) \ tests/test-7$(EXEEXT) tests/test-8$(EXEEXT) \ tests/test-9$(EXEEXT) tests/test-10$(EXEEXT) \ tests/test-11$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libdir)" \ "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(ocispec_includedir)" LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libocispec_a_AR = $(AR) $(ARFLAGS) libocispec_a_LIBADD = am_libocispec_a_OBJECTS = libocispec_a_OBJECTS = $(am_libocispec_a_OBJECTS) libocispec_la_LIBADD = am__objects_1 = am__objects_2 = $(am__objects_1) am__dirstamp = $(am__leading_dot)dirstamp am__objects_3 = src/ocispec/image_spec_schema_config_schema.lo \ src/ocispec/image_spec_schema_content_descriptor.lo \ src/ocispec/image_spec_schema_defs.lo \ src/ocispec/image_spec_schema_defs_descriptor.lo \ src/ocispec/image_spec_schema_image_index_schema.lo \ src/ocispec/image_spec_schema_image_layout_schema.lo \ src/ocispec/image_spec_schema_image_manifest_schema.lo \ src/ocispec/runtime_spec_schema_config_linux.lo \ src/ocispec/runtime_spec_schema_config_zos.lo \ src/ocispec/runtime_spec_schema_config_schema.lo \ src/ocispec/runtime_spec_schema_config_solaris.lo \ src/ocispec/runtime_spec_schema_config_vm.lo \ src/ocispec/runtime_spec_schema_config_windows.lo \ src/ocispec/runtime_spec_schema_defs.lo \ src/ocispec/runtime_spec_schema_defs_linux.lo \ src/ocispec/runtime_spec_schema_defs_zos.lo \ src/ocispec/runtime_spec_schema_defs_vm.lo \ src/ocispec/runtime_spec_schema_defs_windows.lo \ src/ocispec/runtime_spec_schema_state_schema.lo \ src/ocispec/runtime_spec_schema_features_linux.lo \ src/ocispec/runtime_spec_schema_features_schema.lo \ src/ocispec/image_manifest_items_image_manifest_items_schema.lo \ src/ocispec/basic_test_double_array_item.lo \ src/ocispec/basic_test_double_array.lo \ src/ocispec/basic_test_top_array_int.lo \ src/ocispec/basic_test_top_array_string.lo \ src/ocispec/basic_test_top_double_array_int.lo \ src/ocispec/basic_test_top_double_array_obj.lo \ src/ocispec/basic_test_top_double_array_refobj.lo \ src/ocispec/basic_test_top_double_array_string.lo am__objects_4 = $(am__objects_2) $(am__objects_3) am_libocispec_la_OBJECTS = $(am__objects_4) src/ocispec/read-file.lo \ src/ocispec/json_common.lo libocispec_la_OBJECTS = $(am_libocispec_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = @ENABLE_LIBOCISPEC_INSTALL_FALSE@am_libocispec_la_rpath = @ENABLE_LIBOCISPEC_INSTALL_TRUE@am_libocispec_la_rpath = -rpath \ @ENABLE_LIBOCISPEC_INSTALL_TRUE@ $(libdir) am_src_ocispec_validate_OBJECTS = src/ocispec/validate.$(OBJEXT) src_ocispec_validate_OBJECTS = $(am_src_ocispec_validate_OBJECTS) am__DEPENDENCIES_1 = @HAVE_EMBEDDED_YAJL_FALSE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) am__DEPENDENCIES_3 = libocispec.la $(am__append_2) \ $(am__DEPENDENCIES_2) src_ocispec_validate_DEPENDENCIES = $(am__DEPENDENCIES_3) am_tests_test_1_OBJECTS = tests/test-1.$(OBJEXT) tests_test_1_OBJECTS = $(am_tests_test_1_OBJECTS) tests_test_1_DEPENDENCIES = $(am__DEPENDENCIES_3) am_tests_test_10_OBJECTS = tests/test-10.$(OBJEXT) tests_test_10_OBJECTS = $(am_tests_test_10_OBJECTS) tests_test_10_DEPENDENCIES = $(am__DEPENDENCIES_3) am_tests_test_11_OBJECTS = tests/test-11.$(OBJEXT) tests_test_11_OBJECTS = $(am_tests_test_11_OBJECTS) tests_test_11_DEPENDENCIES = $(am__DEPENDENCIES_3) am_tests_test_2_OBJECTS = tests/test-2.$(OBJEXT) tests_test_2_OBJECTS = $(am_tests_test_2_OBJECTS) tests_test_2_DEPENDENCIES = $(am__DEPENDENCIES_3) am_tests_test_3_OBJECTS = tests/test-3.$(OBJEXT) tests_test_3_OBJECTS = $(am_tests_test_3_OBJECTS) tests_test_3_DEPENDENCIES = $(am__DEPENDENCIES_3) am_tests_test_4_OBJECTS = tests/test-4.$(OBJEXT) tests_test_4_OBJECTS = $(am_tests_test_4_OBJECTS) tests_test_4_DEPENDENCIES = $(am__DEPENDENCIES_3) am_tests_test_5_OBJECTS = tests/test-5.$(OBJEXT) tests_test_5_OBJECTS = $(am_tests_test_5_OBJECTS) tests_test_5_DEPENDENCIES = $(am__DEPENDENCIES_3) am_tests_test_6_OBJECTS = tests/test-6.$(OBJEXT) tests_test_6_OBJECTS = $(am_tests_test_6_OBJECTS) tests_test_6_DEPENDENCIES = $(am__DEPENDENCIES_3) am_tests_test_7_OBJECTS = tests/test-7.$(OBJEXT) tests_test_7_OBJECTS = $(am_tests_test_7_OBJECTS) tests_test_7_DEPENDENCIES = $(am__DEPENDENCIES_3) am_tests_test_8_OBJECTS = tests/test-8.$(OBJEXT) tests_test_8_OBJECTS = $(am_tests_test_8_OBJECTS) tests_test_8_DEPENDENCIES = $(am__DEPENDENCIES_3) am_tests_test_9_OBJECTS = tests/test-9.$(OBJEXT) tests_test_9_OBJECTS = $(am_tests_test_9_OBJECTS) tests_test_9_DEPENDENCIES = $(am__DEPENDENCIES_3) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = \ src/ocispec/$(DEPDIR)/basic_test_double_array.Plo \ src/ocispec/$(DEPDIR)/basic_test_double_array_item.Plo \ src/ocispec/$(DEPDIR)/basic_test_top_array_int.Plo \ src/ocispec/$(DEPDIR)/basic_test_top_array_string.Plo \ src/ocispec/$(DEPDIR)/basic_test_top_double_array_int.Plo \ src/ocispec/$(DEPDIR)/basic_test_top_double_array_obj.Plo \ src/ocispec/$(DEPDIR)/basic_test_top_double_array_refobj.Plo \ src/ocispec/$(DEPDIR)/basic_test_top_double_array_string.Plo \ src/ocispec/$(DEPDIR)/image_manifest_items_image_manifest_items_schema.Plo \ src/ocispec/$(DEPDIR)/image_spec_schema_config_schema.Plo \ src/ocispec/$(DEPDIR)/image_spec_schema_content_descriptor.Plo \ src/ocispec/$(DEPDIR)/image_spec_schema_defs.Plo \ src/ocispec/$(DEPDIR)/image_spec_schema_defs_descriptor.Plo \ src/ocispec/$(DEPDIR)/image_spec_schema_image_index_schema.Plo \ src/ocispec/$(DEPDIR)/image_spec_schema_image_layout_schema.Plo \ src/ocispec/$(DEPDIR)/image_spec_schema_image_manifest_schema.Plo \ src/ocispec/$(DEPDIR)/json_common.Plo \ src/ocispec/$(DEPDIR)/read-file.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_config_linux.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_config_schema.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_config_solaris.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_config_vm.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_config_windows.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_config_zos.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_defs.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_linux.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_vm.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_windows.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_zos.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_features_linux.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_features_schema.Plo \ src/ocispec/$(DEPDIR)/runtime_spec_schema_state_schema.Plo \ src/ocispec/$(DEPDIR)/validate.Po tests/$(DEPDIR)/test-1.Po \ tests/$(DEPDIR)/test-10.Po tests/$(DEPDIR)/test-11.Po \ tests/$(DEPDIR)/test-2.Po tests/$(DEPDIR)/test-3.Po \ tests/$(DEPDIR)/test-4.Po tests/$(DEPDIR)/test-5.Po \ tests/$(DEPDIR)/test-6.Po tests/$(DEPDIR)/test-7.Po \ tests/$(DEPDIR)/test-8.Po tests/$(DEPDIR)/test-9.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libocispec_a_SOURCES) $(libocispec_la_SOURCES) \ $(src_ocispec_validate_SOURCES) $(tests_test_1_SOURCES) \ $(tests_test_10_SOURCES) $(tests_test_11_SOURCES) \ $(tests_test_2_SOURCES) $(tests_test_3_SOURCES) \ $(tests_test_4_SOURCES) $(tests_test_5_SOURCES) \ $(tests_test_6_SOURCES) $(tests_test_7_SOURCES) \ $(tests_test_8_SOURCES) $(tests_test_9_SOURCES) DIST_SOURCES = $(libocispec_a_SOURCES) $(libocispec_la_SOURCES) \ $(src_ocispec_validate_SOURCES) $(tests_test_1_SOURCES) \ $(tests_test_10_SOURCES) $(tests_test_11_SOURCES) \ $(tests_test_2_SOURCES) $(tests_test_3_SOURCES) \ $(tests_test_4_SOURCES) $(tests_test_5_SOURCES) \ $(tests_test_6_SOURCES) $(tests_test_7_SOURCES) \ $(tests_test_8_SOURCES) $(tests_test_9_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(pkgconfig_DATA) am__ocispec_include_HEADERS_DIST = \ src/ocispec/image_spec_schema_config_schema.h \ src/ocispec/image_spec_schema_content_descriptor.h \ src/ocispec/image_spec_schema_defs.h \ src/ocispec/image_spec_schema_defs_descriptor.h \ src/ocispec/image_spec_schema_image_index_schema.h \ src/ocispec/image_spec_schema_image_layout_schema.h \ src/ocispec/image_spec_schema_image_manifest_schema.h \ src/ocispec/runtime_spec_schema_config_linux.h \ src/ocispec/runtime_spec_schema_config_zos.h \ src/ocispec/runtime_spec_schema_config_schema.h \ src/ocispec/runtime_spec_schema_config_solaris.h \ src/ocispec/runtime_spec_schema_config_vm.h \ src/ocispec/runtime_spec_schema_config_windows.h \ src/ocispec/runtime_spec_schema_defs.h \ src/ocispec/runtime_spec_schema_defs_linux.h \ src/ocispec/runtime_spec_schema_defs_zos.h \ src/ocispec/runtime_spec_schema_defs_vm.h \ src/ocispec/runtime_spec_schema_defs_windows.h \ src/ocispec/runtime_spec_schema_state_schema.h \ src/ocispec/runtime_spec_schema_features_linux.h \ src/ocispec/runtime_spec_schema_features_schema.h \ src/ocispec/image_manifest_items_image_manifest_items_schema.h \ src/ocispec/basic_test_double_array_item.h \ src/ocispec/basic_test_double_array.h \ src/ocispec/basic_test_top_array_int.h \ src/ocispec/basic_test_top_array_string.h \ src/ocispec/basic_test_top_double_array_int.h \ src/ocispec/basic_test_top_double_array_obj.h \ src/ocispec/basic_test_top_double_array_refobj.h \ src/ocispec/basic_test_top_double_array_string.h \ src/ocispec/json_common.h src/ocispec/read-file.h HEADERS = $(ocispec_include_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope check recheck distdir distdir-am dist dist-all \ distcheck am__extra_recursive_targets = yajl-recursive am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # 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 # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # 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. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(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='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/ocispec.pc.in $(top_srcdir)/build-aux/compile \ $(top_srcdir)/build-aux/config.guess \ $(top_srcdir)/build-aux/config.sub \ $(top_srcdir)/build-aux/depcomp \ $(top_srcdir)/build-aux/install-sh \ $(top_srcdir)/build-aux/ltmain.sh \ $(top_srcdir)/build-aux/missing \ $(top_srcdir)/build-aux/test-driver COPYING build-aux/compile \ build-aux/config.guess build-aux/config.sub build-aux/depcomp \ build-aux/install-sh build-aux/ltmain.sh build-aux/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" GZIP_ENV = --best DIST_ARCHIVES = $(distdir).tar.xz DIST_TARGETS = dist-xz distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OCI_IMAGE_EXTENSIONS = @OCI_IMAGE_EXTENSIONS@ OCI_IMAGE_INDEX_EXTENSIONS = @OCI_IMAGE_INDEX_EXTENSIONS@ OCI_IMAGE_LAYOUT_EXTENSIONS = @OCI_IMAGE_LAYOUT_EXTENSIONS@ OCI_IMAGE_MANIFEST_EXTENSIONS = @OCI_IMAGE_MANIFEST_EXTENSIONS@ OCI_IMAGE_MANIFEST_ITEMS_EXTENSIONS = @OCI_IMAGE_MANIFEST_ITEMS_EXTENSIONS@ OCI_RUNTIME_EXTENSIONS = @OCI_RUNTIME_EXTENSIONS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YAJL_CFLAGS = @YAJL_CFLAGS@ YAJL_LIBS = @YAJL_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DIST_SUBDIRS = yajl SUBDIRS = yajl AM_CFLAGS = $(WARN_CFLAGS) -I$(top_srcdir)/src -I$(top_builddir)/src \ $(am__append_1) CLEANFILES = $(man_MANS) src/runtime_spec_stamp src/image_spec_stamp \ src/image_manifest_stamp src/basic-test_stamp $(HEADER_FILES) \ $(SOURCE_FILES) $(TMP_H_FILES) $(TMP_C_FILES) GITIGNOREFILES = build-aux/ gtk-doc.make config.h.in aclocal.m4 @ENABLE_LIBOCISPEC_INSTALL_TRUE@lib_LTLIBRARIES = libocispec.la @ENABLE_LIBOCISPEC_INSTALL_TRUE@lib_LIBRARIES = libocispec.a @ENABLE_LIBOCISPEC_INSTALL_FALSE@noinst_LTLIBRARIES = libocispec.la @ENABLE_LIBOCISPEC_INSTALL_FALSE@noinst_LIBRARIES = libocispec.a SOURCE_FILES = \ src/ocispec/image_spec_schema_config_schema.c \ src/ocispec/image_spec_schema_content_descriptor.c \ src/ocispec/image_spec_schema_defs.c \ src/ocispec/image_spec_schema_defs_descriptor.c \ src/ocispec/image_spec_schema_image_index_schema.c \ src/ocispec/image_spec_schema_image_layout_schema.c \ src/ocispec/image_spec_schema_image_manifest_schema.c \ src/ocispec/runtime_spec_schema_config_linux.c \ src/ocispec/runtime_spec_schema_config_zos.c \ src/ocispec/runtime_spec_schema_config_schema.c \ src/ocispec/runtime_spec_schema_config_solaris.c \ src/ocispec/runtime_spec_schema_config_vm.c \ src/ocispec/runtime_spec_schema_config_windows.c \ src/ocispec/runtime_spec_schema_defs.c \ src/ocispec/runtime_spec_schema_defs_linux.c \ src/ocispec/runtime_spec_schema_defs_zos.c \ src/ocispec/runtime_spec_schema_defs_vm.c \ src/ocispec/runtime_spec_schema_defs_windows.c \ src/ocispec/runtime_spec_schema_state_schema.c \ src/ocispec/runtime_spec_schema_features_linux.c \ src/ocispec/runtime_spec_schema_features_schema.c \ src/ocispec/image_manifest_items_image_manifest_items_schema.c \ src/ocispec/basic_test_double_array_item.c \ src/ocispec/basic_test_double_array.c \ src/ocispec/basic_test_top_array_int.c \ src/ocispec/basic_test_top_array_string.c \ src/ocispec/basic_test_top_double_array_int.c \ src/ocispec/basic_test_top_double_array_obj.c \ src/ocispec/basic_test_top_double_array_refobj.c \ src/ocispec/basic_test_top_double_array_string.c HEADER_FILES = $(SOURCE_FILES:.c=.h) @ENABLE_LIBOCISPEC_INSTALL_TRUE@ocispec_includedir = $(includedir)/ocispec @ENABLE_LIBOCISPEC_INSTALL_TRUE@ocispec_include_HEADERS = $(HEADER_FILES) \ @ENABLE_LIBOCISPEC_INSTALL_TRUE@ src/ocispec/json_common.h \ @ENABLE_LIBOCISPEC_INSTALL_TRUE@ src/ocispec/read-file.h BUILT_SOURCES = $(HEADER_FILES) $(SOURCE_FILES) libocispec_la_SOURCES = $(BUILT_SOURCES) \ src/ocispec/read-file.c \ src/ocispec/json_common.c TMP_H_FILES = $(HEADER_FILES:.h=.h.tmp) TMP_C_FILES = $(SOURCE_FILES:.c=.c.tmp) TESTS_LDADD = libocispec.la $(SELINUX_LIBS) $(am__append_2) \ $(am__append_3) libocispec_a_SOURCES = @ENABLE_LIBOCISPEC_INSTALL_TRUE@pkgconfigdir = $(libdir)/pkgconfig @ENABLE_LIBOCISPEC_INSTALL_TRUE@pkgconfig_DATA = ocispec.pc tests_test_1_SOURCES = tests/test-1.c tests_test_1_LDADD = $(TESTS_LDADD) tests_test_2_SOURCES = tests/test-2.c tests_test_2_LDADD = $(TESTS_LDADD) tests_test_3_SOURCES = tests/test-3.c tests_test_3_LDADD = $(TESTS_LDADD) tests_test_4_SOURCES = tests/test-4.c tests_test_4_LDADD = $(TESTS_LDADD) tests_test_5_SOURCES = tests/test-5.c tests_test_5_LDADD = $(TESTS_LDADD) tests_test_6_SOURCES = tests/test-6.c tests_test_6_LDADD = $(TESTS_LDADD) tests_test_7_SOURCES = tests/test-7.c tests_test_7_LDADD = $(TESTS_LDADD) tests_test_8_SOURCES = tests/test-8.c tests_test_8_LDADD = $(TESTS_LDADD) tests_test_9_SOURCES = tests/test-9.c tests_test_9_LDADD = $(TESTS_LDADD) tests_test_10_SOURCES = tests/test-10.c tests_test_10_LDADD = $(TESTS_LDADD) tests_test_11_SOURCES = tests/test-11.c tests_test_11_LDADD = $(TESTS_LDADD) src_ocispec_validate_SOURCES = src/ocispec/validate.c src_ocispec_validate_LDADD = $(TESTS_LDADD) EXTRA_DIST = autogen.sh \ tests/data/image_index_config.json \ tests/data/image_layout_config.json \ tests/data/image_config_mapstringobject.json \ tests/data/config.json \ tests/data/image_manifest.json \ tests/data/image_config.json \ tests/data/config.nocwd.json \ tests/data/image_manifest_item.json \ tests/data/residual_image_layout_config.json \ tests/data/null_value_config.json \ tests/data/doublearray.json \ tests/data/top_array_int.json \ tests/data/top_array_string.json \ tests/data/top_double_array_int.json \ tests/data/top_double_array_obj.json \ tests/data/top_double_array_refobj.json \ tests/data/top_double_array_string.json \ tests/test-spec \ src/ocispec/generate.py \ src/ocispec/headers.py \ src/ocispec/helpers.py \ src/ocispec/sources.py \ $(HEADER_FILES) \ src/ocispec/read-file.h \ runtime-spec \ image-spec \ src/ocispec/json_common.h \ src/ocispec/json_common.c \ src/yajl all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 ocispec.pc: $(top_builddir)/config.status $(srcdir)/ocispec.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; } @$(POST_INSTALL) @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ if test -f $$p; then \ $(am__strip_dir) \ echo " ( cd '$(DESTDIR)$(libdir)' && $(RANLIB) $$f )"; \ ( cd "$(DESTDIR)$(libdir)" && $(RANLIB) $$f ) || exit $$?; \ else :; fi; \ done uninstall-libLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(libdir)'; $(am__uninstall_files_from_dir) clean-libLIBRARIES: -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } src/ocispec/$(am__dirstamp): @$(MKDIR_P) src/ocispec @: > src/ocispec/$(am__dirstamp) src/ocispec/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/ocispec/$(DEPDIR) @: > src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/image_spec_schema_config_schema.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/image_spec_schema_content_descriptor.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/image_spec_schema_defs.lo: src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/image_spec_schema_defs_descriptor.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/image_spec_schema_image_index_schema.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/image_spec_schema_image_layout_schema.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/image_spec_schema_image_manifest_schema.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_config_linux.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_config_zos.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_config_schema.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_config_solaris.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_config_vm.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_config_windows.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_defs.lo: src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_defs_linux.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_defs_zos.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_defs_vm.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_defs_windows.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_state_schema.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_features_linux.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/runtime_spec_schema_features_schema.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/image_manifest_items_image_manifest_items_schema.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/basic_test_double_array_item.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/basic_test_double_array.lo: src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/basic_test_top_array_int.lo: src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/basic_test_top_array_string.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/basic_test_top_double_array_int.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/basic_test_top_double_array_obj.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/basic_test_top_double_array_refobj.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/basic_test_top_double_array_string.lo: \ src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/read-file.lo: src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/json_common.lo: src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) libocispec.la: $(libocispec_la_OBJECTS) $(libocispec_la_DEPENDENCIES) $(EXTRA_libocispec_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(am_libocispec_la_rpath) $(libocispec_la_OBJECTS) $(libocispec_la_LIBADD) $(LIBS) src/ocispec/validate.$(OBJEXT): src/ocispec/$(am__dirstamp) \ src/ocispec/$(DEPDIR)/$(am__dirstamp) src/ocispec/validate$(EXEEXT): $(src_ocispec_validate_OBJECTS) $(src_ocispec_validate_DEPENDENCIES) $(EXTRA_src_ocispec_validate_DEPENDENCIES) src/ocispec/$(am__dirstamp) @rm -f src/ocispec/validate$(EXEEXT) $(AM_V_CCLD)$(LINK) $(src_ocispec_validate_OBJECTS) $(src_ocispec_validate_LDADD) $(LIBS) tests/$(am__dirstamp): @$(MKDIR_P) tests @: > tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) tests/$(DEPDIR) @: > tests/$(DEPDIR)/$(am__dirstamp) tests/test-1.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/test-1$(EXEEXT): $(tests_test_1_OBJECTS) $(tests_test_1_DEPENDENCIES) $(EXTRA_tests_test_1_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/test-1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tests_test_1_OBJECTS) $(tests_test_1_LDADD) $(LIBS) tests/test-10.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/test-10$(EXEEXT): $(tests_test_10_OBJECTS) $(tests_test_10_DEPENDENCIES) $(EXTRA_tests_test_10_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/test-10$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tests_test_10_OBJECTS) $(tests_test_10_LDADD) $(LIBS) tests/test-11.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/test-11$(EXEEXT): $(tests_test_11_OBJECTS) $(tests_test_11_DEPENDENCIES) $(EXTRA_tests_test_11_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/test-11$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tests_test_11_OBJECTS) $(tests_test_11_LDADD) $(LIBS) tests/test-2.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/test-2$(EXEEXT): $(tests_test_2_OBJECTS) $(tests_test_2_DEPENDENCIES) $(EXTRA_tests_test_2_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/test-2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tests_test_2_OBJECTS) $(tests_test_2_LDADD) $(LIBS) tests/test-3.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/test-3$(EXEEXT): $(tests_test_3_OBJECTS) $(tests_test_3_DEPENDENCIES) $(EXTRA_tests_test_3_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/test-3$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tests_test_3_OBJECTS) $(tests_test_3_LDADD) $(LIBS) tests/test-4.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/test-4$(EXEEXT): $(tests_test_4_OBJECTS) $(tests_test_4_DEPENDENCIES) $(EXTRA_tests_test_4_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/test-4$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tests_test_4_OBJECTS) $(tests_test_4_LDADD) $(LIBS) tests/test-5.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/test-5$(EXEEXT): $(tests_test_5_OBJECTS) $(tests_test_5_DEPENDENCIES) $(EXTRA_tests_test_5_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/test-5$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tests_test_5_OBJECTS) $(tests_test_5_LDADD) $(LIBS) tests/test-6.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/test-6$(EXEEXT): $(tests_test_6_OBJECTS) $(tests_test_6_DEPENDENCIES) $(EXTRA_tests_test_6_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/test-6$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tests_test_6_OBJECTS) $(tests_test_6_LDADD) $(LIBS) tests/test-7.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/test-7$(EXEEXT): $(tests_test_7_OBJECTS) $(tests_test_7_DEPENDENCIES) $(EXTRA_tests_test_7_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/test-7$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tests_test_7_OBJECTS) $(tests_test_7_LDADD) $(LIBS) tests/test-8.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/test-8$(EXEEXT): $(tests_test_8_OBJECTS) $(tests_test_8_DEPENDENCIES) $(EXTRA_tests_test_8_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/test-8$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tests_test_8_OBJECTS) $(tests_test_8_LDADD) $(LIBS) tests/test-9.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/test-9$(EXEEXT): $(tests_test_9_OBJECTS) $(tests_test_9_DEPENDENCIES) $(EXTRA_tests_test_9_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/test-9$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tests_test_9_OBJECTS) $(tests_test_9_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f src/ocispec/*.$(OBJEXT) -rm -f src/ocispec/*.lo -rm -f tests/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/basic_test_double_array.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/basic_test_double_array_item.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/basic_test_top_array_int.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/basic_test_top_array_string.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/basic_test_top_double_array_int.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/basic_test_top_double_array_obj.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/basic_test_top_double_array_refobj.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/basic_test_top_double_array_string.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/image_manifest_items_image_manifest_items_schema.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/image_spec_schema_config_schema.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/image_spec_schema_content_descriptor.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/image_spec_schema_defs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/image_spec_schema_defs_descriptor.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/image_spec_schema_image_index_schema.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/image_spec_schema_image_layout_schema.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/image_spec_schema_image_manifest_schema.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/json_common.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/read-file.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_config_linux.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_config_schema.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_config_solaris.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_config_vm.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_config_windows.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_config_zos.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_defs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_linux.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_vm.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_windows.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_zos.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_features_linux.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_features_schema.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/runtime_spec_schema_state_schema.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/ocispec/$(DEPDIR)/validate.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-10.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-11.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-3.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-4.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-5.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-6.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-7.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-8.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test-9.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf src/ocispec/.libs src/ocispec/_libs -rm -rf tests/.libs tests/_libs distclean-libtool: -rm -f libtool config.lt install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) install-ocispec_includeHEADERS: $(ocispec_include_HEADERS) @$(NORMAL_INSTALL) @list='$(ocispec_include_HEADERS)'; test -n "$(ocispec_includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(ocispec_includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(ocispec_includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(ocispec_includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(ocispec_includedir)" || exit $$?; \ done uninstall-ocispec_includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(ocispec_include_HEADERS)'; test -n "$(ocispec_includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(ocispec_includedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" yajl-local: ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? tests/test-1.log: tests/test-1$(EXEEXT) @p='tests/test-1$(EXEEXT)'; \ b='tests/test-1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/test-2.log: tests/test-2$(EXEEXT) @p='tests/test-2$(EXEEXT)'; \ b='tests/test-2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/test-3.log: tests/test-3$(EXEEXT) @p='tests/test-3$(EXEEXT)'; \ b='tests/test-3'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/test-4.log: tests/test-4$(EXEEXT) @p='tests/test-4$(EXEEXT)'; \ b='tests/test-4'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/test-5.log: tests/test-5$(EXEEXT) @p='tests/test-5$(EXEEXT)'; \ b='tests/test-5'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/test-6.log: tests/test-6$(EXEEXT) @p='tests/test-6$(EXEEXT)'; \ b='tests/test-6'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/test-7.log: tests/test-7$(EXEEXT) @p='tests/test-7$(EXEEXT)'; \ b='tests/test-7'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/test-8.log: tests/test-8$(EXEEXT) @p='tests/test-8$(EXEEXT)'; \ b='tests/test-8'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/test-9.log: tests/test-9$(EXEEXT) @p='tests/test-9$(EXEEXT)'; \ b='tests/test-9'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/test-10.log: tests/test-10$(EXEEXT) @p='tests/test-10$(EXEEXT)'; \ b='tests/test-10'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/test-11.log: tests/test-11$(EXEEXT) @p='tests/test-11$(EXEEXT)'; \ b='tests/test-11'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(PROGRAMS) $(LIBRARIES) $(LTLIBRARIES) $(DATA) \ $(HEADERS) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(ocispec_includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) 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: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -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) -rm -f src/ocispec/$(DEPDIR)/$(am__dirstamp) -rm -f src/ocispec/$(am__dirstamp) -rm -f tests/$(DEPDIR)/$(am__dirstamp) -rm -f tests/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive clean-am: clean-generic clean-libLIBRARIES clean-libLTLIBRARIES \ clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f src/ocispec/$(DEPDIR)/basic_test_double_array.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_double_array_item.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_array_int.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_array_string.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_double_array_int.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_double_array_obj.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_double_array_refobj.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_double_array_string.Plo -rm -f src/ocispec/$(DEPDIR)/image_manifest_items_image_manifest_items_schema.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_config_schema.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_content_descriptor.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_defs.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_defs_descriptor.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_image_index_schema.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_image_layout_schema.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_image_manifest_schema.Plo -rm -f src/ocispec/$(DEPDIR)/json_common.Plo -rm -f src/ocispec/$(DEPDIR)/read-file.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_linux.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_schema.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_solaris.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_vm.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_windows.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_zos.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_defs.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_linux.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_vm.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_windows.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_zos.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_features_linux.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_features_schema.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_state_schema.Plo -rm -f src/ocispec/$(DEPDIR)/validate.Po -rm -f tests/$(DEPDIR)/test-1.Po -rm -f tests/$(DEPDIR)/test-10.Po -rm -f tests/$(DEPDIR)/test-11.Po -rm -f tests/$(DEPDIR)/test-2.Po -rm -f tests/$(DEPDIR)/test-3.Po -rm -f tests/$(DEPDIR)/test-4.Po -rm -f tests/$(DEPDIR)/test-5.Po -rm -f tests/$(DEPDIR)/test-6.Po -rm -f tests/$(DEPDIR)/test-7.Po -rm -f tests/$(DEPDIR)/test-8.Po -rm -f tests/$(DEPDIR)/test-9.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-ocispec_includeHEADERS install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLIBRARIES install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f src/ocispec/$(DEPDIR)/basic_test_double_array.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_double_array_item.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_array_int.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_array_string.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_double_array_int.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_double_array_obj.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_double_array_refobj.Plo -rm -f src/ocispec/$(DEPDIR)/basic_test_top_double_array_string.Plo -rm -f src/ocispec/$(DEPDIR)/image_manifest_items_image_manifest_items_schema.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_config_schema.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_content_descriptor.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_defs.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_defs_descriptor.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_image_index_schema.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_image_layout_schema.Plo -rm -f src/ocispec/$(DEPDIR)/image_spec_schema_image_manifest_schema.Plo -rm -f src/ocispec/$(DEPDIR)/json_common.Plo -rm -f src/ocispec/$(DEPDIR)/read-file.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_linux.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_schema.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_solaris.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_vm.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_windows.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_config_zos.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_defs.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_linux.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_vm.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_windows.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_defs_zos.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_features_linux.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_features_schema.Plo -rm -f src/ocispec/$(DEPDIR)/runtime_spec_schema_state_schema.Plo -rm -f src/ocispec/$(DEPDIR)/validate.Po -rm -f tests/$(DEPDIR)/test-1.Po -rm -f tests/$(DEPDIR)/test-10.Po -rm -f tests/$(DEPDIR)/test-11.Po -rm -f tests/$(DEPDIR)/test-2.Po -rm -f tests/$(DEPDIR)/test-3.Po -rm -f tests/$(DEPDIR)/test-4.Po -rm -f tests/$(DEPDIR)/test-5.Po -rm -f tests/$(DEPDIR)/test-6.Po -rm -f tests/$(DEPDIR)/test-7.Po -rm -f tests/$(DEPDIR)/test-8.Po -rm -f tests/$(DEPDIR)/test-9.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-libLIBRARIES uninstall-libLTLIBRARIES \ uninstall-ocispec_includeHEADERS uninstall-pkgconfigDATA yajl: yajl-recursive yajl-am: yajl-local .MAKE: $(am__recursive_targets) all check check-am install install-am \ install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles am--refresh check check-TESTS check-am clean \ clean-cscope clean-generic clean-libLIBRARIES \ clean-libLTLIBRARIES clean-libtool clean-noinstLIBRARIES \ clean-noinstLTLIBRARIES clean-noinstPROGRAMS cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ dist-zstd distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-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-libLIBRARIES \ install-libLTLIBRARIES install-man \ install-ocispec_includeHEADERS install-pdf install-pdf-am \ install-pkgconfigDATA install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am recheck tags tags-am uninstall \ uninstall-am uninstall-libLIBRARIES uninstall-libLTLIBRARIES \ uninstall-ocispec_includeHEADERS uninstall-pkgconfigDATA \ yajl-am yajl-local .PRECIOUS: Makefile src/runtime_spec_stamp: src/ocispec/json_common.h src/ocispec/json_common.c $(PYTHON) $(srcdir)/src/ocispec/generate.py --gen-ref --root=${srcdir} --out=${builddir}/src/ocispec ${srcdir}/runtime-spec/schema @touch $@ src/image_spec_stamp: src/ocispec/json_common.h src/ocispec/json_common.c $(PYTHON) $(srcdir)/src/ocispec/generate.py --gen-ref --root=${srcdir} --out=${builddir}/src/ocispec ${srcdir}/image-spec/schema @touch $@ src/image_manifest_stamp: src/ocispec/json_common.h src/ocispec/json_common.c $(PYTHON) $(srcdir)/src/ocispec/generate.py --gen-ref --root=${srcdir}/tests/test-spec --out=${builddir}/src/ocispec ${srcdir}/tests/test-spec/imageManifestItems @touch $@ src/basic-test_stamp: src/ocispec/json_common.h src/ocispec/json_common.c $(PYTHON) $(srcdir)/src/ocispec/generate.py --gen-ref --root=${srcdir}/tests/test-spec --out=${builddir}/src/ocispec ${srcdir}/tests/test-spec/basic @touch $@ src/ocispec/image_spec_schema_config_schema.c \ src/ocispec/image_spec_schema_content_descriptor.c \ src/ocispec/image_spec_schema_defs.c \ src/ocispec/image_spec_schema_defs_descriptor.c \ src/ocispec/image_spec_schema_image_index_schema.c \ src/ocispec/image_spec_schema_image_layout_schema.c \ src/ocispec/image_spec_schema_image_manifest_schema.c \ src/ocispec/image_spec_schema_config_schema.h \ src/ocispec/image_spec_schema_content_descriptor.h \ src/ocispec/image_spec_schema_defs.h \ src/ocispec/image_spec_schema_defs_descriptor.h \ src/ocispec/image_spec_schema_image_index_schema.h \ src/ocispec/image_spec_schema_image_layout_schema.h \ src/ocispec/image_spec_schema_image_manifest_schema.h: src/image_spec_stamp src/ocispec/runtime_spec_schema_config_linux.h \ src/ocispec/runtime_spec_schema_config_schema.h \ src/ocispec/runtime_spec_schema_config_solaris.h \ src/ocispec/runtime_spec_schema_config_vm.h \ src/ocispec/runtime_spec_schema_config_windows.h \ src/ocispec/runtime_spec_schema_defs.h \ src/ocispec/runtime_spec_schema_defs_linux.h \ src/ocispec/runtime_spec_schema_defs_zos.h \ src/ocispec/runtime_spec_schema_features_linux.h \ src/ocispec/runtime_spec_schema_features_schema.h \ src/ocispec/runtime_spec_schema_features_linux.c \ src/ocispec/runtime_spec_schema_features_schema.c \ src/ocispec/runtime_spec_schema_defs_vm.h \ src/ocispec/runtime_spec_schema_defs_windows.h \ src/ocispec/runtime_spec_schema_state_schema.h \ src/ocispec/runtime_spec_schema_config_linux.c \ src/ocispec/runtime_spec_schema_config_zos.c \ src/ocispec/runtime_spec_schema_config_schema.c \ src/ocispec/runtime_spec_schema_config_solaris.c \ src/ocispec/runtime_spec_schema_config_vm.c \ src/ocispec/runtime_spec_schema_config_windows.c \ src/ocispec/runtime_spec_schema_defs.c \ src/ocispec/runtime_spec_schema_defs_linux.c \ src/ocispec/runtime_spec_schema_defs_vm.c \ src/ocispec/runtime_spec_schema_defs_zos.c \ src/ocispec/runtime_spec_schema_defs_windows.c \ src/ocispec/runtime_spec_schema_state_schema.c: src/runtime_spec_stamp src/ocispec/image_manifest_items_image_manifest_items_schema.h \ src/ocispec/image_manifest_items_image_manifest_items_schema.c: src/image_manifest_stamp src/ocispec/basic_test_double_array_item.h \ src/ocispec/basic_test_double_array.h \ src/ocispec/basic_test_top_array_int.h \ src/ocispec/basic_test_top_array_string.h \ src/ocispec/basic_test_top_double_array_int.h \ src/ocispec/basic_test_top_double_array_obj.h \ src/ocispec/basic_test_top_double_array_refobj.h \ src/ocispec/basic_test_top_double_array_string.h \ src/ocispec/basic_test_double_array_item.c \ src/ocispec/basic_test_double_array.c \ src/ocispec/basic_test_top_array_int.c \ src/ocispec/basic_test_top_array_string.c \ src/ocispec/basic_test_top_double_array_int.c \ src/ocispec/basic_test_top_double_array_obj.c \ src/ocispec/basic_test_top_double_array_refobj.c \ src/ocispec/basic_test_top_double_array_string.c: src/basic-test_stamp $(HEADER_FILES): %.h: %.c src/ocispec/generate.py libocispec.a: libocispec.la $(BUILT_SOURCES) src/runtime_spec_stamp src/image_spec_stamp src/image_manifest_stamp src/basic-test_stamp $(LIBTOOL) --mode=link $(GCC) libocispec.la -o libocispec.a $(abs_top_builddir)/tests/data: $(abs_top_srcdir)/tests/data if test $(abs_top_srcdir) != $(abs_top_builddir) && test ! -d $@; then rm -f $@; ln -s $< $@; fi distcheck check: $(abs_top_builddir)/tests/data -include $(top_srcdir)/git.mk sync: (cd image-spec; git pull https://github.com/opencontainers/image-spec) (cd runtime-spec; git pull https://github.com/opencontainers/runtime-spec) (cd yajl; git pull https://github.com/containers/yajl main) generate: src/runtime_spec_stamp src/image_spec_stamp src/image_manifest_stamp src/basic-test_stamp #Needed by phony: generate-rust install-node-deps: (npm install @apidevtools/json-schema-ref-parser) (npm install quicktype-core) generate-rust: (node rust-gen.js) # 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: crun-1.16.1/libocispec/config.h.in0000644000000000000000000000460714656670150015115 0ustar0000000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define if libyajl is available */ #undef HAVE_YAJL /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE crun-1.16.1/libocispec/ocispec.pc.in0000644000000000000000000000057314332154664015444 0ustar0000000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: @PACKAGE_NAME@ Description: A library for easily parsing [OCI runtime](https://github.com/opencontainers/runtime-spec) and [OCI image](https://github.com/opencontainers/image-spec) files. Requires: yajl Version: @PACKAGE_VERSION@ Libs: -L${libdir} -locispec Cflags: -I${includedir}/ocispec crun-1.16.1/libocispec/COPYING0000664000000000000000000010571014031115653014111 0ustar0000000000000000The following license covers the parser generator itself. As a special exception, you may create a larger work that contains part or all of the libocispec parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting libocispec output files to be licensed under the GNU General Public License without this special exception. GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . crun-1.16.1/libocispec/autogen.sh0000775000000000000000000000064614025721604015063 0ustar0000000000000000#!/bin/sh (cd yajl; ./autogen.sh) git submodule update --init --recursive test -n "$srcdir" || srcdir=`dirname "$0"` test -n "$srcdir" || srcdir=. olddir=`pwd` cd $srcdir if ! (autoreconf --version >/dev/null 2>&1); then echo "*** No autoreconf found, please install it ***" exit 1 fi mkdir -p m4 autoreconf --force --install --verbose cd $olddir test -n "$NOCONFIGURE" || "$srcdir/configure" "$@" crun-1.16.1/libocispec/runtime-spec/0000775000000000000000000000000014614670026015474 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/.github/0000775000000000000000000000000014160576556017045 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/.github/workflows/0000775000000000000000000000000014614670026021071 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/.github/workflows/build.yml0000644000000000000000000000156314614670026022716 0ustar0000000000000000name: build on: push: branches: - main jobs: run: runs-on: ubuntu-latest strategy: matrix: go: [1.21.x, 1.22.x] steps: - name: checkout source code uses: actions/checkout@v4 - name: setup go environment uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - name: create go.mod run: | # Fix for "cannot find main module" issue go mod init github.com/opencontainers/runtime-spec go get -d ./schema/... - name: run golangci-lint uses: golangci/golangci-lint-action@v4 with: version: v1.56.1 args: --verbose - name: run tests run: | set -x make install.tools make .govet make .gitvalidation make docs make -C schema test crun-1.16.1/libocispec/runtime-spec/.github/workflows/build-pr.yml0000644000000000000000000000160414614670026023331 0ustar0000000000000000name: build-pr on: pull_request: branches: - main jobs: run: runs-on: ubuntu-latest strategy: matrix: go: [1.21.x, 1.22.x] steps: - name: checkout source code uses: actions/checkout@v4 - name: setup go environment uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - name: create go.mod run: | # Fix for "cannot find main module" issue go mod init github.com/opencontainers/runtime-spec go get -d ./schema/... - name: run golangci-lint uses: golangci/golangci-lint-action@v4 with: version: v1.56.1 args: --verbose - name: run tests run: | set -x make install.tools make .govet make .gitvalidation make docs make -C schema test crun-1.16.1/libocispec/runtime-spec/.tool/0000775000000000000000000000000014416051456016527 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/.tool/version-doc.go0000644000000000000000000000066314416051456021311 0ustar0000000000000000//go:build ignore // +build ignore package main import ( "fmt" "html/template" "os" "github.com/opencontainers/runtime-spec/specs-go" ) var markdownTemplateString = ` **Specification Version:** *{{.}}* ` var markdownTemplate = template.Must(template.New("markdown").Parse(markdownTemplateString)) func main() { if err := markdownTemplate.Execute(os.Stdout, specs.Version); err != nil { fmt.Fprintln(os.Stderr, err) } } crun-1.16.1/libocispec/runtime-spec/MAINTAINERS0000644000000000000000000000111014460417222017154 0ustar0000000000000000Michael Crosby (@crosbymichael) Mrunal Patel (@mrunalp) Vincent Batts (@vbatts) Daniel, Dao Quang Minh (@dqminh) Tianon Gravi (@tianon) Qiang Huang (@hqhq) Aleksa Sarai (@cyphar) Giuseppe Scrivano (@giuseppe) Akihiro Suda (@AkihiroSuda) Kir Kolyshkin (@kolyshkin) Sebastiaan van Stijn (@thaJeztah) Toru Komatsu (@utam0k) crun-1.16.1/libocispec/runtime-spec/RELEASES.md0000644000000000000000000001366414460417222017225 0ustar0000000000000000# Releases The release process hopes to encourage early, consistent consensus-building during project development. The mechanisms used are regular community communication on the mailing list about progress, scheduled meetings for issue resolution and release triage, and regularly paced and communicated releases. Releases are proposed and adopted or rejected using the usual [project governance](GOVERNANCE.md) rules and procedures. An anti-pattern that we want to avoid is heavy development or discussions "late cycle" around major releases. We want to build a community that is involved and communicates consistently through all releases instead of relying on "silent periods" as a judge of stability. ## Parallel releases A single project MAY consider several motions to release in parallel. However each motion to release after the initial 0.1.0 MUST be based on a previous release that has already landed. For example, runtime-spec maintainers may propose a v1.0.0-rc2 on the 1st of the month and a v0.9.1 bugfix on the 2nd of the month. They may not propose a v1.0.0-rc3 until the v1.0.0-rc2 is accepted (on the 7th if the vote initiated on the 1st passes). ## Specifications The OCI maintains three categories of projects: specifications, applications, and conformance-testing tools. However, specification releases have special restrictions in the [OCI charter][charter]: * They are the target of backwards compatibility (§7.g), and * They are subject to the OFWa patent grant (§8.d and e). To avoid unfortunate side effects (onerous backwards compatibility requirements or Member resignations), the following additional procedures apply to specification releases: ### Planning a release Every OCI specification project SHOULD hold meetings that involve maintainers reviewing pull requests, debating outstanding issues, and planning releases. This meeting MUST be advertised on the project README and MAY happen on a phone call, video conference, or on IRC. Maintainers MUST send updates to the dev@opencontainers.org with results of these meetings. Before the specification reaches v1.0.0, the meetings SHOULD be weekly. Once a specification has reached v1.0.0, the maintainers may alter the cadence, but a meeting MUST be held within four weeks of the previous meeting. The release plans, corresponding milestones and estimated due dates MUST be published on GitHub (e.g. https://github.com/opencontainers/runtime-spec/milestones). GitHub milestones and issues are only used for community organization and all releases MUST follow the [project governance](GOVERNANCE.md) rules and procedures. ### Timelines Specifications have a variety of different timelines in their lifecycle. * Pre-v1.0.0 specifications SHOULD release on a monthly cadence to garner feedback. * Major specification releases MUST release at least three release candidates spaced a minimum of one week apart. This means a major release like a v1.0.0 or v2.0.0 release will take 1 month at minimum: one week for rc1, one week for rc2, one week for rc3, and one week for the major release itself. Maintainers SHOULD strive to make zero breaking changes during this cycle of release candidates and SHOULD restart the three-candidate count when a breaking change is introduced. For example if a breaking change is introduced in v1.0.0-rc2 then the series would end with v1.0.0-rc4 and v1.0.0. * Minor and patch releases SHOULD be made on an as-needed basis. [charter]: https://github.com/opencontainers/tob/blob/main/CHARTER.md ## Checklist Releases usually follow a few steps: * [ ] prepare a pull-request for the release * [ ] a commit updating `./ChangeLog` * [ ] `git log --oneline --no-merges --decorate --name-status v1.0.1..HEAD | vim -` * [ ] `:% s/(pr\/\(\d*\))\(.*\)/\2 (#\1)/` to move the PR to the end of line and match previous formatting * [ ] review `(^M|^A|^D)` for impact of the commit * [ ] group commits to `Additions:`, `Minor fixes and documentation:`, `Breaking changes:` * [ ] delete the `(^M|^A|^D)` lines, `:%!grep -vE '(^M|^A|^D)'` * [ ] merge multi-commit PRs (so each line has a `(#num)` suffix) * [ ] drop hash and indent, `:'<,'> s/^\w* /^I* /` * [ ] a commit bumping `./specs-go/version.go` to next version and empty the `VersionDev` variable * [ ] a commit adding back the "+dev" to `VersionDev` * [ ] send email to dev@opencontainers.org * [ ] copy the exact commit hash for bumping the version from the pull-request (since master always stays as "-dev") * [ ] count the PRs since last release (that this version is tracking, in the cases of multiple branching), like `git log --pretty=oneline --no-merges --decorate $priorTag..$versionBumpCommit | grep \(pr\/ | wc -l` * [ ] get the date for a week from now, like `TZ=UTC date --date='next week'` * [ ] OPTIONAL find a cute animal gif to attach to the email, and subsequently the release description * [ ] subject line like `[runtime-spec VOTE] tag $versionBumpCommit as $version (closes $dateWeekFromNowUTC)` * [ ] email body like ``` Hey everyone, There have been $numPRs PRs merged since $priorTag release (https://github.com/opencontainers/runtime-spec/compare/$priorTag...$versionBumpCommit). $linkToPullRequest Please respond LGTM or REJECT (with reasoning). $sig ``` * [ ] edit/update the pull-request to link to the VOTE thread, from https://groups.google.com/a/opencontainers.org/forum/#!forum/dev * [ ] a week later, if the vote passes, merge the PR * [ ] `git tag -s $version $versionBumpCommit` * [ ] `git push --tags` * [ ] produce release documents * [ ] git checkout the release tag, like `git checkout $version` * [ ] `make docs` * [ ] rename the output PDF and HTML file to include version, like `mv output/oci-runtime-spec.pdf output/oci-runtime-spec-$version.pdf`` * [ ] attach these docs to the release on https://github.com/opencontainers/runtime-spec/releases * [ ] link to the the VOTE thread and include the passing vote count * [ ] link to the pull request that merged the release crun-1.16.1/libocispec/runtime-spec/glossary.md0000644000000000000000000000475414460417222017665 0ustar0000000000000000# Glossary ## Bundle A [directory structure](bundle.md) that is written ahead of time, distributed, and used to seed the runtime for creating a [container](#container) and launching a process within it. ## Configuration The [`config.json`](config.md) file in a [bundle](#bundle) which defines the intended [container](#container) and container process. ## Container An environment for executing processes with configurable isolation and resource limitations. For example, namespaces, resource limits, and mounts are all part of the container environment. ## Container namespace On Linux,the [namespaces][namespaces.7] in which the [configured process](config.md#process) executes. ## Features Structure A [JSON][] structure that represents [the implemented features](#features.md) of the [runtime](#runtime). Irrelevant to the actual availability of the features in the host operating system. ## JSON All configuration [JSON][] MUST be encoded in [UTF-8][]. JSON objects MUST NOT include duplicate names. The order of entries in JSON objects is not significant. ## Runtime An implementation of this specification. It reads the [configuration files](#configuration) from a [bundle](#bundle), uses that information to create a [container](#container), launches a process inside the container, and performs other [lifecycle actions](runtime.md). ## Runtime caller An external program to execute a [runtime](#runtime), directly or indirectly. Examples of direct callers include containerd, CRI-O, and Podman. Examples of indirect callers include Docker/Moby and Kubernetes. Runtime callers often execute a runtime via [runc][]-compatible command line interface, however, its interaction interface is currently out of the scope of the Open Container Initiative Runtime Specification. ## Runtime namespace On Linux, the namespaces from which new [container namespaces](#container-namespace) are [created](config-linux.md#namespaces) and from which some configured resources are accessed. [JSON]: https://tools.ietf.org/html/rfc8259 [UTF-8]: http://www.unicode.org/versions/Unicode8.0.0/ch03.pdf [runc]: https://github.com/opencontainers/runc [namespaces.7]: http://man7.org/linux/man-pages/man7/namespaces.7.html crun-1.16.1/libocispec/runtime-spec/config-linux.md0000644000000000000000000012456314432210717020424 0ustar0000000000000000# Linux Container Configuration This document describes the schema for the [Linux-specific section](config.md#platform-specific-configuration) of the [container configuration](config.md). The Linux container specification uses various kernel features like namespaces, cgroups, capabilities, LSM, and filesystem jails to fulfill the spec. ## Default Filesystems The Linux ABI includes both syscalls and several special file paths. Applications expecting a Linux environment will very likely expect these file paths to be set up correctly. The following filesystems SHOULD be made available in each container's filesystem: | Path | Type | | -------- | ------ | | /proc | [proc][] | | /sys | [sysfs][] | | /dev/pts | [devpts][] | | /dev/shm | [tmpfs][] | ## Namespaces A namespace wraps a global system resource in an abstraction that makes it appear to the processes within the namespace that they have their own isolated instance of the global resource. Changes to the global resource are visible to other processes that are members of the namespace, but are invisible to other processes. For more information, see the [namespaces(7)][namespaces.7_2] man page. Namespaces are specified as an array of entries inside the `namespaces` root field. The following parameters can be specified to set up namespaces: * **`type`** *(string, REQUIRED)* - namespace type. The following namespace types SHOULD be supported: * **`pid`** processes inside the container will only be able to see other processes inside the same container or inside the same pid namespace. * **`network`** the container will have its own network stack. * **`mount`** the container will have an isolated mount table. * **`ipc`** processes inside the container will only be able to communicate to other processes inside the same container via system level IPC. * **`uts`** the container will be able to have its own hostname and domain name. * **`user`** the container will be able to remap user and group IDs from the host to local users and groups within the container. * **`cgroup`** the container will have an isolated view of the cgroup hierarchy. * **`time`** the container will be able to have its own clocks. * **`path`** *(string, OPTIONAL)* - namespace file. This value MUST be an absolute path in the [runtime mount namespace](glossary.md#runtime-namespace). The runtime MUST place the container process in the namespace associated with that `path`. The runtime MUST [generate an error](runtime.md#errors) if `path` is not associated with a namespace of type `type`. If `path` is not specified, the runtime MUST create a new [container namespace](glossary.md#container-namespace) of type `type`. If a namespace type is not specified in the `namespaces` array, the container MUST inherit the [runtime namespace](glossary.md#runtime-namespace) of that type. If a `namespaces` field contains duplicated namespaces with same `type`, the runtime MUST [generate an error](runtime.md#errors). ### Example ```json "namespaces": [ { "type": "pid", "path": "/proc/1234/ns/pid" }, { "type": "network", "path": "/var/run/netns/neta" }, { "type": "mount" }, { "type": "ipc" }, { "type": "uts" }, { "type": "user" }, { "type": "cgroup" }, { "type": "time" } ] ``` ## User namespace mappings **`uidMappings`** (array of objects, OPTIONAL) describes the user namespace uid mappings from the host to the container. **`gidMappings`** (array of objects, OPTIONAL) describes the user namespace gid mappings from the host to the container. Each entry has the following structure: * **`containerID`** *(uint32, REQUIRED)* - is the starting uid/gid in the container. * **`hostID`** *(uint32, REQUIRED)* - is the starting uid/gid on the host to be mapped to *containerID*. * **`size`** *(uint32, REQUIRED)* - is the number of ids to be mapped. The runtime SHOULD NOT modify the ownership of referenced filesystems to realize the mapping. Note that the number of mapping entries MAY be limited by the [kernel][user-namespaces]. ### Example ```json "uidMappings": [ { "containerID": 0, "hostID": 1000, "size": 32000 } ], "gidMappings": [ { "containerID": 0, "hostID": 1000, "size": 32000 } ] ``` ## Offset for Time Namespace **`timeOffsets`** (object, OPTIONAL) sets the offset for Time Namespace. For more information see the [time_namespaces][time_namespaces.7]. The name of the clock is the entry key. Entry values are objects with the following properties: * **`secs`** *(int64, OPTIONAL)* - is the offset of clock (in seconds) in the container. * **`nanosecs`** *(uint32, OPTIONAL)* - is the offset of clock (in nanoseconds) in the container. ## Devices **`devices`** (array of objects, OPTIONAL) lists devices that MUST be available in the container. The runtime MAY supply them however it likes (with [`mknod`][mknod.2], by bind mounting from the runtime mount namespace, using symlinks, etc.). Each entry has the following structure: * **`type`** *(string, REQUIRED)* - type of device: `c`, `b`, `u` or `p`. More info in [mknod(1)][mknod.1]. * **`path`** *(string, REQUIRED)* - full path to device inside container. If a [file][] already exists at `path` that does not match the requested device, the runtime MUST generate an error. The path MAY be anywhere in the container filesystem, notably outside of `/dev`. * **`major, minor`** *(int64, REQUIRED unless `type` is `p`)* - [major, minor numbers][devices] for the device. * **`fileMode`** *(uint32, OPTIONAL)* - file mode for the device. You can also control access to devices [with cgroups](#configLinuxDeviceAllowedlist). * **`uid`** *(uint32, OPTIONAL)* - id of device owner in the [container namespace](glossary.md#container-namespace). * **`gid`** *(uint32, OPTIONAL)* - id of device group in the [container namespace](glossary.md#container-namespace). The same `type`, `major` and `minor` SHOULD NOT be used for multiple devices. Containers MAY NOT access any device node that is not either explicitly referenced in the **`devices`** array or listed as being part of the [default devices](#configLinuxDefaultDevices). Rationale: runtimes based on virtual machines need to be able to adjust the node devices, and accessing device nodes that were not adjusted could have undefined behaviour. ### Example ```json "devices": [ { "path": "/dev/fuse", "type": "c", "major": 10, "minor": 229, "fileMode": 438, "uid": 0, "gid": 0 }, { "path": "/dev/sda", "type": "b", "major": 8, "minor": 0, "fileMode": 432, "uid": 0, "gid": 0 } ] ``` ### Default Devices In addition to any devices configured with this setting, the runtime MUST also supply: * [`/dev/null`][null.4] * [`/dev/zero`][zero.4] * [`/dev/full`][full.4] * [`/dev/random`][random.4] * [`/dev/urandom`][random.4] * [`/dev/tty`][tty.4] * `/dev/console` is set up if [`terminal`](config.md#process) is enabled in the config by bind mounting the pseudoterminal pty to `/dev/console`. * [`/dev/ptmx`][pts.4]. A [bind-mount or symlink of the container's `/dev/pts/ptmx`][devpts]. ## Control groups Also known as cgroups, they are used to restrict resource usage for a container and handle device access. cgroups provide controls (through controllers) to restrict cpu, memory, IO, pids, network and RDMA resources for the container. For more information, see the [kernel cgroups documentation][cgroup-v1]. A runtime MAY, during a particular [container operation](runtime.md#operation), such as [create](runtime.md#create), [start](runtime.md#start), or [exec](runtime.md#exec), check if the container cgroup is fit for purpose, and MUST [generate an error](runtime.md#errors) if such a check fails. For example, a frozen cgroup or (for [create](runtime.md#create) operation) a non-empty cgroup. The reason for this is that accepting such configurations could cause container operation outcomes that users may not anticipate or understand, such as operation on one container inadvertently affecting other containers. ### Cgroups Path **`cgroupsPath`** (string, OPTIONAL) path to the cgroups. It can be used to either control the cgroups hierarchy for containers or to run a new process in an existing container. The value of `cgroupsPath` MUST be either an absolute path or a relative path. * In the case of an absolute path (starting with `/`), the runtime MUST take the path to be relative to the cgroups mount point. * In the case of a relative path (not starting with `/`), the runtime MAY interpret the path relative to a runtime-determined location in the cgroups hierarchy. If the value is specified, the runtime MUST consistently attach to the same place in the cgroups hierarchy given the same value of `cgroupsPath`. If the value is not specified, the runtime MAY define the default cgroups path. Runtimes MAY consider certain `cgroupsPath` values to be invalid, and MUST generate an error if this is the case. Implementations of the Spec can choose to name cgroups in any manner. The Spec does not include naming schema for cgroups. The Spec does not support per-controller paths for the reasons discussed in the [cgroupv2 documentation][cgroup-v2]. The cgroups will be created if they don't exist. You can configure a container's cgroups via the `resources` field of the Linux configuration. Do not specify `resources` unless limits have to be updated. For example, to run a new process in an existing container without updating limits, `resources` need not be specified. Runtimes MAY attach the container process to additional cgroup controllers beyond those necessary to fulfill the `resources` settings. ### Cgroup ownership Runtimes MAY, according to the following rules, change (or cause to be changed) the owner of the container's cgroup to the host uid that maps to the value of `process.user.uid` in the [container namespace](glossary.md#container-namespace); that is, the user that will execute the container process. Runtimes SHOULD NOT change the ownership of container cgroups when cgroups v1 is in use. Cgroup delegation is not secure in cgroups v1. A runtime SHOULD NOT change the ownership of a container cgroup unless it will also create a new cgroup namespace for the container. Typically this occurs when the `linux.namespaces` array contains an object with `type` equal to `"cgroup"` and `path` unset. Runtimes SHOULD change the cgroup ownership if and only if the cgroup filesystem is to be mounted read/write; that is, when the configuration's `mounts` array contains an object where: - The `source` field is equal to `"cgroup"` - The `destination` field is equal to `"/sys/fs/cgroup"` - The `options` field does not contain the value `"ro"` If the configuration does not specify such a mount, the runtime SHOULD NOT change the cgroup ownership. A runtime that changes the cgroup ownership SHOULD only change the ownership of the container's cgroup directory and files within that directory that are listed in `/sys/kernel/cgroup/delegate`. See `cgroups(7)` for details about this file. Note that not all files listed in `/sys/kernel/cgroup/delegate` necessarily exist in every cgroup. Runtimes MUST NOT fail in this scenario, and SHOULD change the ownership of the listed files that do exist in the cgroup. If the `/sys/kernel/cgroup/delegate` file does not exist, the runtime MUST fall back to using the following list of files: ``` cgroup.procs cgroup.subtree_control cgroup.threads ``` The runtime SHOULD NOT change the ownership of any other files. Changing other files may allow the container to elevate its own resource limits or perform other unwanted behaviour. ### Example ```json "cgroupsPath": "/myRuntime/myContainer", "resources": { "memory": { "limit": 100000, "reservation": 200000 }, "devices": [ { "allow": false, "access": "rwm" } ] } ``` ### Allowed Device list **`devices`** (array of objects, OPTIONAL) configures the [allowed device list][cgroup-v1-devices]. The runtime MUST apply entries in the listed order. Each entry has the following structure: * **`allow`** *(boolean, REQUIRED)* - whether the entry is allowed or denied. * **`type`** *(string, OPTIONAL)* - type of device: `a` (all), `c` (char), or `b` (block). Unset values mean "all", mapping to `a`. * **`major, minor`** *(int64, OPTIONAL)* - [major, minor numbers][devices] for the device. Unset values mean "all", mapping to [`*` in the filesystem API][cgroup-v1-devices]. * **`access`** *(string, OPTIONAL)* - cgroup permissions for device. A composition of `r` (read), `w` (write), and `m` (mknod). #### Example ```json "devices": [ { "allow": false, "access": "rwm" }, { "allow": true, "type": "c", "major": 10, "minor": 229, "access": "rw" }, { "allow": true, "type": "b", "major": 8, "minor": 0, "access": "r" } ] ``` ### Memory **`memory`** (object, OPTIONAL) represents the cgroup subsystem `memory` and it's used to set limits on the container's memory usage. For more information, see the kernel cgroups documentation about [memory][cgroup-v1-memory]. Values for memory specify the limit in bytes, or `-1` for unlimited memory. * **`limit`** *(int64, OPTIONAL)* - sets limit of memory usage * **`reservation`** *(int64, OPTIONAL)* - sets soft limit of memory usage * **`swap`** *(int64, OPTIONAL)* - sets limit of memory+Swap usage * **`kernel`** *(int64, OPTIONAL, NOT RECOMMENDED)* - sets hard limit for kernel memory * **`kernelTCP`** *(int64, OPTIONAL, NOT RECOMMENDED)* - sets hard limit for kernel TCP buffer memory The following properties do not specify memory limits, but are covered by the `memory` controller: * **`swappiness`** *(uint64, OPTIONAL)* - sets swappiness parameter of vmscan (See sysctl's vm.swappiness) The values are from 0 to 100. Higher means more swappy. * **`disableOOMKiller`** *(bool, OPTIONAL)* - enables or disables the OOM killer. If enabled (`false`), tasks that attempt to consume more memory than they are allowed are immediately killed by the OOM killer. The OOM killer is enabled by default in every cgroup using the `memory` subsystem. To disable it, specify a value of `true`. * **`useHierarchy`** *(bool, OPTIONAL)* - enables or disables hierarchical memory accounting. If enabled (`true`), child cgroups will share the memory limits of this cgroup. * **`checkBeforeUpdate`** *(bool, OPTIONAL)* - enables container memory usage check before setting a new limit. If enabled (`true`), runtime MAY check if a new memory limit is lower than the current usage, and MUST reject the new limit. Practically, when cgroup v1 is used, the kernel rejects the limit lower than the current usage, and when cgroup v2 is used, an OOM killer is invoked. This setting can be used on cgroup v2 to mimic the cgroup v1 behavior. #### Example ```json "memory": { "limit": 536870912, "reservation": 536870912, "swap": 536870912, "kernel": -1, "kernelTCP": -1, "swappiness": 0, "disableOOMKiller": false } ``` ### CPU **`cpu`** (object, OPTIONAL) represents the cgroup subsystems `cpu` and `cpusets`. For more information, see the kernel cgroups documentation about [cpusets][cgroup-v1-cpusets]. The following parameters can be specified to set up the controller: * **`shares`** *(uint64, OPTIONAL)* - specifies a relative share of CPU time available to the tasks in a cgroup * **`quota`** *(int64, OPTIONAL)* - specifies the total amount of time in microseconds for which all tasks in a cgroup can run during one period (as defined by **`period`** below) If specified with any (valid) positive value, it MUST be no smaller than `burst` (runtimes MAY generate an error). * **`burst`** *(uint64, OPTIONAL)* - specifies the maximum amount of accumulated time in microseconds for which all tasks in a cgroup can run additionally for burst during one period (as defined by **`period`** below) If specified, this value MUST be no larger than any positive `quota` (runtimes MAY generate an error). * **`period`** *(uint64, OPTIONAL)* - specifies a period of time in microseconds for how regularly a cgroup's access to CPU resources should be reallocated (CFS scheduler only) * **`realtimeRuntime`** *(int64, OPTIONAL)* - specifies a period of time in microseconds for the longest continuous period in which the tasks in a cgroup have access to CPU resources * **`realtimePeriod`** *(uint64, OPTIONAL)* - same as **`period`** but applies to realtime scheduler only * **`cpus`** *(string, OPTIONAL)* - list of CPUs the container will run in * **`mems`** *(string, OPTIONAL)* - list of Memory Nodes the container will run in * **`idle`** *(int64, OPTIONAL)* - cgroups are configured with minimum weight, 0: default behavior, 1: SCHED_IDLE. #### Example ```json "cpu": { "shares": 1024, "quota": 1000000, "burst": 1000000, "period": 500000, "realtimeRuntime": 950000, "realtimePeriod": 1000000, "cpus": "2-3", "mems": "0-7", "idle": 0 } ``` ### Block IO **`blockIO`** (object, OPTIONAL) represents the cgroup subsystem `blkio` which implements the block IO controller. For more information, see the kernel cgroups documentation about [blkio][cgroup-v1-blkio] of cgroup v1 or [io][cgroup-v2-io] of cgroup v2, . Note that I/O throttling settings in cgroup v1 apply only to Direct I/O due to kernel implementation constraints, while this limitation does not exist in cgroup v2. The following parameters can be specified to set up the controller: * **`weight`** *(uint16, OPTIONAL)* - specifies per-cgroup weight. This is default weight of the group on all devices until and unless overridden by per-device rules. * **`leafWeight`** *(uint16, OPTIONAL)* - equivalents of `weight` for the purpose of deciding how much weight tasks in the given cgroup has while competing with the cgroup's child cgroups. * **`weightDevice`** *(array of objects, OPTIONAL)* - an array of per-device bandwidth weights. Each entry has the following structure: * **`major, minor`** *(int64, REQUIRED)* - major, minor numbers for device. For more information, see the [mknod(1)][mknod.1] man page. * **`weight`** *(uint16, OPTIONAL)* - bandwidth weight for the device. * **`leafWeight`** *(uint16, OPTIONAL)* - bandwidth weight for the device while competing with the cgroup's child cgroups, CFQ scheduler only You MUST specify at least one of `weight` or `leafWeight` in a given entry, and MAY specify both. * **`throttleReadBpsDevice`**, **`throttleWriteBpsDevice`** *(array of objects, OPTIONAL)* - an array of per-device bandwidth rate limits. Each entry has the following structure: * **`major, minor`** *(int64, REQUIRED)* - major, minor numbers for device. For more information, see the [mknod(1)][mknod.1] man page. * **`rate`** *(uint64, REQUIRED)* - bandwidth rate limit in bytes per second for the device * **`throttleReadIOPSDevice`**, **`throttleWriteIOPSDevice`** *(array of objects, OPTIONAL)* - an array of per-device IO rate limits. Each entry has the following structure: * **`major, minor`** *(int64, REQUIRED)* - major, minor numbers for device. For more information, see the [mknod(1)][mknod.1] man page. * **`rate`** *(uint64, REQUIRED)* - IO rate limit for the device #### Example ```json "blockIO": { "weight": 10, "leafWeight": 10, "weightDevice": [ { "major": 8, "minor": 0, "weight": 500, "leafWeight": 300 }, { "major": 8, "minor": 16, "weight": 500 } ], "throttleReadBpsDevice": [ { "major": 8, "minor": 0, "rate": 600 } ], "throttleWriteIOPSDevice": [ { "major": 8, "minor": 16, "rate": 300 } ] } ``` ### Huge page limits **`hugepageLimits`** (array of objects, OPTIONAL) represents the `hugetlb` controller which allows to limit the HugeTLB reservations (if supported) or usage (page fault). By default if supported by the kernel, `hugepageLimits` defines the hugepage sizes and limits for HugeTLB controller reservation accounting, which allows to limit the HugeTLB reservations per control group and enforces the controller limit at reservation time and at the fault of HugeTLB memory for which no reservation exists. Otherwise if not supported by the kernel, this should fallback to the page fault accounting, which allows users to limit the HugeTLB usage (page fault) per control group and enforces the limit during page fault. Note that reservation limits are superior to page fault limits, since reservation limits are enforced at reservation time (on mmap or shget), and never causes the application to get SIGBUS signal if the memory was reserved before hand. This allows for easier fallback to alternatives such as non-HugeTLB memory for example. In the case of page fault accounting, it's very hard to avoid processes getting SIGBUS since the sysadmin needs precisely know the HugeTLB usage of all the tasks in the system and make sure there is enough pages to satisfy all requests. Avoiding tasks getting SIGBUS on overcommited systems is practically impossible with page fault accounting. For more information, see the kernel cgroups documentation about [HugeTLB][cgroup-v1-hugetlb]. Each entry has the following structure: * **`pageSize`** *(string, REQUIRED)* - hugepage size. The value has the format `B` (64KB, 2MB, 1GB), and must match the `` of the corresponding control file found in `/sys/fs/cgroup/hugetlb/hugetlb..rsvd.limit_in_bytes` (if hugetlb_cgroup reservation is supported) or `/sys/fs/cgroup/hugetlb/hugetlb..limit_in_bytes` (if not supported). Values of `` are intended to be parsed using base 1024 ("1KB" = 1024, "1MB" = 1048576, etc). * **`limit`** *(uint64, REQUIRED)* - limit in bytes of *hugepagesize* HugeTLB reservations (if supported) or usage. #### Example ```json "hugepageLimits": [ { "pageSize": "2MB", "limit": 209715200 }, { "pageSize": "64KB", "limit": 1000000 } ] ``` ### Network **`network`** (object, OPTIONAL) represents the cgroup subsystems `net_cls` and `net_prio`. For more information, see the kernel cgroups documentations about [net\_cls cgroup][cgroup-v1-net-cls] and [net\_prio cgroup][cgroup-v1-net-prio]. The following parameters can be specified to set up the controller: * **`classID`** *(uint32, OPTIONAL)* - is the network class identifier the cgroup's network packets will be tagged with * **`priorities`** *(array of objects, OPTIONAL)* - specifies a list of objects of the priorities assigned to traffic originating from processes in the group and egressing the system on various interfaces. The following parameters can be specified per-priority: * **`name`** *(string, REQUIRED)* - interface name in [runtime network namespace](glossary.md#runtime-namespace) * **`priority`** *(uint32, REQUIRED)* - priority applied to the interface #### Example ```json "network": { "classID": 1048577, "priorities": [ { "name": "eth0", "priority": 500 }, { "name": "eth1", "priority": 1000 } ] } ``` ### PIDs **`pids`** (object, OPTIONAL) represents the cgroup subsystem `pids`. For more information, see the kernel cgroups documentation about [pids][cgroup-v1-pids]. The following parameters can be specified to set up the controller: * **`limit`** *(int64, REQUIRED)* - specifies the maximum number of tasks in the cgroup #### Example ```json "pids": { "limit": 32771 } ``` ### RDMA **`rdma`** (object, OPTIONAL) represents the cgroup subsystem `rdma`. For more information, see the kernel cgroups documentation about [rdma][cgroup-v1-rdma]. The name of the device to limit is the entry key. Entry values are objects with the following properties: * **`hcaHandles`** *(uint32, OPTIONAL)* - specifies the maximum number of hca_handles in the cgroup * **`hcaObjects`** *(uint32, OPTIONAL)* - specifies the maximum number of hca_objects in the cgroup You MUST specify at least one of the `hcaHandles` or `hcaObjects` in a given entry, and MAY specify both. #### Example ```json "rdma": { "mlx5_1": { "hcaHandles": 3, "hcaObjects": 10000 }, "mlx4_0": { "hcaObjects": 1000 }, "rxe3": { "hcaObjects": 10000 } } ``` ## Unified **`unified`** (object, OPTIONAL) allows cgroup v2 parameters to be to be set and modified for the container. Each key in the map refers to a file in the cgroup unified hierarchy. The OCI runtime MUST ensure that the needed cgroup controllers are enabled for the cgroup. Configuration unknown to the runtime MUST still be written to the relevant file. The runtime MUST generate an error when the configuration refers to a cgroup controller that is not present or that cannot be enabled. ### Example ```json "unified": { "io.max": "259:0 rbps=2097152 wiops=120\n253:0 rbps=2097152 wiops=120", "hugetlb.1GB.max": "1073741824" } ``` If a controller is enabled on the cgroup v2 hierarchy but the configuration is provided for the cgroup v1 equivalent controller, the runtime MAY attempt a conversion. If the conversion is not possible the runtime MUST generate an error. ## IntelRdt **`intelRdt`** (object, OPTIONAL) represents the [Intel Resource Director Technology][intel-rdt-cat-kernel-interface]. If `intelRdt` is set, the runtime MUST write the container process ID to the `tasks` file in a proper sub-directory in a mounted `resctrl` pseudo-filesystem. That sub-directory name is specified by `closID` parameter. If no mounted `resctrl` pseudo-filesystem is available in the [runtime mount namespace](glossary.md#runtime-namespace), the runtime MUST [generate an error](runtime.md#errors). If `intelRdt` is not set, the runtime MUST NOT manipulate any `resctrl` pseudo-filesystems. The following parameters can be specified for the container: * **`closID`** *(string, OPTIONAL)* - specifies the identity for RDT Class of Service (CLOS). * **`l3CacheSchema`** *(string, OPTIONAL)* - specifies the schema for L3 cache id and capacity bitmask (CBM). The value SHOULD start with `L3:` and SHOULD NOT contain newlines. * **`memBwSchema`** *(string, OPTIONAL)* - specifies the schema of memory bandwidth per L3 cache id. The value MUST start with `MB:` and MUST NOT contain newlines. The following rules on parameters MUST be applied: * If both `l3CacheSchema` and `memBwSchema` are set, runtimes MUST write the combined value to the `schemata` file in that sub-directory discussed in `closID`. * If `l3CacheSchema` contains a line beginning with `MB:`, the value written to `schemata` file MUST be the non-`MB:` line(s) from `l3CacheSchema` and the line from `memBWSchema`. * If either `l3CacheSchema` or `memBwSchema` is set, runtimes MUST write the value to the `schemata` file in the that sub-directory discussed in `closID`. * If neither `l3CacheSchema` nor `memBwSchema` is set, runtimes MUST NOT write to `schemata` files in any `resctrl` pseudo-filesystems. * If `closID` is not set, runtimes MUST use the container ID from [`start`](runtime.md#start) and create the `` directory. * If `closID` is set, `l3CacheSchema` and/or `memBwSchema` is set * if `closID` directory in a mounted `resctrl` pseudo-filesystem doesn't exist, the runtimes MUST create it. * if `closID` directory in a mounted `resctrl` pseudo-filesystem exists, runtimes MUST compare `l3CacheSchema` and/or `memBwSchema` value with `schemata` file, and [generate an error](runtime.md#errors) if doesn't match. * If `closID` is set, and neither of `l3CacheSchema` and `memBwSchema` are set, runtime MUST check if corresponding pre-configured directory `closID` is present in mounted `resctrl`. If such pre-configured directory `closID` exists, runtime MUST assign container to this `closID` and [generate an error](runtime.md#errors) if directory does not exist. * **`enableCMT`** *(boolean, OPTIONAL)* - specifies if Intel RDT CMT should be enabled: * CMT (Cache Monitoring Technology) supports monitoring of the last-level cache (LLC) occupancy for the container. * **`enableMBM`** *(boolean, OPTIONAL)* - specifies if Intel RDT MBM should be enabled: * MBM (Memory Bandwidth Monitoring) supports monitoring of total and local memory bandwidth for the container. ### Example Consider a two-socket machine with two L3 caches where the default CBM is 0x7ff and the max CBM length is 11 bits, and minimum memory bandwidth of 10% with a memory bandwidth granularity of 10%. Tasks inside the container only have access to the "upper" 7/11 of L3 cache on socket 0 and the "lower" 5/11 L3 cache on socket 1, and may use a maximum memory bandwidth of 20% on socket 0 and 70% on socket 1. ```json "linux": { "intelRdt": { "closID": "guaranteed_group", "l3CacheSchema": "L3:0=7f0;1=1f", "memBwSchema": "MB:0=20;1=70" } } ``` ## Sysctl **`sysctl`** (object, OPTIONAL) allows kernel parameters to be modified at runtime for the container. For more information, see the [sysctl(8)][sysctl.8] man page. ### Example ```json "sysctl": { "net.ipv4.ip_forward": "1", "net.core.somaxconn": "256" } ``` ## Seccomp Seccomp provides application sandboxing mechanism in the Linux kernel. Seccomp configuration allows one to configure actions to take for matched syscalls and furthermore also allows matching on values passed as arguments to syscalls. For more information about Seccomp, see [Seccomp][seccomp] kernel documentation. The actions, architectures, and operators are strings that match the definitions in seccomp.h from [libseccomp][] and are translated to corresponding values. **`seccomp`** (object, OPTIONAL) The following parameters can be specified to set up seccomp: * **`defaultAction`** *(string, REQUIRED)* - the default action for seccomp. Allowed values are the same as `syscalls[].action`. * **`defaultErrnoRet`** *(uint, OPTIONAL)* - the errno return code to use. Some actions like `SCMP_ACT_ERRNO` and `SCMP_ACT_TRACE` allow to specify the errno code to return. When the action doesn't support an errno, the runtime MUST print and error and fail. If not specified then its default value is `EPERM`. * **`architectures`** *(array of strings, OPTIONAL)* - the architecture used for system calls. A valid list of constants as of libseccomp v2.5.0 is shown below. * `SCMP_ARCH_X86` * `SCMP_ARCH_X86_64` * `SCMP_ARCH_X32` * `SCMP_ARCH_ARM` * `SCMP_ARCH_AARCH64` * `SCMP_ARCH_MIPS` * `SCMP_ARCH_MIPS64` * `SCMP_ARCH_MIPS64N32` * `SCMP_ARCH_MIPSEL` * `SCMP_ARCH_MIPSEL64` * `SCMP_ARCH_MIPSEL64N32` * `SCMP_ARCH_PPC` * `SCMP_ARCH_PPC64` * `SCMP_ARCH_PPC64LE` * `SCMP_ARCH_S390` * `SCMP_ARCH_S390X` * `SCMP_ARCH_PARISC` * `SCMP_ARCH_PARISC64` * `SCMP_ARCH_RISCV64` * **`flags`** *(array of strings, OPTIONAL)* - list of flags to use with seccomp(2). A valid list of constants is shown below. * `SECCOMP_FILTER_FLAG_TSYNC` * `SECCOMP_FILTER_FLAG_LOG` * `SECCOMP_FILTER_FLAG_SPEC_ALLOW` * `SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV` * **`listenerPath`** *(string, OPTIONAL)* - specifies the path of UNIX domain socket over which the runtime will send the [container process state](#containerprocessstate) data structure when the `SCMP_ACT_NOTIFY` action is used. This socket MUST use `AF_UNIX` domain and `SOCK_STREAM` type. The runtime MUST send exactly one [container process state](#containerprocessstate) per connection. The connection MUST NOT be reused and it MUST be closed after sending a seccomp state. If sending to this socket fails, the runtime MUST [generate an error](runtime.md#errors). If the `SCMP_ACT_NOTIFY` action is not used this value is ignored. The runtime sends the following file descriptors using `SCM_RIGHTS` and set their names in the `fds` array of the [container process state](#containerprocessstate): * **`seccompFd`** (string, REQUIRED) is the seccomp file descriptor returned by the seccomp syscall. * **`listenerMetadata`** *(string, OPTIONAL)* - specifies an opaque data to pass to the seccomp agent. This string will be sent as the `metadata` field in the [container process state](#containerprocessstate). This field MUST NOT be set if `listenerPath` is not set. * **`syscalls`** *(array of objects, OPTIONAL)* - match a syscall in seccomp. While this property is OPTIONAL, some values of `defaultAction` are not useful without `syscalls` entries. For example, if `defaultAction` is `SCMP_ACT_KILL` and `syscalls` is empty or unset, the kernel will kill the container process on its first syscall. Each entry has the following structure: * **`names`** *(array of strings, REQUIRED)* - the names of the syscalls. `names` MUST contain at least one entry. * **`action`** *(string, REQUIRED)* - the action for seccomp rules. A valid list of constants as of libseccomp v2.5.0 is shown below. * `SCMP_ACT_KILL` * `SCMP_ACT_KILL_PROCESS` * `SCMP_ACT_KILL_THREAD` * `SCMP_ACT_TRAP` * `SCMP_ACT_ERRNO` * `SCMP_ACT_TRACE` * `SCMP_ACT_ALLOW` * `SCMP_ACT_LOG` * `SCMP_ACT_NOTIFY` * **`errnoRet`** *(uint, OPTIONAL)* - the errno return code to use. Some actions like `SCMP_ACT_ERRNO` and `SCMP_ACT_TRACE` allow to specify the errno code to return. When the action doesn't support an errno, the runtime MUST print and error and fail. If not specified its default value is `EPERM`. * **`args`** *(array of objects, OPTIONAL)* - the specific syscall in seccomp. Each entry has the following structure: * **`index`** *(uint, REQUIRED)* - the index for syscall arguments in seccomp. * **`value`** *(uint64, REQUIRED)* - the value for syscall arguments in seccomp. * **`valueTwo`** *(uint64, OPTIONAL)* - the value for syscall arguments in seccomp. * **`op`** *(string, REQUIRED)* - the operator for syscall arguments in seccomp. A valid list of constants as of libseccomp v2.3.2 is shown below. * `SCMP_CMP_NE` * `SCMP_CMP_LT` * `SCMP_CMP_LE` * `SCMP_CMP_EQ` * `SCMP_CMP_GE` * `SCMP_CMP_GT` * `SCMP_CMP_MASKED_EQ` ### Example ```json "seccomp": { "defaultAction": "SCMP_ACT_ALLOW", "architectures": [ "SCMP_ARCH_X86", "SCMP_ARCH_X32" ], "syscalls": [ { "names": [ "getcwd", "chmod" ], "action": "SCMP_ACT_ERRNO" } ] } ``` ### The Container Process State The container process state is a data structure passed via a UNIX socket. The container runtime MUST send the container process state over the UNIX socket as regular payload serialized in JSON and file descriptors MUST be sent using `SCM_RIGHTS`. The container runtime MAY use several `sendmsg(2)` calls to send the aforementioned data. If more than one `sendmsg(2)` is used, the file descriptors MUST be sent only in the first call. The container process state includes the following properties: * **`ociVersion`** (string, REQUIRED) is version of the Open Container Initiative Runtime Specification with which the container process state complies. * **`fds`** (array, OPTIONAL) is a string array containing the names of the file descriptors passed. The index of the name in this array corresponds to index of the file descriptors in the `SCM_RIGHTS` array. * **`pid`** (int, REQUIRED) is the container process ID, as seen by the runtime. * **`metadata`** (string, OPTIONAL) opaque metadata. * **`state`** ([state](runtime.md#state), REQUIRED) is the state of the container. Example sending a single `seccompFd` file descriptor in the `SCM_RIGHTS` array: ```json { "ociVersion": "1.0.2", "fds": [ "seccompFd" ], "pid": 4422, "metadata": "MKNOD=/dev/null,/dev/net/tun;BPF_MAP_TYPES=hash,array", "state": { "ociVersion": "1.0.2", "id": "oci-container1", "status": "creating", "pid": 4422, "bundle": "/containers/redis", "annotations": { "myKey": "myValue" } } } ``` ## Rootfs Mount Propagation **`rootfsPropagation`** (string, OPTIONAL) sets the rootfs's mount propagation. Its value is either `shared`, `slave`, `private` or `unbindable`. It's worth noting that a peer group is defined as a group of VFS mounts that propagate events to each other. A nested container is defined as a container launched inside an existing container. * **`shared`**: the rootfs mount belongs to a new peer group. This means that further mounts (e.g. nested containers) will also belong to that peer group and will propagate events to the rootfs. Note this does not mean that it's shared with the host. * **`slave`**: the rootfs mount receives propagation events from the host (e.g. if something is mounted on the host it will also appear in the container) but not the other way around. * **`private`**: the rootfs mount doesn't receive mount propagation events from the host and further mounts in nested containers will be isolated from the host and from the rootfs (even if the nested container `rootfsPropagation` option is shared). * **`unbindable`**: the rootfs mount is a private mount that cannot be bind-mounted. The [Shared Subtrees][sharedsubtree] article in the kernel documentation has more information about mount propagation. ### Example ```json "rootfsPropagation": "slave", ``` ## Masked Paths **`maskedPaths`** (array of strings, OPTIONAL) will mask over the provided paths inside the container so that they cannot be read. The values MUST be absolute paths in the [container namespace](glossary.md#container_namespace). ### Example ```json "maskedPaths": [ "/proc/kcore" ] ``` ## Readonly Paths **`readonlyPaths`** (array of strings, OPTIONAL) will set the provided paths as readonly inside the container. The values MUST be absolute paths in the [container namespace](glossary.md#container-namespace). ### Example ```json "readonlyPaths": [ "/proc/sys" ] ``` ## Mount Label **`mountLabel`** (string, OPTIONAL) will set the Selinux context for the mounts in the container. ### Example ```json "mountLabel": "system_u:object_r:svirt_sandbox_file_t:s0:c715,c811" ``` ## Personality **`personality`** (object, OPTIONAL) sets the Linux execution personality. For more information see the [personality][personality.2] syscall documentation. As most of the options are obsolete and rarely used, and some reduce security, the currently supported set is a small subset of the available options. * **`domain`** *(string, REQUIRED)* - the execution domain. The valid list of constants is shown below. `LINUX32` will set the `uname` system call to show a 32 bit CPU type, such as `i686`. * `LINUX` * `LINUX32` * **`flags`** *(array of strings, OPTIONAL)* - the additional flags to apply. Currently no flag values are supported. [cgroup-v1]: https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt [cgroup-v1-blkio]: https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt [cgroup-v1-cpusets]: https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt [cgroup-v1-devices]: https://www.kernel.org/doc/Documentation/cgroup-v1/devices.txt [cgroup-v1-hugetlb]: https://www.kernel.org/doc/Documentation/cgroup-v1/hugetlb.txt [cgroup-v1-memory]: https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt [cgroup-v1-net-cls]: https://www.kernel.org/doc/Documentation/cgroup-v1/net_cls.txt [cgroup-v1-net-prio]: https://www.kernel.org/doc/Documentation/cgroup-v1/net_prio.txt [cgroup-v1-pids]: https://www.kernel.org/doc/Documentation/cgroup-v1/pids.txt [cgroup-v1-rdma]: https://www.kernel.org/doc/Documentation/cgroup-v1/rdma.txt [cgroup-v2]: https://www.kernel.org/doc/Documentation/cgroup-v2.txt [cgroup-v2-io]: https://docs.kernel.org/admin-guide/cgroup-v2.html#io [devices]: https://www.kernel.org/doc/Documentation/admin-guide/devices.txt [devpts]: https://www.kernel.org/doc/Documentation/filesystems/devpts.txt [file]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_164 [libseccomp]: https://github.com/seccomp/libseccomp [proc]: https://www.kernel.org/doc/Documentation/filesystems/proc.txt [seccomp]: https://www.kernel.org/doc/Documentation/prctl/seccomp_filter.txt [sharedsubtree]: https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt [sysfs]: https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt [tmpfs]: https://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt [full.4]: http://man7.org/linux/man-pages/man4/full.4.html [mknod.1]: http://man7.org/linux/man-pages/man1/mknod.1.html [mknod.2]: http://man7.org/linux/man-pages/man2/mknod.2.html [namespaces.7_2]: http://man7.org/linux/man-pages/man7/namespaces.7.html [null.4]: http://man7.org/linux/man-pages/man4/null.4.html [personality.2]: http://man7.org/linux/man-pages/man2/personality.2.html [pts.4]: http://man7.org/linux/man-pages/man4/pts.4.html [random.4]: http://man7.org/linux/man-pages/man4/random.4.html [sysctl.8]: http://man7.org/linux/man-pages/man8/sysctl.8.html [tty.4]: http://man7.org/linux/man-pages/man4/tty.4.html [zero.4]: http://man7.org/linux/man-pages/man4/zero.4.html [user-namespaces]: http://man7.org/linux/man-pages/man7/user_namespaces.7.html [intel-rdt-cat-kernel-interface]: https://www.kernel.org/doc/Documentation/x86/intel_rdt_ui.txt [time_namespaces.7]: https://man7.org/linux/man-pages/man7/time_namespaces.7.html crun-1.16.1/libocispec/runtime-spec/runtime.md0000644000000000000000000002354114416051456017504 0ustar0000000000000000# Runtime and Lifecycle ## Scope of a Container The entity using a runtime to create a container MUST be able to use the operations defined in this specification against that same container. Whether other entities using the same, or other, instance of the runtime can see that container is out of scope of this specification. ## State The state of a container includes the following properties: * **`ociVersion`** (string, REQUIRED) is version of the Open Container Initiative Runtime Specification with which the state complies. * **`id`** (string, REQUIRED) is the container's ID. This MUST be unique across all containers on this host. There is no requirement that it be unique across hosts. * **`status`** (string, REQUIRED) is the runtime state of the container. The value MAY be one of: * `creating`: the container is being created (step 2 in the [lifecycle](#lifecycle)) * `created`: the runtime has finished the [create operation](#create) (after step 2 in the [lifecycle](#lifecycle)), and the container process has neither exited nor executed the user-specified program * `running`: the container process has executed the user-specified program but has not exited (after step 8 in the [lifecycle](#lifecycle)) * `stopped`: the container process has exited (step 10 in the [lifecycle](#lifecycle)) Additional values MAY be defined by the runtime, however, they MUST be used to represent new runtime states not defined above. * **`pid`** (int, REQUIRED when `status` is `created` or `running` on Linux, OPTIONAL on other platforms) is the ID of the container process. For hooks executed in the runtime namespace, it is the pid as seen by the runtime. For hooks executed in the container namespace, it is the pid as seen by the container. * **`bundle`** (string, REQUIRED) is the absolute path to the container's bundle directory. This is provided so that consumers can find the container's configuration and root filesystem on the host. * **`annotations`** (map, OPTIONAL) contains the list of annotations associated with the container. If no annotations were provided then this property MAY either be absent or an empty map. The state MAY include additional properties. When serialized in JSON, the format MUST adhere to the JSON Schema [`schema/state-schema.json`](schema/state-schema.json). See [Query State](#query-state) for information on retrieving the state of a container. ### Example ```json { "ociVersion": "0.2.0", "id": "oci-container1", "status": "running", "pid": 4422, "bundle": "/containers/redis", "annotations": { "myKey": "myValue" } } ``` ## Lifecycle The lifecycle describes the timeline of events that happen from when a container is created to when it ceases to exist. 1. OCI compliant runtime's [`create`](runtime.md#create) command is invoked with a reference to the location of the bundle and a unique identifier. 2. The container's runtime environment MUST be created according to the configuration in [`config.json`](config.md). If the runtime is unable to create the environment specified in the [`config.json`](config.md), it MUST [generate an error](#errors). While the resources requested in the [`config.json`](config.md) MUST be created, the user-specified program (from [`process`](config.md#process)) MUST NOT be run at this time. Any updates to [`config.json`](config.md) after this step MUST NOT affect the container. 3. The [`prestart` hooks](config.md#prestart) MUST be invoked by the runtime. If any `prestart` hook fails, the runtime MUST [generate an error](#errors), stop the container, and continue the lifecycle at step 12. 4. The [`createRuntime` hooks](config.md#createRuntime-hooks) MUST be invoked by the runtime. If any `createRuntime` hook fails, the runtime MUST [generate an error](#errors), stop the container, and continue the lifecycle at step 12. 5. The [`createContainer` hooks](config.md#createContainer-hooks) MUST be invoked by the runtime. If any `createContainer` hook fails, the runtime MUST [generate an error](#errors), stop the container, and continue the lifecycle at step 12. 6. Runtime's [`start`](runtime.md#start) command is invoked with the unique identifier of the container. 7. The [`startContainer` hooks](config.md#startContainer-hooks) MUST be invoked by the runtime. If any `startContainer` hook fails, the runtime MUST [generate an error](#errors), stop the container, and continue the lifecycle at step 12. 8. The runtime MUST run the user-specified program, as specified by [`process`](config.md#process). 9. The [`poststart` hooks](config.md#poststart) MUST be invoked by the runtime. If any `poststart` hook fails, the runtime MUST [log a warning](#warnings), but the remaining hooks and lifecycle continue as if the hook had succeeded. 10. The container process exits. This MAY happen due to erroring out, exiting, crashing or the runtime's [`kill`](runtime.md#kill) operation being invoked. 11. Runtime's [`delete`](runtime.md#delete) command is invoked with the unique identifier of the container. 12. The container MUST be destroyed by undoing the steps performed during create phase (step 2). 13. The [`poststop` hooks](config.md#poststop) MUST be invoked by the runtime. If any `poststop` hook fails, the runtime MUST [log a warning](#warnings), but the remaining hooks and lifecycle continue as if the hook had succeeded. ## Errors In cases where the specified operation generates an error, this specification does not mandate how, or even if, that error is returned or exposed to the user of an implementation. Unless otherwise stated, generating an error MUST leave the state of the environment as if the operation were never attempted - modulo any possible trivial ancillary changes such as logging. ## Warnings In cases where the specified operation logs a warning, this specification does not mandate how, or even if, that warning is returned or exposed to the user of an implementation. Unless otherwise stated, logging a warning does not change the flow of the operation; it MUST continue as if the warning had not been logged. ## Operations Unless otherwise stated, runtimes MUST support the following operations. Note: these operations are not specifying any command-line APIs, and the parameters are inputs for general operations. ### Query State `state ` This operation MUST [generate an error](#errors) if it is not provided the ID of a container. Attempting to query a container that does not exist MUST [generate an error](#errors). This operation MUST return the state of a container as specified in the [State](#state) section. ### Create `create ` This operation MUST [generate an error](#errors) if it is not provided a path to the bundle and the container ID to associate with the container. If the ID provided is not unique across all containers within the scope of the runtime, or is not valid in any other way, the implementation MUST [generate an error](#errors) and a new container MUST NOT be created. This operation MUST create a new container. All of the properties configured in [`config.json`](config.md) except for [`process`](config.md#process) MUST be applied. [`process.args`](config.md#process) MUST NOT be applied until triggered by the [`start`](#start) operation. The remaining `process` properties MAY be applied by this operation. If the runtime cannot apply a property as specified in the [configuration](config.md), it MUST [generate an error](#errors) and a new container MUST NOT be created. The runtime MAY validate `config.json` against this spec, either generically or with respect to the local system capabilities, before creating the container ([step 2](#lifecycle)). [Runtime callers](glossary.md#runtime-caller) who are interested in pre-create validation can run [bundle-validation tools](implementations.md#testing--tools) before invoking the create operation. Any changes made to the [`config.json`](config.md) file after this operation will not have an effect on the container. ### Start `start ` This operation MUST [generate an error](#errors) if it is not provided the container ID. Attempting to `start` a container that is not [`created`](#state) MUST have no effect on the container and MUST [generate an error](#errors). This operation MUST run the user-specified program as specified by [`process`](config.md#process). This operation MUST generate an error if `process` was not set. ### Kill `kill ` This operation MUST [generate an error](#errors) if it is not provided the container ID. Attempting to send a signal to a container that is neither [`created` nor `running`](#state) MUST have no effect on the container and MUST [generate an error](#errors). This operation MUST send the specified signal to the container process. ### Delete `delete ` This operation MUST [generate an error](#errors) if it is not provided the container ID. Attempting to `delete` a container that is not [`stopped`](#state) MUST have no effect on the container and MUST [generate an error](#errors). Deleting a container MUST delete the resources that were created during the `create` step. Note that resources associated with the container, but not created by this container, MUST NOT be deleted. Once a container is deleted its ID MAY be used by a subsequent container. ## Hooks Many of the operations specified in this specification have "hooks" that allow for additional actions to be taken before or after each operation. See [runtime configuration for hooks](./config.md#posix-platform-hooks) for more information. crun-1.16.1/libocispec/runtime-spec/README.md0000644000000000000000000001543514614670026016761 0ustar0000000000000000# Open Container Initiative Runtime Specification [![GitHub Actions status](https://github.com/opencontainers/runtime-spec/workflows/build/badge.svg)](https://github.com/opencontainers/runtime-spec/actions?query=workflow%3Abuild) The [Open Container Initiative][oci] develops specifications for standards on Operating System process and application containers. The specification can be found [here](spec.md). ## Table of Contents Additional documentation about how this group operates: - [Code of Conduct][code-of-conduct] - [Style and Conventions](style.md) - [Implementations](implementations.md) - [Releases](RELEASES.md) - [charter][charter] ## Use Cases To provide context for users the following section gives example use cases for each part of the spec. ### Application Bundle Builders Application bundle builders can create a [bundle](bundle.md) directory that includes all of the files required for launching an application as a container. The bundle contains an OCI [configuration file](config.md) where the builder can specify host-independent details such as [which executable to launch](config.md#process) and host-specific settings such as [mount](config.md#mounts) locations, [hook](config.md#posix-platform-hooks) paths, Linux [namespaces](config-linux.md#namespaces) and [cgroups](config-linux.md#control-groups). Because the configuration includes host-specific settings, application bundle directories copied between two hosts may require configuration adjustments. ### Hook Developers [Hook](config.md#posix-platform-hooks) developers can extend the functionality of an OCI-compliant runtime by hooking into a container's lifecycle with an external application. Example use cases include sophisticated network configuration, volume garbage collection, etc. ### Runtime Developers Runtime developers can build runtime implementations that run OCI-compliant bundles and container configuration, containing low-level OS and host-specific details, on a particular platform. ## Contributing Development happens on GitHub for the spec. Issues are used for bugs and actionable items and longer discussions can happen on the [mailing list](#mailing-list). The specification and code is licensed under the Apache 2.0 license found in the [LICENSE](./LICENSE) file. ### Discuss your design The project welcomes submissions, but please let everyone know what you are working on. Before undertaking a nontrivial change to this specification, send mail to the [mailing list](#mailing-list) to discuss what you plan to do. This gives everyone a chance to validate the design, helps prevent duplication of effort, and ensures that the idea fits. It also guarantees that the design is sound before code is written; a GitHub pull-request is not the place for high-level discussions. Typos and grammatical errors can go straight to a pull-request. When in doubt, start on the [mailing-list](#mailing-list). ### Meetings Please see the [OCI org repository README](https://github.com/opencontainers/org#meetings) for the most up-to-date information on OCI contributor and maintainer meeting schedules. You can also find links to meeting agendas and minutes for all prior meetings. ### Mailing List You can subscribe and join the mailing list on [Google Groups][dev-list]. ### Chat OCI discussion happens in the following chat rooms, which are all bridged together: - #general channel on [OCI Slack](https://opencontainers.org/community/overview/#chat) - #opencontainers:matrix.org ### Git commit #### Sign your work The sign-off is a simple line at the end of the explanation for the patch, which certifies that you wrote it or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify the below (from http://developercertificate.org): ``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 660 York Street, Suite 102, San Francisco, CA 94110 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` then you just add a line to every git commit message: Signed-off-by: Joe Smith using your real name (sorry, no pseudonyms or anonymous contributions.) You can add the sign off when creating the git commit via `git commit -s`. #### Commit Style Simple house-keeping for clean git history. Read more on [How to Write a Git Commit Message][how-to-git-commit] or the Discussion section of [git-commit(1)][git-commit.1]. 1. Separate the subject from body with a blank line 2. Limit the subject line to 50 characters 3. Capitalize the subject line 4. Do not end the subject line with a period 5. Use the imperative mood in the subject line 6. Wrap the body at 72 characters 7. Use the body to explain what and why vs. how * If there was important/useful/essential conversation or information, copy or include a reference 8. When possible, one keyword to scope the change in the subject (i.e. "README: ...", "runtime: ...") [charter]: https://github.com/opencontainers/tob/blob/master/CHARTER.md [code-of-conduct]: https://github.com/opencontainers/org/blob/master/CODE_OF_CONDUCT.md [dev-list]: https://groups.google.com/a/opencontainers.org/forum/#!forum/dev [how-to-git-commit]: http://chris.beams.io/posts/git-commit [iso-week]: https://en.wikipedia.org/wiki/ISO_week_date#Calculating_the_week_number_of_a_given_date [minutes]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/ [oci]: https://www.opencontainers.org [rfc5545]: https://tools.ietf.org/html/rfc5545 [runtime-wiki]: https://github.com/opencontainers/runtime-spec/wiki [uberconference]: https://www.uberconference.com/opencontainers [git-commit.1]: http://git-scm.com/docs/git-commit crun-1.16.1/libocispec/runtime-spec/CODEOWNERS0000644000000000000000000000016514614670026017067 0ustar0000000000000000* @AkihiroSuda @crosbymichael @cyphar @dqminh @giuseppe @hqhq @kolyshkin @mrunalp @thaJeztah @tianon @vbatts @utam0k crun-1.16.1/libocispec/runtime-spec/ChangeLog0000644000000000000000000010772014614670026017253 0ustar0000000000000000OpenContainers Specifications Changes with v1.2.0: Additions: * config: add idmap and ridmap mount options (#1222) * config.md: allow empty mappings for [r]idmap (#1224) * features-linux: Expose idmap information (#1219) * mount: Allow relative mount destinations on Linux (#1225) * features: add potentiallyUnsafeConfigAnnotations (#1205) * config: add support for org.opencontainers.image annotations #1197 Minor fixes: * config: improve bind mount and propagation doc (#1228) Documentation, CI & Governance: * fix link to hooks in features (#1226) * specs-go: add missing deprecation comment for Hooks.Prestart (#1232) * specs-go: mark LinuxMemory.Kernel as deprecated ()#1233) Changes with v1.1.0: Breaking changes (but rather conforms to the existing runc implementation): * config: change prestart hook spec to match reality (#1169) Deprecations: * config-linux: mark memory.kernel[TCP] as NOT RECOMMENDED (#1093) Additions: * cgroup: add cgroup v2 support (#1040) * seccomp: allow to override errno return code (#1041) * seccomp: Add support for SCMP_ACT_KILL_PROCESS (#1044) * Update seccomp architectures to support RISCV64 (#1059) * Add support for SCMP_ACT_KILL_THREAD (#1064) * Add Seccomp Notify support using UNIX sockets and container metadata (#1074) * config-linux: Add Intel RDT CMT and MBM Linux support (#1076) * seccomp: allow to override default errno return code (#1087) * Introduce zos as platform (#1095) * config-linux: add idle option for container cgroup (#1136) * config-linux: add CFS bandwidth burst (#1120) * IDMapping field for mount point (#1143) * schema: add cpu idle (#1145) * add domainname spec entity (#1156) * config-linux: add memory.checkBeforeUpdate (#1158) * seccomp: Add flag SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV (#1161) * config-linux: add support for rsvd hugetlb cgroup (#1116) * features: add `features.md` to formalize the `runc features` JSON (#1130) * config-linux: add support for time namespace (#1151) * config: add scheduler entity (#1188) * config: Add I/O Priority Configuration for process group in Linux Containers (#1191) Minor fixes: * seccomp: fix go-specs for errnoRet (#1042) * Define State for container and runtime namespace (#1045) * Add State status constants to spec-go (#1046) * config.go: make umask a pointer (#1058) * Update State structure to use the new ContainerState type (#1056) * Fix int64 and uint64 type value ranges (#1060) * Fix seccomp notify inconsistencies (#1096) * runtime should WARN / ignore capabilities that cannot be granted (#1094) * config-linux: clarify the handling of ClosID RDT parameter (#1104) * defs-zos: [Fix] prevent schema parsers from hitting recursion-loop while resolving types. (#1117) * fix the lifecycle reference in the states listing (#1118) * specify cgroup ownership semantics (#1123) * config-linux: MAY reject an unfit cgroup (#1125) * cgroup ownership: clarify that some files may not exist (#1137) * schema: update README.md (#1083) * schema: make with golang 1.16 (#1084) * Update Windows CPU comments (#1144) * specs-go: export LinuxBlockIODevice (#1103) * config-linux: update type of LinuxCPU.Idle to *int64 (#1146) * Add available LinuxSeccompFlags (#1138) * config-linux: clarify where device nodes can be created (#1148) * runtime: remove `When serialized in JSON, the format MUST adhere to the following pattern` (#1178) * config: clarify Linux mount options (#1181) * schema: fix schema for timeOffsets (#1193) * schema: remove duplicate keys (#1195) * config-linux: clarify I/O throttling differences between cgroup v1 and v2 (#1194) * releases: use +dev as in-development suffix (#1198) * features: update Example (#1204) * schema: fix definition for ioPriority (#1206) * features: add a note to avoid confusion about annotations (#1212) Documentation, CI & Governance: * MAINTAINERS: Add @cyphar as maintainer (#1043) * Add Giuseppe Scrivano as a runtime spec maintainer (#1048) * Remove superfluous 'an' (#1049) * docs: Added enclave OCI runtime rune to implementations (#1055) * Change all references from whitelist to allowlist (#1054) * MAINTAINERS: update vbatts email (#1065) * travis: fix go_import_path (#1072) * Makefile: Fix golint URL used in go get (#1075) * config-linux: fix personality link (#1086) * README: Fix broken link for charter (#1091) * add youki to implementations.md (#1126) * Switch to GitHub Actions, CODEOWNERS, etc. (#1128) * typo: seccompFD -> seccompFd (#1133) * fix RFC link (#1153) * maintainer updates as per #1101 (#1150) * GOVERNANCE: correct the Charter URL (#1157) * CODEOWNERS: sync with MAINTAINERS (#1160) * Update CI to Go 1.20 (#1179) * config-linux: fix url error (#1184) * config-linux: chore: Update `ociVersion` in example (#1199) * MAINTAINERS: add Toru Komatsu (utam0k) (#1201) * glossary: `s/features document/Features structure/g` (#1203) * CODEOWNER: Add Toru Komatsu(@utam0k) to sync with MAINTAINERS (#1207) * README.md: update chat information (#1210) * Remove outdated meeting.ics (#1211) Changes with v1.0.2: Additions: * Add create-container, create-runtime and start-container hooks (#1008) * config-linux: add Intel RDT CLOS name sharing support (#988) * config-linux: Add Intel RDT/MBA Linux support (#932) * config-linux: Add Memory cgroup's use_hierarchy (#985) * Add Linux personality support (#1012) * config: Add Windows Devices to Schema (#976) * Add support for SCMP_ACT_LOG (#1019) * config-linux: support seccomp flags (#1018) Minor fixes and documentation: * Makefile: avoid SELinux for making docs * Clarify case with pre-configured Intel RDT closID (#1034) * config-linux: describe more about rootfs mount propagation (#1035) * config-linux: add SHOULD to linux.namespaces.type (#1025) * Reduce DCO checks per PR from 3 to 1 (#1029) * Fix typo in RELEASES.md (#1033) * Remove some unneeded indent (#1031) * Add documentation how to do releases (#1027) * Removed Vishnu Kannan & Brandon Philips from maintainers (#1030 & #1028) * schema: drop id from umask (#1024) * implementations.md: fix repository for crun (#1017) * Update meeting info section to point to "org" repo (#1016) * Fix markdown escape in config-linux (#1013) * config-linux: add more info about hugetlb page size (#1011) * Fix ociVersion of Configuration Schema Example to support ambient capability (#1009) * Fix Namespaces to use LinuxNamespaceType (#1007) * change new pid namespace description (#1006) * updating link to code of conduct in org repository (#1001) * Update Windows LayerFolder docs (#999) * Windows:Have native CommandLine in Process (#998) * vm: fix parameters field (#994) * config-linux: documentation change for Intel RDT/MBA Software Controller support (#992) * Bump Go versions (#993) * Support for network namespace in windows (#989) * config: clarify source mount (#981) * Fix camelCasing on idType to align with other Windows spec conventions (#976) * meeting: Bump July meeting from the 4th to the 11th (#977) * docs: Added kata-runtime to implementations (#969) * Add gVisor to the implementations list (#970) * .travis.yml: Get schema dependencies in before_install (#968) * config: Clarify execution environment for hooks (#953) * config-linux: Drop console(4) reference (#965) * Linux devices: uid/gid relative to container (#959) * config: Add VM-based container configuration section (#949) * uidMappings: change order of fields for clarity (#956) * specs-go/config: Define RDMA cgroup (#942) * schema/Makefile: fix test (#947) * config: Fix Linux mount options links (#952) * glossary: Bump JSON spec to RFC 8259 (#951) * schema: Completely drop our JSON Schema 'id' properties (#945) * meeting: Bump January meeting from the 3rd to the 10th (#943) * config: add "umask" field to POSIX "user" section (#941) * schema: add allowed values for defaultAction (#940) * config: Dedent root paragraphs, since they aren't a list entry (#936) * fix the link to hook (#933) * config: Collapse extensibility to a single MUST (#916) * schema/defs-linux: change weight type to uint16 (#898) * runtime: Clarify ociVersion as based on the state schema (#903) Changes with v1.0.1: Minor fixes and documentation: * spec: Expand "OCI" in spec-title reference and add "Initiative" (#900) * config: Simplify title to "Configuration" (#901) * config: Fix "procfs_2" -> "proc_2" link label (#906) * config: Fix IEEE Std 1003.1-2008 exec link markup (#913) * config: Add a trailing period to the "cannot be mapped" rlimits line (#915) * config-linux: RFC 2119 MUST for absolute linux.namespaces[].path (#925). This is technically a breaking change, because a config with a relative namespace path would have been compliant before, but will be non compliant with this change. However, the previous "an absolute path to namespace file" wording was clear enough that config authors are unlikely to be relying on relative namespace paths in configs. * config-linux: More specific documentation for weightDevice and throttle* (#825) * config-linux: Modify procfs to proc (#905) * config-linux: Fix "psuedo" -> "pseudo" typo (#921) * config-windows: Make maximum a uint16 (was a uint) (#891) * runtime: Change "process in the container" -> "container process" (#907) * schema/config-schema: Use ArrayOfStrings in capabilities properties. (#886) * schema/config-linux: s/throttleWriteIopsDevice/throttleWriteIOPSDevice/ (#899) * schema/config-linux: add intelRdt field (#889) * schema/config-solaris: Replaced refs with some fields (cappedCPU.ncpus, etc.) (#892) Changes with v1.0.0: Breaking changes: * config: Shift disableOOMKiller from linux.resources to linux.resources.memory (#896) Decreased restrictions: * runtime: Make the state JSON's pid optional on non-Linux platforms (#897) Minor fixes and documentation: * schema/defs-linux: Require Syscall.action (#885) * specs-go/config: Fix 'omiempty' -> 'omitempty' typo for LinuxSeccompArg.ValueTwo (#884) * ROAMAP: remove the pre-v1.0.0 roadmap (#890) Changes with v1.0.0-rc6: Breaking changes: * config: Shift oomScoreAdj to process and add RFC 2119 requirements for the runtime (#781, #789, #836) * config: Forbid 'root' on Hyper-V (#820, #838). * config: process.capabilities and process.noNewPrivileges are Linux-only again (#880). This partially reverses #673, which had landed in v1.0.0-rc5. * config: Remove process.rlimits from Windows (#880). It is now POSIX-only, while in v1.0.0-rc5 it was cross-platform (because of #673). Before #673 (in v1.0.0-rc4 and earlier), it was Linux-only. * config-linux: Drop redundant 'blkio' prefix from blockIO properties (#860) * config-linux: Make memory limits int64 instead of uint64 (#876). This partially reverses #704, which had landed in v1.0.0-rc5. * config-windows: Change CPU 'percent' to 'maximum' (#777) * config-windows: Remove memory 'reservation' (#788) * config-windows: Remove 'resources.network' and add 'network' (#801) Additions: * config: Windows runtimes MUST support the 'ro' mount option (#868) * config-linux: Add Intel RDT/CAT Linux support (#630, #787) * config-linux: Add Markdown specification for syscalls (#706) * config-linux: Add 'unbindable' rootfsPropagation value (#770, #775) * config-windows: Add 'credentialSpec' (#814, #859) * config-windows: Add 'servicing' (#815) * config-windows: Add 'ignoreFlushesDuringBoot' (#816, #859) * config-windows: Add 'hyperv' (#818, #849, #859) * config-windows: Add 'layerFolders' (#828) Removals and increased restrictions: * config: Remove 'platform' (#850) * config: Require strictly-postitive 'timeout' values (#764) * config: Strengthen punt to kernel for valid capabilities strings (#766, #790) * config: Require volume GUID paths for root.path (#849) * config: Forbid setting 'readonly' true on Windows (#819) * config: Forbid setting mount 'type' entirely on Windows and forbid UNC paths and mapped drives in 'source' on Windows (#821) * config: Remove 'hooks' from Windows spec (#855, #869, #870) * config-linux: Clearly require absolute path for namespace (#720) * config-linux: RFC 2119 tightening for namespaces (#767) * config-linux: Require at least one entry in linux.seccomp.syscalls[].names (#769) * config-linux: Remove syscall.comment (#714) * config-linux: Use MUST and MAY for weight and leafWeight (#751) * config-linux: Remove explicit 'null' from device cgroup values (#804) * runtime: Remove "features the runtime chooses to support" (#732) * runtime: Drop "not supported by the base OS" loophole (#733) * runtime-linux: Condition /proc/self/fd symlinks on source existence (#736) Decreased restrictions: * config: Make 'process' optional (#701, #805) * config-linux: Make linux.seccomp.syscalls optional (#768) * config-linux: valueTwo is now optional in `linux.seccomp.syscalls[].args` entries (#877) * config-linux: Remove local range restrictions for blkioWeight, blkioLeafWeight, weight, leafWeight, and shares (#780) * config-linux: Explicitly allow symlinks for providing devices (#873) Minor fixes and documentation: * config: Remove "MAY support any valid values" sentence (#851) * config: Remove the previously-forbidden mounts[].type from the Windows spec (#854) * config: Clarify mounts[].source relative path anchor (#735) * config: Explicitly make consoleSize ignored if terminal is false or unset (#863) * config: Specify height/width units (characters) for consoleSize (#761) * config: Use "POSIX platforms" instead of "Linux and Solaris" (#838) * config-linux: Explicit namespace for interface names (#713) * config-linux: Explicitly list cgroupsPath as optional (#823) * runtime: Clarify valid container states for 'start', 'kill', and 'delete' (#875) * runtime: Explicitly make process.* timing implementation-defined (#700) * specs-go/config: Remove range restrictions from Windows comments (#783) * specs-go/config: Add omitempty to LinuxSyscall.Args (#763) * specs-go/config: Use a pointer for Process.ConsoleSize (#792) * schema/README: Use v1.0.0 URL in examples to prepare for the 1.0.0 release (#881) * schema/Makefile: Make 'validate' the default target (#750) * schema/Makefile: Add 'clean' target (#774) * schema: Add 'test' target to the Makefile (#785) * *: Remove unnecessary .PHONY entries (#750, #778, #802) * *: Typo fixes and polishing (#681, #708, #702, #703, #709, #711, #712, #721, #722, #723, #724, #730, #737, #738, #741, #744, #749, #753, #756, #765, #773, #776, #784, #786, #793, #794, #796, #798, #799, #800, #803, #807, #809, #811, #812, #822, #824, #826, #827, #832, #839, #840, #846, #847, #848, #852, #856, #858, #862, #865, #871, #874) Changes with v1.0.0-rc5: Breaking changes: * config: Explicitly require `platform` (#695). * config: The platform-specific sections (`linux`, `solaris`, and `windows`) MUST NOT be set unless they match `platform.os` (#673). * config: `process.capabilities` is now an object instead of an array of strings (#675). * config-linux: No longer allow negative values for some resources, partially reversing #648 from v1.0.0-rc4 (#704). * config-linux: `linux.seccomp.syscalls` entries have `names` instead of `name` (#657). * runtime: Rename the state `bundlePath` property to `bundle` (#674). Additions: * config: `process.capabilities` is no longer Linux-only (#673). * config-linux: `linux.seccomp.syscalls` entries have a new `comment` property (#657). * config-linux: Add new architectures from libseccomp 2.3.2 (#705) * runtime: Add a `creating` state `status` (#507, #694). Removals and increased restrictions: * runtime: Document hook timing and exit code handling (#532). * schema/config-linux: Explicit `null` values are no longer compliant (#662). Decreased restrictions: * config: `type` and `source` properties are now optional for `mounts` entries (#699). * config: `args` property is now optional for hooks (#685). * config-linux: Runtimes no longer need to provide `/proc` and other filesystems unless they are explicitly requested in the configuration JSON (#666). Minor fixes and documentation: * spec: Add OCI Runtime Abstract (#691). * config: Document the Go `platform` tag (#570). * config-linux: Remove local uid/gid mapping limit and punt to the kernel (#693). * schema: Fix broken `string` and similar `$ref`s (#684). * schema: Remove `mounts` from required properties (#696). * schema: Remove `major` and `minor` from `linux.devices` entries (#688). * schema: Check for the required `type`, `hard`, and `soft` in `process.rlimits` entries (#696). * schema/validate: Gained usage documentation and fixed `schemaPath` logic when the argument did not contain `://` (#552). * *: Add anchor tags to a number of spec locations (#707). * *: Consistent link syntax (#687). * *: Minor cleanup and rewording (#697). Changes with v1.0.0-rc4: Additions: * config-linux: Allow negative values for some resources (#648) * config-linux: Lift no-tweaking namespace restriction (#649) Removals and increased restrictions: * config: Rlimit types must be unique (#607) * config: Forbid empty-string keys in 'annotations' (#645, #654) * config-linux: Require runtime errors for pre-existing devices (#647) * runtime: Only require 'pid' in the state for created/running statuses (#664) * schema: Add 'consoleSize' and update requirements (#646) * schema: Remove string pointers (#656) * schema/config-linux: Remove blockIODeviceThrottle and other pointers (#545) Breaking Go changes: * specs-go/config: Remove string pointers (#653) * specs-go/config: Make Spec.Hooks a pointer (#427) * specs-go/config: Convert some resources from unsigned integers to signed integers (#648) Minor fixes and documentation: * config: Explicitly list 'hooks' as optional and cite POSIX for 'env' and 'args' (#427) * runtime: Replace "process is stopped" with "process exits" (#465) * schema/config-linux: Add missing kernelTCP (#655) * schema/validate: Allow schema identifiers to contain a URL scheme (#490) * .travis: Fix git-validation commit ranges (#216) * *: Add anchor tags to a number of spec locations (#612, #636, #637, #638, #639, #640) * *: Typo fixes and polishing (#643, #650, #652, #656, #660, #665) Changes with v1.0.0-rc3: Additions: * config: Add support for Windows-based containers (#565, #573) * config: Add process.consoleSize (#563) * config: Explicitly allow unknown extensions and document annotations key conventions (#510) * config: Define mounts entries for Solaris (#588) Removals and increased restrictions: * config: Require absolute paths for mount destinations (#609) * config-linux: Require absolute path for maskedPaths and readonlyPaths (#587) * config-linux: Only require /dev/console when process.terminal is true. Also require /dev/console to be provided by a bind mount (#518) * runtime: Require runtimes to generate errors when the container specified in config.json cannot be created (#559) Breaking Go changes: * specs-go/config: Aggressive namespacing (#567) * specs-go/config: Remove pointers from LinuxHugepageLimit, LinuxInterfacePriority, and LinuxPids properties (#586) * specs-go/state: Rename version to ociVersion (#633) LinuxInterfacePriority, and LinuxPids properties (#586) Minor fixes and documentation: * spec: Separate the spec from project scaffolding (#626) * README: Define "unspecified", "undefined", and "implementation-defined" (#575) * config: Clarify absolue and relative values for root.path (#558) * config: Clarify ociVersion covering the configuration <-> runtime API (#523) * config-linux: Forbid duplicated namespaces with same `type` (#597) * glossary: Make objects explicitly unordered and forbid duplicate names (#584) * specs-go/config: Add platform tags to Rlimits and NoNewPRivileges (#564) * schema/defs-linux: Use int64 for major/minor types (#610) * Makefile: Add support for Go 1.7 (#547) * Makefile: Require Go >= 1.6 for golint (#589) * Makefile: Use a POSIX-compatible test ('==' -> '=') (#542) * implementations: Rename ocitools -> runtime-tools (#585) * *: Typo fixes and polishing (#556, #566, #568, #569, #571, #572, #574, #595, #596, #599, #600, #601, #603, #605, #608, #613, #617, #619, #621, #622, #623, #624, #625, #627, #629) Changes with v1.0.0-rc2: Additions: * config-linux: Add new architectures from libseccomp 2.3.0 (#505) * schema: Add JSON Schema for state JSON and move schema.json to config-schema.json and similar (#481, #498, #519) Minor fixes and documentation: * Add compliance language for platforms and architectures (#527) * Remove "unconditionally compliant" language (#553) * bundle: Remove distribution references (#487) * runtime: Fix sub-bullet indentation (#495) * config: Replace Arch fstab reference with mount(8) (#443) * config: Synchronize comments between Markdown and Go (#525) * config: Drop v0.x compatibility statement (#488) * config-linux: RFC 2119 wording for cgroupsPath (#493) * config-linux: Make linux.devices and linux.resources.devices optional (#526) * config-linux: Extend no-tweak requirement to runtime namespaces (#538) * schema: Add hook.timeout (#544) * schema: Add missing '"type": "object"' (#528) * schema: Run 'make fmt' and remove duplicates (#546, #551) * schema/config: Make 'hostname' optional (#491) * schema/config-linux: Add linux.resources.devices (#550) * specs-go/config: Add Solaris tags to User properties (#496) * specs-go/config: Make Linux and Solaris omitempty again (#502) * specs-go/config: Make KernelTCP and ClassID omitempty (#531) * specs-go/config: Fix "specified" typo for ApparmorProfile (#503) * Makefile: Remove code-of-conduct.md and version.md when clean (#541) * implementations: Mention cc-oci-runtime (#539) * Use filesystem instead of file system (#529) * .pullapprove: Add DCO check via PullApprove * GOVERNANCE: Add governance and release process docs (#521) * README: Change meeting time from 10am to 2pm Pacific (#524) * README: Update conference-call phone number (#512, #515) Changes with v1.0.0-rc1: Breaking changes: * runtime: Split create and start, #384, #450, #463, #464, #467, #468 * runtime: Remove exec, #388 * runtime: Enviroment MUST match the configuration, #397 * config: Runtime MUST generate errors for unsupported platforms, #441 * config: Windows mount destinations MUST NOT be nested, #437 Additions: * solaris: Added platform-specific configuration, #411, #424, #431, #436 * runtime: Add 'annotations' and 'status' to the state structure, #462, #484, #485 * runtime: State no longer needs to be serialized as JSON, #446 * runtime-linux: Add /dev symbolic links, #449 * config: Allow absolute paths for root.path (which previously required relative paths), #394 * config-linux: Add linux.mountLabel, #393 * config-linux: Add suport for cgroup namespace, #397 * config-linux: Runtime SHOULD NOT modify ownership of any referenced filesystem (previously the restriction only applied to the root filesystem), #452 * specs-go/seccomp: Add ppc and s390x to specs-go/config.go, #475 Minor fixes and documentation: * README: Add project.md to the Table of Contents, #376 * README: Consistenly indent the Table of Contents, #400 * README: Link to LICENSE, #442 * README: Weekly call is OCI-wide, #378 * config: Explicit runtime namespace for hooks, #415 * config: Explicit container namespace for uid, gid, and additionalGids, #412 * config: Fix 'string' -> 'array of strings' typo for process.args, #416 * runtime: The runtime MAY validate config.json, #418 * runtime: Move errors section out of operations, #445 * runtime: MAY -> SHOULD for post-stop error logging, #410 * schema/README: Document JSON Schema usage, #360, #385 * schema: Minor description updates, #456, #461 * schema/validate: Support reading documents via stdin, #482 * .pullapprove: Automate review approval, #458, #474 * .gitignore: Hide more auto-generated files, #386, #392 * .travis: git-validation detects Travis now, #366 * .travis: Regress on failure to produce docs, #479 * Makefile: Filename docs.* -> oci-runtime-spec.*, #478 * Makefile: Add install.tools target, #349 * Makefile: Allow native pandoc implementations, #428, #448 * Makefile: Prefer Bash, #455 * Makefile: Travis support for .gitvalidation, #422 * specs-go/config: Add missing omitempties for Process.Terminal, Root.Readonly, Spec.Linux, and Spec.Mounts, #408, #429, #430, #431 * specs-go/config: Remove incorrect omitempties for User.UID and User.GID, #425 * specs-go/config: Drop platform-independent comment, #451 * version: Include version in generated documentation, #406 * *: Anchor examples, #348 * *: Fix remnants from SelinuxProcessLabel to SelinuxLabel rename, #396 * *: Outsource code-of-conduct to TOB repository, #375, #413 * *: RFC 2119 consistency, #407, #409, #438, #444, #449 * *: Typo fixes, #390, #401 * *: Whitespace fixes and validation, #380, #381, #426 * ROADMAP: Remove stale targets, #435 Changes with v0.5.0: Breaking changes: * specs-go: Renamed the repository from opencontainers/specs to opencontainers/runtime-spec, #365 Additions: * config: Add 'timeout' for hooks, #346 * config-linux: Add 'maskedPaths' and 'readonlyPaths', #364 Minor fixes and documentation: * JSON Schema bug-fixes and improved examples, #370 * README: Define "unconditionally compliant", #374 * config: Make Markdown canonical, #342 * config: Explicitly list mapping from symbolic names to UID/GIDs as out-of-scope, #347 * config-linux: Require the runtime mount namespace for namespace 'path' values, #275 * config-linux: Reword kernelTCP docs, #377 * specs-go: Add omitempty to 'Device' and 'Namespace', #340 * .travis.yml: Use built-in 'go vet' and current 'go lint', dropping Go < 1.5, #372, #352 * implementations: Expand ocitools scope to include testing, #328 * style: Move one-sentence-per-line rule from the README, #369 * style: Remove dangling parenthesis, #359 * README: Add a link to the IRC logs, #358 * Fix "manadate", "exmaple", "paramters", and "preferrably" typos, #353, #354 Changes with v0.4.0: Breaking changes: * config: Move capabilities, selinuxProcessLabel, apparmorProfile, and noNewPrivileges from the linux setting to the process setting and make them optional, renaming selinuxProcessLabel to selinuxLabel, #329, #330, #339 * runtime: Rename version to ociVerison in the state JSON, #225 * runtime: Remove the directory requirement for storing state, now that there is a 'state' operation, #225, #334 * go: Shift *.go to specs-go/*.go, #276 * config: Move rlimits to process, #341 * go: Move config_linux.go content into config.go, removing LinuxSpec, #310 Additions: * schema: Add JSON Schema (and validator) for `config.json`, #313 * config: Add annotations for opaque-to-the-runtime data, #331 * config-linux: Make seccomp optional, #333 * runtime: Added additional operations: state, stop, and exec. #225 Minor fixes and documentation: * config-linux: Change mount type from *rune to *string and fix octal fileMode examples, #323 * runtime: RFC 2119 phrasing for the lifecycle, #225 * README: Add a full example of config.json, #276 * README: Replace BlueJeans with UberConference, #326, #338 * style: Document Go-pointer exceptions, #317 Changes with v0.3.0: Breaking changes: * config: Single, unified config file, #284 * config: cwd is a required default, and must be absolute, #286, #307, #308, #312 * config: qualify the name of the version field, #309 * config-linux: Convert classID from hex to uint32, #296 * config-linux: Separate mknod from cgroups, #298 Additions: * config-linux: Add NoNewPrivileges setting for linux, #290 Minor fixes and documentation: * config-linux: clarify oom_score_adj, #236, #292 * config-linux: Update links to cgroups documentation, #318 * config-linux: Remove pointers for slices preferring omitempty tag instead, #316 * README: add runtime, bundle, and hook author user, #280 * ROADMAP: reshuffled and split into GitHub issues, #300, #301, #304, #306 * style: Collect established styles in a discoverable location, #287, #311 Changes with v0.2.0: * Add Apparmor, Selinux and Seccomp * Add Apparmor, Selinux and Seccomp sections * Add bind mount example * Add fd section for linux container process * Add Go types for specification * *: adding a code of conduct * Adding cgroups path to the Spec. * .: Adding listing of implementations * .: adding travis file for future CI * Add license and DCO information for contributions * Add linux spec description * Add MAINTAINERS file * Add memory swappiness to linux spec * Add runtime state configuration and structs * Adds a section for user namespace mappings * Adds link to kernel cgroups documentation * Adds section for Linux Rlimits * Adds section for Linux Sysctl. * Adds user namespace to the list of namespaces * bundle: add initial run use case * bundle: Fix 'and any number of and other related' typo * bundle.md: clarify arbitrary/conventional dirnames * bundle.md: fix link formatting * bundle.md: fix off-by-one error * bundle.md: various updates to latest spec * bundle: Move 'Linux sysctl' header to its own line * Change commiter to committer * Change Device field order in spec_linux.go, 'Path' should be top of the 'Type' field, according to the different of the config-linux.md, 'Path' field is the unique key. * Change layout of mountpoints and mounts * Change the rlimit type to string instead of int * Clarify behavior around namespaces paths. * config: Add example additionalGids * config: Add example cwd * config: cleanup language on readonly parameter * config: fix links to go files * config-linux: specify the default devices/filesystems available * config.md: clarify destination for mounts * config.md: make the version a semver * config.md: make the version field example a semver * config.md: minor clean up of process specification * config.md: reformat into a standard style * config.md: update links to spec schema code * config.md: various cleanup/consistency fixes * config: minor cleanup * Deduplicate the field of RootfsPropagation * Define constants for Linux Namespace names * Fix LinuxRuntime field * Fix root object keys * Fix typos in config.md * Fix typos in the "Namespace types" section * Fix typos in the rlimits section * Fix Windows path escaping in example mount JSON * JSON objects are easier to parse/manipulate * made repo public. Added warning in README * Make namespaces match runc * make rootfs mount propagation mode settable * Makes namespaces description linux specific * *.md: markdown formatting * Modify the capabilities constants to match header files like other constants * Move linux specific options to linux spec * README: add a rule for paragraph formatting in markdown * README: Document BlueJeans and wiki archive for meetings * README: Document pre-meeting agenda alteration * README: Document YouTube and IRC backchannel for meetings * README: Focus on local runtime (create/start/stop) * README.md: Add a git commit style guide * README.md: contribution about discussion * README: releases section * README: Remove blank line from infrastructure-agnostic paragraph * removed boilerplate file * *: remove superfluous comma in code-of-conduct * Remove trailing whitespace * Rename SystemProperties to Sysctl * Rename the header "Access to devices" to "Devices" to fit with the config * *: re-org the spec * Replace Linux.Device with more specific config * restore formatting * Return golang compliant names for UID and GID in User * Return golint-compliant naming for mappings * runtime: Add prestart/poststop hooks * runtime_config: comments for golint * runtime-config-linux: Drop 'Linux' from headers * runtime_config_linux: Fix 'LinuxSpec' -> 'LinuxRuntimeSpec' in comment * runtime-config-linux: One sentence per line for opening two paragraphs * runtime-config: Remove blank lines from the end of files * runtime-config: Remove 'destination' docs from mounts * runtime.md: convert oc to runc * runtime: use opencontainer vs oci * *: small spelling fixes * Specific platform specific user struct for spec * spec: linux: add support for the PIDs cgroup * spec_linux: conform to `golint` * spec_linux.go: Rename IDMapping fields to follow syscall.SysProcIDMap * spec_linux: remove ending periods on one-line comments * spec: rename ocp to oci and add a link * specs: add json notation * specs: align the ascii graph * specs: fix the description for the [ug]idMappings * specs: introduce the concept of a runtime.json * .tools: cleanup the commit entry * .tools: repo validation tool * travis: fix DCO validation for merges * typo: containers -> container's * typo: the -> for * Update config-linux for better formatting on values * Update README.md * Update readme with weekly call and mailing list * Update runtime.md * Update runtime.md * Update runtime.md * version: more explicit version for comparison Changes with v0.1.0: * Add Architecture field to Seccomp configuration in Linux runtime * Add @hqhq as maintainer * Add hyphen for host specific * Adding Vishnu Kannan as a Maintainer. * Add initial roadmap * Add lifecycle for containers * Add oom_score_adj to the runtime Spec. * Add post-start hooks * Add Seccomp constants to description of Linux runtime spec * Add Seccomp constants to Linux runtime config * Add some clarity around the state.json file * adds text describing the upper-case keywords used in the spec * add testing framework to ROADMAP * Appropriately mark optional fields as omitempty * cgroup: Add support for memory.kmem.tcp.limit_in_bytes * Change HugepageLimit.Limit type to uint64 * Change the behavior when cgroupsPath is absent * Change version from 0.1.0 to 0.2.0 * Clarify the semantics of hook elements * Cleanup bundle.md * Cleanup principles * config: linux: update description of PidsLimit * config: Require a new UTS namespace for config.json's hostname * config: Require the runtime to mount Spec.Mounts in order * convert **name** to **`name`** * Example lists "root' but text mentions "bundlePath" * Fix an extra space in VersionMinor * Fix golint warnings * Fix typo in BlockIO struct comment * Fix typo in Filesystem Bundle * Fix value of swappiness * glossary: Provide a quick overview of important terms * glossary: Specify UTF-8 for all our JSON * hooks: deduplicate the hooks docs * implementations: Link to kunalkushwaha/octool * implementations: Link to mrunalp/ocitools * lifecycle: Don't require /run/opencontainer//containers * lifecycle: Mention runtime.json * lifecycle: no hypens * MAINTAINERS: add tianon per the charter * MAINTAINERS: correct Vish's github account * Makefile: Add glossary to DOC_FILES * Make optional Cgroup related config params pointers along with `omitempty` json tag. * Mark RootfsPropagation as omitempty * *.md: update TOC and links * move the description of Rlimits before example * move the description of user ns mapping to proper file * principles: Give principles their own home * *: printable documents * Project: document release process * README: Fix some headers * README: make header more concise * remove blank char from blank line * Remove the unneeded build tag from the config_linux.go * Remove trailing comma in hooks json example * Rename State's Root to Bundle * ROADMAP.md: remove the tail spaces * roadmap: update links and add wiki reference * runtime: Add 'version' to the state.json example * runtime-config: add example label before json example * runtime-config: add section about Hooks * runtime: config: linux: add cgroups information * runtime: config: linux: Edit BlockIO struct * runtime: config: linux: Fix typo and trailing commas in json example * runtime_config_linux.go: add missing pointer * runtime-config-linux.md: fix the type of cpus and mems * runtime.md: fix spacing * Talk about host specific/independent instead of mutability * .tools: commit validator is a separate project * .tools: make GetFetchHeadCommit do what it says * .travis.yml: add go 1.5.1, update from 1.4.2 to 1.4.3 * Update readme with wiki link to minutes * Update Typo in ROADMAP.md * Use unsigned for IDs * version: introduce a string for dev indication crun-1.16.1/libocispec/runtime-spec/.git0000664000000000000000000000007313677106243016263 0ustar0000000000000000gitdir: ../../.git/modules/libocispec/modules/runtime-spec crun-1.16.1/libocispec/runtime-spec/Makefile0000644000000000000000000000523014416051456017132 0ustar0000000000000000 EPOCH_TEST_COMMIT := 78e6667ae2d67aad100b28ee9580b41b7a24e667 OUTPUT_DIRNAME ?= output DOC_FILENAME ?= oci-runtime-spec DOCKER ?= $(shell command -v docker 2>/dev/null) PANDOC ?= $(shell command -v pandoc 2>/dev/null) PANDOC_IMAGE ?= ghcr.io/opencontainers/pandoc:2.9.2.1-9.fc34.x86_64@sha256:590c5c7aaa6e8e7a4debae7e9102c837daa0c8a76f8f5b5c9831ea5f755e3e95 ifeq "$(strip $(PANDOC))" '' ifneq "$(strip $(DOCKER))" '' PANDOC = $(DOCKER) run \ --security-opt label=disable \ --rm \ -v $(shell pwd)/:/input/:ro \ -v $(shell pwd)/$(OUTPUT_DIRNAME)/:/$(OUTPUT_DIRNAME)/ \ -u $(shell id -u) \ $(PANDOC_IMAGE) PANDOC_SRC := /input/ PANDOC_DST := / endif endif # These docs are in an order that determines how they show up in the PDF/HTML docs. DOC_FILES := \ version.md \ spec.md \ principles.md \ bundle.md \ runtime.md \ runtime-linux.md \ config.md \ config-linux.md \ config-solaris.md \ features.md \ features-linux.md \ glossary.md default: docs docs: $(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf $(OUTPUT_DIRNAME)/$(DOC_FILENAME).html ifeq "$(strip $(PANDOC))" '' $(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf $(OUTPUT_DIRNAME)/$(DOC_FILENAME).html: $(error cannot build $@ without either pandoc or docker) else $(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf: $(DOC_FILES) mkdir -p $(OUTPUT_DIRNAME)/ && \ $(PANDOC) -f markdown_github -t latex -o $(PANDOC_DST)$@ $(patsubst %,$(PANDOC_SRC)%,$(DOC_FILES)) $(OUTPUT_DIRNAME)/$(DOC_FILENAME).html: $(DOC_FILES) mkdir -p $(OUTPUT_DIRNAME)/ && \ $(PANDOC) -f markdown_github -t html5 -o $(PANDOC_DST)$@ $(patsubst %,$(PANDOC_SRC)%,$(DOC_FILES)) endif version.md: ./specs-go/version.go go run ./.tool/version-doc.go > $@ HOST_GOLANG_VERSION = $(shell go version | cut -d ' ' -f3 | cut -c 3-) # this variable is used like a function. First arg is the minimum version, Second arg is the version to be checked. ALLOWED_GO_VERSION = $(shell test '$(shell /bin/echo -e "$(1)\n$(2)" | sort -V | head -n1)' = '$(1)' && echo 'true') test: .govet .golint .gitvalidation .govet: go vet -x ./... # When this is running in GitHub, it will only check the GitHub commit range .gitvalidation: @which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false) ifdef GITHUB_SHA git-validation -q -run DCO,short-subject,dangling-whitespace -range $(GITHUB_SHA)..HEAD else git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD endif install.tools: .install.gitvalidation .install.gitvalidation: go install github.com/vbatts/git-validation@v1.2.0 clean: rm -rf $(OUTPUT_DIRNAME) *~ rm -f version.md crun-1.16.1/libocispec/runtime-spec/config.md0000644000000000000000000015456214614670026017276 0ustar0000000000000000# Configuration This configuration file contains metadata necessary to implement [standard operations](runtime.md#operations) against the container. This includes the process to run, environment variables to inject, sandboxing features to use, etc. The canonical schema is defined in this document, but there is a JSON Schema in [`schema/config-schema.json`](schema/config-schema.json) and Go bindings in [`specs-go/config.go`](specs-go/config.go). [Platform](spec.md#platforms)-specific configuration schema are defined in the [platform-specific documents](#platform-specific-configuration) linked below. For properties that are only defined for some [platforms](spec.md#platforms), the Go property has a `platform` tag listing those protocols (e.g. `platform:"linux,solaris"`). Below is a detailed description of each field defined in the configuration format and valid values are specified. Platform-specific fields are identified as such. For all platform-specific configuration values, the scope defined below in the [Platform-specific configuration](#platform-specific-configuration) section applies. ## Specification version * **`ociVersion`** (string, REQUIRED) MUST be in [SemVer v2.0.0][semver-v2.0.0] format and specifies the version of the Open Container Initiative Runtime Specification with which the bundle complies. The Open Container Initiative Runtime Specification follows semantic versioning and retains forward and backward compatibility within major versions. For example, if a configuration is compliant with version 1.1 of this specification, it is compatible with all runtimes that support any 1.1 or later release of this specification, but is not compatible with a runtime that supports 1.0 and not 1.1. ### Example ```json "ociVersion": "0.1.0" ``` ## Root **`root`** (object, OPTIONAL) specifies the container's root filesystem. On Windows, for Windows Server Containers, this field is REQUIRED. For [Hyper-V Containers](config-windows.md#hyperv), this field MUST NOT be set. On all other platforms, this field is REQUIRED. * **`path`** (string, REQUIRED) Specifies the path to the root filesystem for the container. * On Windows, `path` MUST be a [volume GUID path][naming-a-volume]. * On POSIX platforms, `path` is either an absolute path or a relative path to the bundle. For example, with a bundle at `/to/bundle` and a root filesystem at `/to/bundle/rootfs`, the `path` value can be either `/to/bundle/rootfs` or `rootfs`. The value SHOULD be the conventional `rootfs`. A directory MUST exist at the path declared by the field. * **`readonly`** (bool, OPTIONAL) If true then the root filesystem MUST be read-only inside the container, defaults to false. * On Windows, this field MUST be omitted or false. ### Example (POSIX platforms) ```json "root": { "path": "rootfs", "readonly": true } ``` ### Example (Windows) ```json "root": { "path": "\\\\?\\Volume{ec84d99e-3f02-11e7-ac6c-00155d7682cf}\\" } ``` ## Mounts **`mounts`** (array of objects, OPTIONAL) specifies additional mounts beyond [`root`](#root). The runtime MUST mount entries in the listed order. For Linux, the parameters are as documented in [mount(2)][mount.2] system call man page. For Solaris, the mount entry corresponds to the 'fs' resource in the [zonecfg(1M)][zonecfg.1m] man page. * **`destination`** (string, REQUIRED) Destination of mount point: path inside container. * Linux: This value SHOULD be an absolute path. For compatibility with old tools and configurations, it MAY be a relative path, in which case it MUST be interpreted as relative to "/". Relative paths are **deprecated**. * Windows: This value MUST be an absolute path. One mount destination MUST NOT be nested within another mount (e.g., c:\\foo and c:\\foo\\bar). * Solaris: This value MUST be an absolute path. Corresponds to "dir" of the fs resource in [zonecfg(1M)][zonecfg.1m]. * For all other platforms: This value MUST be an absolute path. * **`source`** (string, OPTIONAL) A device name, but can also be a file or directory name for bind mounts or a dummy. Path values for bind mounts are either absolute or relative to the bundle. A mount is a bind mount if it has either `bind` or `rbind` in the options. * Windows: a local directory on the filesystem of the container host. UNC paths and mapped drives are not supported. * Solaris: corresponds to "special" of the fs resource in [zonecfg(1M)][zonecfg.1m]. * **`options`** (array of strings, OPTIONAL) Mount options of the filesystem to be used. * Linux: See [Linux mount options](#configLinuxMountOptions) below. * Solaris: corresponds to "options" of the fs resource in [zonecfg(1M)][zonecfg.1m]. * Windows: runtimes MUST support `ro`, mounting the filesystem read-only when `ro` is given. ### Linux mount options Runtimes MUST/SHOULD/MAY implement the following option strings for Linux: Option name | Requirement | Description ------------------|-------------|----------------------------------------------------- `async` | MUST | [^1] `atime` | MUST | [^1] `bind` | MUST | Bind mount [^2] `defaults` | MUST | [^1] `dev` | MUST | [^1] `diratime` | MUST | [^1] `dirsync` | MUST | [^1] `exec` | MUST | [^1] `iversion` | MUST | [^1] `lazytime` | MUST | [^1] `loud` | MUST | [^1] `mand` | MAY | [^1] (Deprecated in kernel 5.15, util-linux 2.38) `noatime` | MUST | [^1] `nodev` | MUST | [^1] `nodiratime` | MUST | [^1] `noexec` | MUST | [^1] `noiversion` | MUST | [^1] `nolazytime` | MUST | [^1] `nomand` | MAY | [^1] `norelatime` | MUST | [^1] `nostrictatime` | MUST | [^1] `nosuid` | MUST | [^1] `nosymfollow` | SHOULD | [^1] (Introduced in kernel 5.10, util-linux 2.38) `private` | MUST | Bind mount propagation [^2] `ratime` | SHOULD | Recursive `atime` [^3] `rbind` | MUST | Recursive bind mount [^2] `rdev` | SHOULD | Recursive `dev` [^3] `rdiratime` | SHOULD | Recursive `diratime` [^3] `relatime` | MUST | [^1] `remount` | MUST | [^1] `rexec` | SHOULD | Recursive `dev` [^3] `rnoatime` | SHOULD | Recursive `noatime` [^3] `rnodiratime` | SHOULD | Recursive `nodiratime` [^3] `rnoexec` | SHOULD | Recursive `noexec` [^3] `rnorelatime` | SHOULD | Recursive `norelatime` [^3] `rnostrictatime` | SHOULD | Recursive `nostrictatime` [^3] `rnosuid` | SHOULD | Recursive `nosuid` [^3] `rnosymfollow` | SHOULD | Recursive `nosymfollow` [^3] `ro` | MUST | [^1] `rprivate` | MUST | Bind mount propagation [^2] `rrelatime ` | SHOULD | Recursive `relatime` [^3] `rro` | SHOULD | Recursive `ro` [^3] `rrw` | SHOULD | Recursive `rw` [^3] `rshared` | MUST | Bind mount propagation [^2] `rslave` | MUST | Bind mount propagation [^2] `rstrictatime` | SHOULD | Recursive `strictatime` [^3] `rsuid` | SHOULD | Recursive `suid` [^3] `rsymfollow` | SHOULD | Recursive `symfollow` [^3] `runbindable` | MUST | Bind mount propagation [^2] `rw` | MUST | [^1] `shared` | MUST | [^1] `silent` | MUST | [^1] `slave` | MUST | Bind mount propagation [^2] `strictatime` | MUST | [^1] `suid` | MUST | [^1] `symfollow` | SHOULD | Opposite of `nosymfollow` `sync` | MUST | [^1] `tmpcopyup` | MAY | copy up the contents to a tmpfs `unbindable` | MUST | Bind mount propagation [^2] `idmap` | SHOULD | Indicates that the mount MUST have an idmapping applied. This option SHOULD NOT be passed to the underlying [`mount(2)`][mount.2] call. If `uidMappings` or `gidMappings` are specified for the mount, the runtime MUST use those values for the mount's mapping. If they are not specified, the runtime MAY use the container's user namespace mapping, otherwise an [error MUST be returned](runtime.md#errors). If there are no `uidMappings` and `gidMappings` specified and the container isn't using user namespaces, an [error MUST be returned](runtime.md#errors). This SHOULD be implemented using [`mount_setattr(MOUNT_ATTR_IDMAP)`][mount_setattr.2], available since Linux 5.12. `ridmap` | SHOULD | Indicates that the mount MUST have an idmapping applied, and the mapping is applied recursively [^3]. This option SHOULD NOT be passed to the underlying [`mount(2)`][mount.2] call. If `uidMappings` or `gidMappings` are specified for the mount, the runtime MUST use those values for the mount's mapping. If they are not specified, the runtime MAY use the container's user namespace mapping, otherwise an [error MUST be returned](runtime.md#errors). If there are no `uidMappings` and `gidMappings` specified and the container isn't using user namespaces, an [error MUST be returned](runtime.md#errors). This SHOULD be implemented using [`mount_setattr(MOUNT_ATTR_IDMAP)`][mount_setattr.2], available since Linux 5.12. [^1]: Corresponds to [`mount(8)` (filesystem-independent)][mount.8-filesystem-independent]. [^2]: Corresponds to [bind mounts and shared subtrees][mount-bind]. [^3]: These `AT_RECURSIVE` options need kernel 5.12 or later. See [`mount_setattr(2)`][mount_setattr.2] The "MUST" options correspond to [`mount(8)`][mount.8]. Runtimes MAY also implement custom option strings that are not listed in the table above. If a custom option string is already recognized by [`mount(8)`][mount.8], the runtime SHOULD follow the behavior of [`mount(8)`][mount.8]. Runtimes SHOULD treat unknown options as [filesystem-specific ones][mount.8-filesystem-specific]) and pass those as a comma-separated string to the fifth (`const void *data`) argument of [`mount(2)`][mount.2]. ### Example (Windows) ```json "mounts": [ { "destination": "C:\\folder-inside-container", "source": "C:\\folder-on-host", "options": ["ro"] } ] ``` ### POSIX-platform Mounts For POSIX platforms the `mounts` structure has the following fields: * **`type`** (string, OPTIONAL) The type of the filesystem to be mounted. * Linux: filesystem types supported by the kernel as listed in */proc/filesystems* (e.g., "minix", "ext2", "ext3", "jfs", "xfs", "reiserfs", "msdos", "proc", "nfs", "iso9660"). For bind mounts (when `options` include either `bind` or `rbind`), the type is a dummy, often "none" (not listed in */proc/filesystems*). * Solaris: corresponds to "type" of the fs resource in [zonecfg(1M)][zonecfg.1m]. * **`uidMappings`** (array of type LinuxIDMapping, OPTIONAL) The mapping to convert UIDs from the source file system to the destination mount point. This SHOULD be implemented using [`mount_setattr(MOUNT_ATTR_IDMAP)`][mount_setattr.2], available since Linux 5.12. If specified, the `options` field of the `mounts` structure SHOULD contain either `idmap` or `ridmap` to specify whether the mapping should be applied recursively for `rbind` mounts, as well as to ensure that older runtimes will not silently ignore this field. The format is the same as [user namespace mappings](config-linux.md#user-namespace-mappings). If specified, it MUST be specified along with `gidMappings`. * **`gidMappings`** (array of type LinuxIDMapping, OPTIONAL) The mapping to convert GIDs from the source file system to the destination mount point. This SHOULD be implemented using [`mount_setattr(MOUNT_ATTR_IDMAP)`][mount_setattr.2], available since Linux 5.12. If specified, the `options` field of the `mounts` structure SHOULD contain either `idmap` or `ridmap` to specify whether the mapping should be applied recursively for `rbind` mounts, as well as to ensure that older runtimes will not silently ignore this field. For more details see `uidMappings`. If specified, it MUST be specified along with `uidMappings`. ### Example (Linux) ```json "mounts": [ { "destination": "/tmp", "type": "tmpfs", "source": "tmpfs", "options": ["nosuid","strictatime","mode=755","size=65536k"] }, { "destination": "/data", "type": "none", "source": "/volumes/testing", "options": ["rbind","rw"] } ] ``` ### Example (Solaris) ```json "mounts": [ { "destination": "/opt/local", "type": "lofs", "source": "/usr/local", "options": ["ro","nodevices"] }, { "destination": "/opt/sfw", "type": "lofs", "source": "/opt/sfw" } ] ``` ## Process **`process`** (object, OPTIONAL) specifies the container process. This property is REQUIRED when [`start`](runtime.md#start) is called. * **`terminal`** (bool, OPTIONAL) specifies whether a terminal is attached to the process, defaults to false. As an example, if set to true on Linux a pseudoterminal pair is allocated for the process and the pseudoterminal pty is duplicated on the process's [standard streams][stdin.3]. * **`consoleSize`** (object, OPTIONAL) specifies the console size in characters of the terminal. Runtimes MUST ignore `consoleSize` if `terminal` is `false` or unset. * **`height`** (uint, REQUIRED) * **`width`** (uint, REQUIRED) * **`cwd`** (string, REQUIRED) is the working directory that will be set for the executable. This value MUST be an absolute path. * **`env`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2008's `environ`][ieee-1003.1-2008-xbd-c8.1]. * **`args`** (array of strings, OPTIONAL) with similar semantics to [IEEE Std 1003.1-2008 `execvp`'s *argv*][ieee-1003.1-2008-functions-exec]. This specification extends the IEEE standard in that at least one entry is REQUIRED (non-Windows), and that entry is used with the same semantics as `execvp`'s *file*. This field is OPTIONAL on Windows, and `commandLine` is REQUIRED if this field is omitted. * **`commandLine`** (string, OPTIONAL) specifies the full command line to be executed on Windows. This is the preferred means of supplying the command line on Windows. If omitted, the runtime will fall back to escaping and concatenating fields from `args` before making the system call into Windows. ### POSIX process For systems that support POSIX rlimits (for example Linux and Solaris), the `process` object supports the following process-specific properties: * **`rlimits`** (array of objects, OPTIONAL) allows setting resource limits for the process. Each entry has the following structure: * **`type`** (string, REQUIRED) the platform resource being limited. * Linux: valid values are defined in the [`getrlimit(2)`][getrlimit.2] man page, such as `RLIMIT_MSGQUEUE`. * Solaris: valid values are defined in the [`getrlimit(3)`][getrlimit.3] man page, such as `RLIMIT_CORE`. The runtime MUST [generate an error](runtime.md#errors) for any values which cannot be mapped to a relevant kernel interface. For each entry in `rlimits`, a [`getrlimit(3)`][getrlimit.3] on `type` MUST succeed. For the following properties, `rlim` refers to the status returned by the `getrlimit(3)` call. * **`soft`** (uint64, REQUIRED) the value of the limit enforced for the corresponding resource. `rlim.rlim_cur` MUST match the configured value. * **`hard`** (uint64, REQUIRED) the ceiling for the soft limit that could be set by an unprivileged process. `rlim.rlim_max` MUST match the configured value. Only a privileged process (e.g. one with the `CAP_SYS_RESOURCE` capability) can raise a hard limit. If `rlimits` contains duplicated entries with same `type`, the runtime MUST [generate an error](runtime.md#errors). ### Linux Process For Linux-based systems, the `process` object supports the following process-specific properties. * **`apparmorProfile`** (string, OPTIONAL) specifies the name of the AppArmor profile for the process. For more information about AppArmor, see [AppArmor documentation][apparmor]. * **`capabilities`** (object, OPTIONAL) is an object containing arrays that specifies the sets of capabilities for the process. Valid values are defined in the [capabilities(7)][capabilities.7] man page, such as `CAP_CHOWN`. Any value which cannot be mapped to a relevant kernel interface, or cannot be granted otherwise MUST be [logged as a warning](runtime.md#warnings) by the runtime. Runtimes SHOULD NOT fail if the container configuration requests capabilities that cannot be granted, for example, if the runtime operates in a restricted environment with a limited set of capabilities. `capabilities` contains the following properties: * **`effective`** (array of strings, OPTIONAL) the `effective` field is an array of effective capabilities that are kept for the process. * **`bounding`** (array of strings, OPTIONAL) the `bounding` field is an array of bounding capabilities that are kept for the process. * **`inheritable`** (array of strings, OPTIONAL) the `inheritable` field is an array of inheritable capabilities that are kept for the process. * **`permitted`** (array of strings, OPTIONAL) the `permitted` field is an array of permitted capabilities that are kept for the process. * **`ambient`** (array of strings, OPTIONAL) the `ambient` field is an array of ambient capabilities that are kept for the process. * **`noNewPrivileges`** (bool, OPTIONAL) setting `noNewPrivileges` to true prevents the process from gaining additional privileges. As an example, the [`no_new_privs`][no-new-privs] article in the kernel documentation has information on how this is achieved using a `prctl` system call on Linux. * **`oomScoreAdj`** *(int, OPTIONAL)* adjusts the oom-killer score in `[pid]/oom_score_adj` for the process's `[pid]` in a [proc pseudo-filesystem][proc_2]. If `oomScoreAdj` is set, the runtime MUST set `oom_score_adj` to the given value. If `oomScoreAdj` is not set, the runtime MUST NOT change the value of `oom_score_adj`. This is a per-process setting, where as [`disableOOMKiller`](config-linux.md#memory) is scoped for a memory cgroup. For more information on how these two settings work together, see [the memory cgroup documentation section 10. OOM Contol][cgroup-v1-memory_2]. * **`scheduler`** (object, OPTIONAL) is an object describing the scheduler properties for the process. The `scheduler` contains the following properties: * **`policy`** (string, REQUIRED) represents the scheduling policy. A valid list of values is: * `SCHED_OTHER` * `SCHED_FIFO` * `SCHED_RR` * `SCHED_BATCH` * `SCHED_ISO` * `SCHED_IDLE` * `SCHED_DEADLINE` * **`nice`** (int32, OPTIONAL) is the nice value for the process, affecting its priority. A lower nice value corresponds to a higher priority. If not set, the runtime must use the value 0. * **`priority`** (int32, OPTIONAL) represents the static priority of the process, used by real-time policies like SCHED_FIFO and SCHED_RR. If not set, the runtime must use the value 0. * **`flags`** (array of strings, OPTIONAL) is an array of strings representing scheduling flags. A valid list of values is: * `SCHED_FLAG_RESET_ON_FORK` * `SCHED_FLAG_RECLAIM` * `SCHED_FLAG_DL_OVERRUN` * `SCHED_FLAG_KEEP_POLICY` * `SCHED_FLAG_KEEP_PARAMS` * `SCHED_FLAG_UTIL_CLAMP_MIN` * `SCHED_FLAG_UTIL_CLAMP_MAX` * **`runtime`** (uint64, OPTIONAL) represents the amount of time in nanoseconds during which the process is allowed to run in a given period, used by the deadline scheduler. If not set, the runtime must use the value 0. * **`deadline`** (uint64, OPTIONAL) represents the absolute deadline for the process to complete its execution, used by the deadline scheduler. If not set, the runtime must use the value 0. * **`period`** (uint64, OPTIONAL) represents the length of the period in nanoseconds used for determining the process runtime, used by the deadline scheduler. If not set, the runtime must use the value 0. * **`selinuxLabel`** (string, OPTIONAL) specifies the SELinux label for the process. For more information about SELinux, see [SELinux documentation][selinux]. * **`ioPriority`** (object, OPTIONAL) configures the I/O priority settings for the container's processes within the process group. The I/O priority settings will be automatically applied to the entire process group, affecting all processes within the container. The following properties are available: * **`class`** (string, REQUIRED) specifies the I/O scheduling class. Possible values are `IOPRIO_CLASS_RT`, `IOPRIO_CLASS_BE`, and `IOPRIO_CLASS_IDLE`. * **`priority`** (int, REQUIRED) specifies the priority level within the class. The value should be an integer ranging from 0 (highest) to 7 (lowest). ### User The user for the process is a platform-specific structure that allows specific control over which user the process runs as. #### POSIX-platform User For POSIX platforms the `user` structure has the following fields: * **`uid`** (int, REQUIRED) specifies the user ID in the [container namespace](glossary.md#container-namespace). * **`gid`** (int, REQUIRED) specifies the group ID in the [container namespace](glossary.md#container-namespace). * **`umask`** (int, OPTIONAL) specifies the [umask][umask_2] of the user. If unspecified, the umask should not be changed from the calling process' umask. * **`additionalGids`** (array of ints, OPTIONAL) specifies additional group IDs in the [container namespace](glossary.md#container-namespace) to be added to the process. _Note: symbolic name for uid and gid, such as uname and gname respectively, are left to upper levels to derive (i.e. `/etc/passwd` parsing, NSS, etc)_ ### Example (Linux) ```json "process": { "terminal": true, "consoleSize": { "height": 25, "width": 80 }, "user": { "uid": 1, "gid": 1, "umask": 63, "additionalGids": [5, 6] }, "env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm" ], "cwd": "/root", "args": [ "sh" ], "apparmorProfile": "acme_secure_profile", "selinuxLabel": "system_u:system_r:svirt_lxc_net_t:s0:c124,c675", "ioPriority": { "class": "IOPRIO_CLASS_IDLE", "priority": 4 }, "noNewPrivileges": true, "capabilities": { "bounding": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "permitted": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "inheritable": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "effective": [ "CAP_AUDIT_WRITE", "CAP_KILL" ], "ambient": [ "CAP_NET_BIND_SERVICE" ] }, "rlimits": [ { "type": "RLIMIT_NOFILE", "hard": 1024, "soft": 1024 } ] } ``` ### Example (Solaris) ```json "process": { "terminal": true, "consoleSize": { "height": 25, "width": 80 }, "user": { "uid": 1, "gid": 1, "umask": 7, "additionalGids": [2, 8] }, "env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm" ], "cwd": "/root", "args": [ "/usr/bin/bash" ] } ``` #### Windows User For Windows based systems the user structure has the following fields: * **`username`** (string, OPTIONAL) specifies the user name for the process. ### Example (Windows) ```json "process": { "terminal": true, "user": { "username": "containeradministrator" }, "env": [ "VARIABLE=1" ], "cwd": "c:\\foo", "args": [ "someapp.exe", ] } ``` ## Hostname * **`hostname`** (string, OPTIONAL) specifies the container's hostname as seen by processes running inside the container. On Linux, for example, this will change the hostname in the [container](glossary.md#container-namespace) [UTS namespace][uts-namespace.7]. Depending on your [namespace configuration](config-linux.md#namespaces), the container UTS namespace may be the [runtime](glossary.md#runtime-namespace) [UTS namespace][uts-namespace.7]. ### Example ```json "hostname": "mrsdalloway" ``` ## Domainname * **`domainname`** (string, OPTIONAL) specifies the container's domainname as seen by processes running inside the container. On Linux, for example, this will change the domainname in the [container](glossary.md#container-namespace) [UTS namespace][uts-namespace.7]. Depending on your [namespace configuration](config-linux.md#namespaces), the container UTS namespace may be the [runtime](glossary.md#runtime-namespace) [UTS namespace][uts-namespace.7]. ### Example ```json "domainname": "foobarbaz.test" ``` ## Platform-specific configuration * **`linux`** (object, OPTIONAL) [Linux-specific configuration](config-linux.md). This MAY be set if the target platform of this spec is `linux`. * **`windows`** (object, OPTIONAL) [Windows-specific configuration](config-windows.md). This MUST be set if the target platform of this spec is `windows`. * **`solaris`** (object, OPTIONAL) [Solaris-specific configuration](config-solaris.md). This MAY be set if the target platform of this spec is `solaris`. * **`vm`** (object, OPTIONAL) [Virtual-machine-specific configuration](config-vm.md). This MAY be set if the target platform and architecture of this spec support hardware virtualization. * **`zos`** (object, OPTIONAL) [z/OS-specific configuration](config-zos.md). This MAY be set if the target platform of this spec is `zos`. ### Example (Linux) ```json { "linux": { "namespaces": [ { "type": "pid" } ] } } ``` ## POSIX-platform Hooks For POSIX platforms, the configuration structure supports `hooks` for configuring custom actions related to the [lifecycle](runtime.md#lifecycle) of the container. * **`hooks`** (object, OPTIONAL) MAY contain any of the following properties: * **`prestart`** (array of objects, OPTIONAL, **DEPRECATED**) is an array of [`prestart` hooks](#prestart). * Entries in the array contain the following properties: * **`path`** (string, REQUIRED) with similar semantics to [IEEE Std 1003.1-2008 `execv`'s *path*][ieee-1003.1-2008-functions-exec]. This specification extends the IEEE standard in that **`path`** MUST be absolute. * **`args`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2008 `execv`'s *argv*][ieee-1003.1-2008-functions-exec]. * **`env`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2008's `environ`][ieee-1003.1-2008-xbd-c8.1]. * **`timeout`** (int, OPTIONAL) is the number of seconds before aborting the hook. If set, `timeout` MUST be greater than zero. * The value of `path` MUST resolve in the [runtime namespace](glossary.md#runtime-namespace). * The `prestart` hooks MUST be executed in the [runtime namespace](glossary.md#runtime-namespace). * **`createRuntime`** (array of objects, OPTIONAL) is an array of [`createRuntime` hooks](#createRuntime-hooks). * Entries in the array contain the following properties (the entries are identical to the entries in the deprecated `prestart` hooks): * **`path`** (string, REQUIRED) with similar semantics to [IEEE Std 1003.1-2008 `execv`'s *path*][ieee-1003.1-2008-functions-exec]. This specification extends the IEEE standard in that **`path`** MUST be absolute. * **`args`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2008 `execv`'s *argv*][ieee-1003.1-2008-functions-exec]. * **`env`** (array of strings, OPTIONAL) with the same semantics as [IEEE Std 1003.1-2008's `environ`][ieee-1003.1-2008-xbd-c8.1]. * **`timeout`** (int, OPTIONAL) is the number of seconds before aborting the hook. If set, `timeout` MUST be greater than zero. * The value of `path` MUST resolve in the [runtime namespace](glossary.md#runtime-namespace). * The `createRuntime` hooks MUST be executed in the [runtime namespace](glossary.md#runtime-namespace). * **`createContainer`** (array of objects, OPTIONAL) is an array of [`createContainer` hooks](#createContainer-hooks). * Entries in the array have the same schema as `createRuntime` entries. * The value of `path` MUST resolve in the [runtime namespace](glossary.md#runtime-namespace). * The `createContainer` hooks MUST be executed in the [container namespace](glossary.md#container-namespace). * **`startContainer`** (array of objects, OPTIONAL) is an array of [`startContainer` hooks](#startContainer-hooks). * Entries in the array have the same schema as `createRuntime` entries. * The value of `path` MUST resolve in the [container namespace](glossary.md#container-namespace). * The `startContainer` hooks MUST be executed in the [container namespace](glossary.md#container-namespace). * **`poststart`** (array of objects, OPTIONAL) is an array of [`poststart` hooks](#poststart). * Entries in the array have the same schema as `createRuntime` entries. * The value of `path` MUST resolve in the [runtime namespace](glossary.md#runtime-namespace). * The `poststart` hooks MUST be executed in the [runtime namespace](glossary.md#runtime-namespace). * **`poststop`** (array of objects, OPTIONAL) is an array of [`poststop` hooks](#poststop). * Entries in the array have the same schema as `createRuntime` entries. * The value of `path` MUST resolve in the [runtime namespace](glossary.md#runtime-namespace). * The `poststop` hooks MUST be executed in the [runtime namespace](glossary.md#runtime-namespace). Hooks allow users to specify programs to run before or after various lifecycle events. Hooks MUST be called in the listed order. The [state](runtime.md#state) of the container MUST be passed to hooks over stdin so that they may do work appropriate to the current state of the container. ### Prestart The `prestart` hooks MUST be called as part of the [`create`](runtime.md#create) operation after the runtime environment has been created (according to the configuration in config.json) but before the `pivot_root` or any equivalent operation has been executed. On Linux, for example, they are called after the container namespaces are created, so they provide an opportunity to customize the container (e.g. the network namespace could be specified in this hook). The `prestart` hooks MUST be called before the `createRuntime` hooks. Note: `prestart` hooks were deprecated in favor of `createRuntime`, `createContainer` and `startContainer` hooks, which allow more granular hook control during the create and start phase. The `prestart` hooks' path MUST resolve in the [runtime namespace](glossary.md#runtime-namespace). The `prestart` hooks MUST be executed in the [runtime namespace](glossary.md#runtime-namespace). ### CreateRuntime Hooks The `createRuntime` hooks MUST be called as part of the [`create`](runtime.md#create) operation after the runtime environment has been created (according to the configuration in config.json) but before the `pivot_root` or any equivalent operation has been executed. The `createRuntime` hooks' path MUST resolve in the [runtime namespace](glossary.md#runtime-namespace). The `createRuntime` hooks MUST be executed in the [runtime namespace](glossary.md#runtime-namespace). On Linux, for example, they are called after the container namespaces are created, so they provide an opportunity to customize the container (e.g. the network namespace could be specified in this hook). The definition of `createRuntime` hooks is currently underspecified and hooks authors, should only expect from the runtime that the mount namespace have been created and the mount operations performed. Other operations such as cgroups and SELinux/AppArmor labels might not have been performed by the runtime. ### CreateContainer Hooks The `createContainer` hooks MUST be called as part of the [`create`](runtime.md#create) operation after the runtime environment has been created (according to the configuration in config.json) but before the `pivot_root` or any equivalent operation has been executed. The `createContainer` hooks MUST be called after the `createRuntime` hooks. The `createContainer` hooks' path MUST resolve in the [runtime namespace](glossary.md#runtime-namespace). The `createContainer` hooks MUST be executed in the [container namespace](glossary.md#container-namespace). For example, on Linux this would happen before the `pivot_root` operation is executed but after the mount namespace was created and setup. The definition of `createContainer` hooks is currently underspecified and hooks authors, should only expect from the runtime that the mount namespace and different mounts will be setup. Other operations such as cgroups and SELinux/AppArmor labels might not have been performed by the runtime. ### StartContainer Hooks The `startContainer` hooks MUST be called [before the user-specified process is executed](runtime.md#lifecycle) as part of the [`start`](runtime.md#start) operation. This hook can be used to execute some operations in the container, for example running the `ldconfig` binary on linux before the container process is spawned. The `startContainer` hooks' path MUST resolve in the [container namespace](glossary.md#container-namespace). The `startContainer` hooks MUST be executed in the [container namespace](glossary.md#container-namespace). ### Poststart The `poststart` hooks MUST be called [after the user-specified process is executed](runtime.md#lifecycle) but before the [`start`](runtime.md#start) operation returns. For example, this hook can notify the user that the container process is spawned. The `poststart` hooks' path MUST resolve in the [runtime namespace](glossary.md#runtime-namespace). The `poststart` hooks MUST be executed in the [runtime namespace](glossary.md#runtime-namespace). ### Poststop The `poststop` hooks MUST be called [after the container is deleted](runtime.md#lifecycle) but before the [`delete`](runtime.md#delete) operation returns. Cleanup or debugging functions are examples of such a hook. The `poststop` hooks' path MUST resolve in the [runtime namespace](glossary.md#runtime-namespace). The `poststop` hooks MUST be executed in the [runtime namespace](glossary.md#runtime-namespace). ### Summary See the below table for a summary of hooks and when they are called: | Name | Namespace | When | | ----------------------- | --------- | -----------------------------------------------------------------------------------------------------------------------------------| | `prestart` (Deprecated) | runtime | After the start operation is called but before the user-specified program command is executed. | | `createRuntime` | runtime | During the create operation, after the runtime environment has been created and before the pivot root or any equivalent operation. | | `createContainer` | container | During the create operation, after the runtime environment has been created and before the pivot root or any equivalent operation. | | `startContainer` | container | After the start operation is called but before the user-specified program command is executed. | | `poststart` | runtime | After the user-specified process is executed but before the start operation returns. | | `poststop` | runtime | After the container is deleted but before the delete operation returns. | ### Example ```json "hooks": { "prestart": [ { "path": "/usr/bin/fix-mounts", "args": ["fix-mounts", "arg1", "arg2"], "env": [ "key1=value1"] }, { "path": "/usr/bin/setup-network" } ], "createRuntime": [ { "path": "/usr/bin/fix-mounts", "args": ["fix-mounts", "arg1", "arg2"], "env": [ "key1=value1"] }, { "path": "/usr/bin/setup-network" } ], "createContainer": [ { "path": "/usr/bin/mount-hook", "args": ["-mount", "arg1", "arg2"], "env": [ "key1=value1"] } ], "startContainer": [ { "path": "/usr/bin/refresh-ldcache" } ], "poststart": [ { "path": "/usr/bin/notify-start", "timeout": 5 } ], "poststop": [ { "path": "/usr/sbin/cleanup.sh", "args": ["cleanup.sh", "-f"] } ] } ``` ## Annotations **`annotations`** (object, OPTIONAL) contains arbitrary metadata for the container. This information MAY be structured or unstructured. Annotations MUST be a key-value map. If there are no annotations then this property MAY either be absent or an empty map. Keys MUST be strings. Keys MUST NOT be an empty string. Keys SHOULD be named using a reverse domain notation - e.g. `com.example.myKey`. The `org.opencontainers` namespace for keys is reserved for use by this specification, annotations using keys in this namespace MUST be as described in this section. The following keys in the `org.opencontainers` namespaces MAY be used: | Key | Definition | | --------------------------------------- | -----------------------------------------------------------------------------------------------------------------------------------| | `org.opencontainers.image.os` | Indicates the operating system the container image was built to run on. The annotation value MUST have a valid value for the `os` property as defined in [the OCI image specification][oci-image-config-properties]. This annotation SHOULD only be used in accordance with the [OCI image specification's runtime conversion specification][oci-image-conversion]. | | `org.opencontainers.image.os.version` | Indicates the operating system version targeted by the container image. The annotation value MUST have a valid value for the `os.version` property as defined in [the OCI image specification][oci-image-config-properties]. This annotation SHOULD only be used in accordance with the [OCI image specification's runtime conversion specification][oci-image-conversion]. | | `org.opencontainers.image.os.features` | Indicates mandatory operating system features required by the container image. The annotation value MUST have a valid value for the `os.features` property as defined in [the OCI image specification][oci-image-config-properties]. This annotation SHOULD only be used in accordance with the [OCI image specification's runtime conversion specification][oci-image-conversion]. | | `org.opencontainers.image.architecture` | Indicates the architecture that binaries in the container image are built to run on. The annotation value MUST have a valid value for the `architecture` property as defined in [the OCI image specification][oci-image-config-properties]. This annotation SHOULD only be used in accordance with the [OCI image specification's runtime conversion specification][oci-image-conversion]. | | `org.opencontainers.image.variant` | Indicates the variant of the architecture that binaries in the container image are built to run on. The annotation value MUST have a valid value for the `variant` property as defined in [the OCI image specification][oci-image-config-properties]. This annotation SHOULD only be used in accordance with the [OCI image specification's runtime conversion specification][oci-image-conversion]. | | `org.opencontainers.image.author` | Indicates the author of the container image. The annotation value MUST have a valid value for the `author` property as defined in [the OCI image specification][oci-image-config-properties]. This annotation SHOULD only be used in accordance with the [OCI image specification's runtime conversion specification][oci-image-conversion]. | | `org.opencontainers.image.created` | Indicates the date and time when the container image was created. The annotation value MUST have a valid value for the `created` property as defined in [the OCIimage specification][oci-image-config-properties]. This annotation SHOULD only be used in accordance with the [OCI image specification's runtime conversion specification][oci-image-conversion]. | | `org.opencontainers.image.stopSignal` | Indicates signal that SHOULD be sent by the container runtimes to [kill the container](runtime.md#kill). The annotation value MUST have a valid value for the `config.StopSignal` property as defined in [the OCI image specification][oci-image-config-properties]. This annotation SHOULD only be used in accordance with the [OCI image specification's runtime conversion specification][oci-image-conversion]. | All other keys in the `org.opencontainers` namespace not specified in this above table are reserved and MUST NOT be used by subsequent specifications. Runtimes MUST handle unknown annotation keys like any other [unknown property](#extensibility). Values MUST be strings. Values MAY be an empty string. ```json "annotations": { "com.example.gpu-cores": "2" } ``` ## Extensibility Runtimes MAY [log](runtime.md#warnings) unknown properties but MUST otherwise ignore them. That includes not [generating errors](runtime.md#errors) if they encounter an unknown property. ## Valid values Runtimes MUST generate an error when invalid or unsupported values are encountered. Unless support for a valid value is explicitly required, runtimes MAY choose which subset of the valid values it will support. ## Configuration Schema Example Here is a full example `config.json` for reference. ```json { "ociVersion": "1.0.1", "process": { "terminal": true, "user": { "uid": 1, "gid": 1, "additionalGids": [ 5, 6 ] }, "args": [ "sh" ], "env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm" ], "cwd": "/", "capabilities": { "bounding": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "permitted": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "inheritable": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "effective": [ "CAP_AUDIT_WRITE", "CAP_KILL" ], "ambient": [ "CAP_NET_BIND_SERVICE" ] }, "rlimits": [ { "type": "RLIMIT_CORE", "hard": 1024, "soft": 1024 }, { "type": "RLIMIT_NOFILE", "hard": 1024, "soft": 1024 } ], "apparmorProfile": "acme_secure_profile", "oomScoreAdj": 100, "selinuxLabel": "system_u:system_r:svirt_lxc_net_t:s0:c124,c675", "ioPriority": { "class": "IOPRIO_CLASS_IDLE", "priority": 4 }, "noNewPrivileges": true }, "root": { "path": "rootfs", "readonly": true }, "hostname": "slartibartfast", "mounts": [ { "destination": "/proc", "type": "proc", "source": "proc" }, { "destination": "/dev", "type": "tmpfs", "source": "tmpfs", "options": [ "nosuid", "strictatime", "mode=755", "size=65536k" ] }, { "destination": "/dev/pts", "type": "devpts", "source": "devpts", "options": [ "nosuid", "noexec", "newinstance", "ptmxmode=0666", "mode=0620", "gid=5" ] }, { "destination": "/dev/shm", "type": "tmpfs", "source": "shm", "options": [ "nosuid", "noexec", "nodev", "mode=1777", "size=65536k" ] }, { "destination": "/dev/mqueue", "type": "mqueue", "source": "mqueue", "options": [ "nosuid", "noexec", "nodev" ] }, { "destination": "/sys", "type": "sysfs", "source": "sysfs", "options": [ "nosuid", "noexec", "nodev" ] }, { "destination": "/sys/fs/cgroup", "type": "cgroup", "source": "cgroup", "options": [ "nosuid", "noexec", "nodev", "relatime", "ro" ] } ], "hooks": { "prestart": [ { "path": "/usr/bin/fix-mounts", "args": [ "fix-mounts", "arg1", "arg2" ], "env": [ "key1=value1" ] }, { "path": "/usr/bin/setup-network" } ], "poststart": [ { "path": "/usr/bin/notify-start", "timeout": 5 } ], "poststop": [ { "path": "/usr/sbin/cleanup.sh", "args": [ "cleanup.sh", "-f" ] } ] }, "linux": { "devices": [ { "path": "/dev/fuse", "type": "c", "major": 10, "minor": 229, "fileMode": 438, "uid": 0, "gid": 0 }, { "path": "/dev/sda", "type": "b", "major": 8, "minor": 0, "fileMode": 432, "uid": 0, "gid": 0 } ], "uidMappings": [ { "containerID": 0, "hostID": 1000, "size": 32000 } ], "gidMappings": [ { "containerID": 0, "hostID": 1000, "size": 32000 } ], "sysctl": { "net.ipv4.ip_forward": "1", "net.core.somaxconn": "256" }, "cgroupsPath": "/myRuntime/myContainer", "resources": { "network": { "classID": 1048577, "priorities": [ { "name": "eth0", "priority": 500 }, { "name": "eth1", "priority": 1000 } ] }, "pids": { "limit": 32771 }, "hugepageLimits": [ { "pageSize": "2MB", "limit": 9223372036854772000 }, { "pageSize": "64KB", "limit": 1000000 } ], "memory": { "limit": 536870912, "reservation": 536870912, "swap": 536870912, "kernel": -1, "kernelTCP": -1, "swappiness": 0, "disableOOMKiller": false }, "cpu": { "shares": 1024, "quota": 1000000, "period": 500000, "realtimeRuntime": 950000, "realtimePeriod": 1000000, "cpus": "2-3", "idle": 1, "mems": "0-7" }, "devices": [ { "allow": false, "access": "rwm" }, { "allow": true, "type": "c", "major": 10, "minor": 229, "access": "rw" }, { "allow": true, "type": "b", "major": 8, "minor": 0, "access": "r" } ], "blockIO": { "weight": 10, "leafWeight": 10, "weightDevice": [ { "major": 8, "minor": 0, "weight": 500, "leafWeight": 300 }, { "major": 8, "minor": 16, "weight": 500 } ], "throttleReadBpsDevice": [ { "major": 8, "minor": 0, "rate": 600 } ], "throttleWriteIOPSDevice": [ { "major": 8, "minor": 16, "rate": 300 } ] } }, "rootfsPropagation": "slave", "seccomp": { "defaultAction": "SCMP_ACT_ALLOW", "architectures": [ "SCMP_ARCH_X86", "SCMP_ARCH_X32" ], "syscalls": [ { "names": [ "getcwd", "chmod" ], "action": "SCMP_ACT_ERRNO" } ] }, "timeOffsets": { "monotonic": { "secs": 172800, "nanosecs": 0 }, "boottime": { "secs": 604800, "nanosecs": 0 } }, "namespaces": [ { "type": "pid" }, { "type": "network" }, { "type": "ipc" }, { "type": "uts" }, { "type": "mount" }, { "type": "user" }, { "type": "cgroup" }, { "type": "time" } ], "maskedPaths": [ "/proc/kcore", "/proc/latency_stats", "/proc/timer_stats", "/proc/sched_debug" ], "readonlyPaths": [ "/proc/asound", "/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger" ], "mountLabel": "system_u:object_r:svirt_sandbox_file_t:s0:c715,c811" }, "annotations": { "com.example.key1": "value1", "com.example.key2": "value2" } } ``` [apparmor]: https://wiki.ubuntu.com/AppArmor [cgroup-v1-memory_2]: https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt [selinux]:http://selinuxproject.org/page/Main_Page [no-new-privs]: https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt [proc_2]: https://www.kernel.org/doc/Documentation/filesystems/proc.txt [umask.2]: http://pubs.opengroup.org/onlinepubs/009695399/functions/umask.html [semver-v2.0.0]: http://semver.org/spec/v2.0.0.html [ieee-1003.1-2008-xbd-c8.1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_01 [ieee-1003.1-2008-functions-exec]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html [naming-a-volume]: https://aka.ms/nb3hqb [oci-image-config-properties]: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc2/config.md#properties [oci-image-conversion]: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc2/conversion.md [capabilities.7]: http://man7.org/linux/man-pages/man7/capabilities.7.html [mount.2]: http://man7.org/linux/man-pages/man2/mount.2.html [mount.8]: http://man7.org/linux/man-pages/man8/mount.8.html [mount.8-filesystem-independent]: http://man7.org/linux/man-pages/man8/mount.8.html#FILESYSTEM-INDEPENDENT_MOUNT_OPTIONS [mount.8-filesystem-specific]: http://man7.org/linux/man-pages/man8/mount.8.html#FILESYSTEM-SPECIFIC_MOUNT_OPTIONS [mount_setattr.2]: http://man7.org/linux/man-pages/man2/mount_setattr.2.html [mount-bind]: https://docs.kernel.org/filesystems/sharedsubtree.html [getrlimit.2]: http://man7.org/linux/man-pages/man2/getrlimit.2.html [getrlimit.3]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/getrlimit.html [stdin.3]: http://man7.org/linux/man-pages/man3/stdin.3.html [uts-namespace.7]: http://man7.org/linux/man-pages/man7/namespaces.7.html [zonecfg.1m]: http://docs.oracle.com/cd/E86824_01/html/E54764/zonecfg-1m.html crun-1.16.1/libocispec/runtime-spec/GOVERNANCE.md0000644000000000000000000000744414332154665017457 0ustar0000000000000000# Project governance The [OCI charter][charter] §5.b.viii tasks an OCI Project's maintainers (listed in the repository's MAINTAINERS file and sometimes referred to as "the TDC", [§5.e][charter]) with: > Creating, maintaining and enforcing governance guidelines for the TDC, approved by the maintainers, and which shall be posted visibly for the TDC. This section describes generic rules and procedures for fulfilling that mandate. ## Proposing a motion A maintainer SHOULD propose a motion on the dev@opencontainers.org mailing list (except [security issues](#security-issues)) with another maintainer as a co-sponsor. ## Voting Voting on a proposed motion SHOULD happen on the dev@opencontainers.org mailing list (except [security issues](#security-issues)) with maintainers posting LGTM or REJECT. Maintainers MAY also explicitly not vote by posting ABSTAIN (which is useful to revert a previous vote). Maintainers MAY post multiple times (e.g. as they revise their position based on feedback), but only their final post counts in the tally. A proposed motion is adopted if two-thirds of votes cast, a quorum having voted, are in favor of the release. Voting SHOULD remain open for a week to collect feedback from the wider community and allow the maintainers to digest the proposed motion. Under exceptional conditions (e.g. non-major security fix releases) proposals which reach quorum with unanimous support MAY be adopted earlier. A maintainer MAY choose to reply with REJECT. A maintainer posting a REJECT MUST include a list of concerns or links to written documentation for those concerns (e.g. GitHub issues or mailing-list threads). The maintainers SHOULD try to resolve the concerns and wait for the rejecting maintainer to change their opinion to LGTM. However, a motion MAY be adopted with REJECTs, as outlined in the previous paragraphs. ## Quorum A quorum is established when at least two-thirds of maintainers have voted. For projects that are not specifications, a [motion to release](#release-approval) MAY be adopted if the tally is at least three LGTMs and no REJECTs, even if three votes does not meet the usual two-thirds quorum. ## Security issues Motions with sensitive security implications MUST be proposed on the security@opencontainers.org mailing list instead of dev@opencontainers.org, but should otherwise follow the standard [proposal](#proposing-a-motion) process. The security@opencontainers.org mailing list includes all members of the TOB. The TOB will contact the project maintainers and provide a channel for discussing and voting on the motion, but voting will otherwise follow the standard [voting](#voting) and [quorum](#quorum) rules. The TOB and project maintainers will work together to notify affected parties before making an adopted motion public. ## Amendments The [project governance](#project-governance) rules and procedures MAY be amended or replaced using the procedures themselves. The MAINTAINERS of this project governance document is the total set of MAINTAINERS from all Open Containers projects (runC, runtime-spec, and image-spec). ## Subject templates Maintainers are busy and get lots of email. To make project proposals recognizable, proposed motions SHOULD use the following subject templates. ### Proposing a motion > [{project} VOTE]: {motion description} (closes {end of voting window}) For example: > [runtime-spec VOTE]: Tag 0647920 as 1.0.0-rc (closes 2016-06-03 20:00 UTC) ### Tallying results After voting closes, a maintainer SHOULD post a tally to the motion thread with a subject template like: > [{project} {status}]: {motion description} (+{LGTMs} -{REJECTs} #{ABSTAINs}) Where `{status}` is either `adopted` or `rejected`. For example: > [runtime-spec adopted]: Tag 0647920 as 1.0.0-rc (+6 -0 #3) [charter]: https://github.com/opencontainers/tob/blob/main/CHARTER.md crun-1.16.1/libocispec/runtime-spec/.gitattributes0000664000000000000000000000010613677106243020367 0ustar0000000000000000# https://tools.ietf.org/html/rfc5545#section-3.1 *.ics text eol=crlf crun-1.16.1/libocispec/runtime-spec/.gitignore0000664000000000000000000000004213677106243017463 0ustar0000000000000000output schema/validate version.md crun-1.16.1/libocispec/runtime-spec/.mailmap0000664000000000000000000000220513677106243017117 0ustar0000000000000000Aleksa Sarai Alexander Morozov Amit Saha Antonio Murdaca Brandon Philips Brandon Philips ChengTiesheng Daniel, Dao Quang Minh Doug Davis James O. D. Hunt John Howard LinZhinan(Zen Lin) Mrunal Patel Mrunal Patel Mrunal Patel Vincent Batts Vincent Batts Vishnu Kannan Vishnu Kannan Zefan Li æ¢è¾°æ™” (Liang Chenye) crun-1.16.1/libocispec/runtime-spec/LICENSE0000664000000000000000000002501713677106243016511 0ustar0000000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS Copyright 2015 The Linux Foundation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. crun-1.16.1/libocispec/runtime-spec/features-linux.md0000644000000000000000000001633714614670026021001 0ustar0000000000000000# Linux Features Structure This document describes the [Linux-specific section](features.md#platform-specific-features) of the [Features structure](features.md). ## Namespaces * **`namespaces`** (array of strings, OPTIONAL) The recognized names of the namespaces, including namespaces that might not be supported by the host operating system. The runtime MUST recognize the elements in this array as the [`type` of `linux.namespaces` objects in `config.json`](config-linux.md#namespaces). ### Example ```json "namespaces": [ "cgroup", "ipc", "mount", "network", "pid", "user", "uts" ] ``` ## Capabilities * **`capabilities`** (array of strings, OPTIONAL) The recognized names of the capabilities, including capabilities that might not be supported by the host operating system. The runtime MUST recognize the elements in this array in the [`process.capabilities` object of `config.json`](config.md#linux-process). ### Example ```json "capabilities": [ "CAP_CHOWN", "CAP_DAC_OVERRIDE", "CAP_DAC_READ_SEARCH", "CAP_FOWNER", "CAP_FSETID", "CAP_KILL", "CAP_SETGID", "CAP_SETUID", "CAP_SETPCAP", "CAP_LINUX_IMMUTABLE", "CAP_NET_BIND_SERVICE", "CAP_NET_BROADCAST", "CAP_NET_ADMIN", "CAP_NET_RAW", "CAP_IPC_LOCK", "CAP_IPC_OWNER", "CAP_SYS_MODULE", "CAP_SYS_RAWIO", "CAP_SYS_CHROOT", "CAP_SYS_PTRACE", "CAP_SYS_PACCT", "CAP_SYS_ADMIN", "CAP_SYS_BOOT", "CAP_SYS_NICE", "CAP_SYS_RESOURCE", "CAP_SYS_TIME", "CAP_SYS_TTY_CONFIG", "CAP_MKNOD", "CAP_LEASE", "CAP_AUDIT_WRITE", "CAP_AUDIT_CONTROL", "CAP_SETFCAP", "CAP_MAC_OVERRIDE", "CAP_MAC_ADMIN", "CAP_SYSLOG", "CAP_WAKE_ALARM", "CAP_BLOCK_SUSPEND", "CAP_AUDIT_READ", "CAP_PERFMON", "CAP_BPF", "CAP_CHECKPOINT_RESTORE" ] ``` ## Cgroup **`cgroup`** (object, OPTIONAL) represents the runtime's implementation status of cgroup managers. Irrelevant to the cgroup version of the host operating system. * **`v1`** (bool, OPTIONAL) represents whether the runtime supports cgroup v1. * **`v2`** (bool, OPTIONAL) represents whether the runtime supports cgroup v2. * **`systemd`** (bool, OPTIONAL) represents whether the runtime supports system-wide systemd cgroup manager. * **`systemdUser`** (bool, OPTIONAL) represents whether the runtime supports user-scoped systemd cgroup manager. * **`rdma`** (bool, OPTIONAL) represents whether the runtime supports RDMA cgroup controller. ### Example ```json "cgroup": { "v1": true, "v2": true, "systemd": true, "systemdUser": true, "rdma": false } ``` ## Seccomp **`seccomp`** (object, OPTIONAL) represents the runtime's implementation status of seccomp. Irrelevant to the kernel version of the host operating system. * **`enabled`** (bool, OPTIONAL) represents whether the runtime supports seccomp. * **`actions`** (array of strings, OPTIONAL) The recognized names of the seccomp actions. The runtime MUST recognize the elements in this array in the [`syscalls[].action` property of the `linux.seccomp` object in `config.json`](config-linux.md#seccomp). * **`operators`** (array of strings, OPTIONAL) The recognized names of the seccomp operators. The runtime MUST recognize the elements in this array in the [`syscalls[].args[].op` property of the `linux.seccomp` object in `config.json`](config-linux.md#seccomp). * **`archs`** (array of strings, OPTIONAL) The recognized names of the seccomp architectures. The runtime MUST recognize the elements in this array in the [`architectures` property of the `linux.seccomp` object in `config.json`](config-linux.md#seccomp). * **`knownFlags`** (array of strings, OPTIONAL) The recognized names of the seccomp flags. The runtime MUST recognize the elements in this array in the [`flags` property of the `linux.seccomp` object in `config.json`](config-linux.md#seccomp). * **`supportedFlags`** (array of strings, OPTIONAL) The recognized and supported names of the seccomp flags. This list may be a subset of `knownFlags` due to some flags not supported by the current kernel and/or libseccomp. The runtime MUST recognize and support the elements in this array in the [`flags` property of the `linux.seccomp` object in `config.json`](config-linux.md#seccomp). ### Example ```json "seccomp": { "enabled": true, "actions": [ "SCMP_ACT_ALLOW", "SCMP_ACT_ERRNO", "SCMP_ACT_KILL", "SCMP_ACT_LOG", "SCMP_ACT_NOTIFY", "SCMP_ACT_TRACE", "SCMP_ACT_TRAP" ], "operators": [ "SCMP_CMP_EQ", "SCMP_CMP_GE", "SCMP_CMP_GT", "SCMP_CMP_LE", "SCMP_CMP_LT", "SCMP_CMP_MASKED_EQ", "SCMP_CMP_NE" ], "archs": [ "SCMP_ARCH_AARCH64", "SCMP_ARCH_ARM", "SCMP_ARCH_MIPS", "SCMP_ARCH_MIPS64", "SCMP_ARCH_MIPS64N32", "SCMP_ARCH_MIPSEL", "SCMP_ARCH_MIPSEL64", "SCMP_ARCH_MIPSEL64N32", "SCMP_ARCH_PPC", "SCMP_ARCH_PPC64", "SCMP_ARCH_PPC64LE", "SCMP_ARCH_S390", "SCMP_ARCH_S390X", "SCMP_ARCH_X32", "SCMP_ARCH_X86", "SCMP_ARCH_X86_64" ], "knownFlags": [ "SECCOMP_FILTER_FLAG_LOG" ], "supportedFlags": [ "SECCOMP_FILTER_FLAG_LOG" ] } ``` ## AppArmor **`apparmor`** (object, OPTIONAL) represents the runtime's implementation status of AppArmor. Irrelevant to the availability of AppArmor on the host operating system. * **`enabled`** (bool, OPTIONAL) represents whether the runtime supports AppArmor. ### Example ```json "apparmor": { "enabled": true } ``` ## SELinux **`selinux`** (object, OPTIONAL) represents the runtime's implementation status of SELinux. Irrelevant to the availability of SELinux on the host operating system. * **`enabled`** (bool, OPTIONAL) represents whether the runtime supports SELinux. ### Example ```json "selinux": { "enabled": true } ``` ## Intel RDT **`intelRdt`** (object, OPTIONAL) represents the runtime's implementation status of Intel RDT. Irrelevant to the availability of Intel RDT on the host operating system. * **`enabled`** (bool, OPTIONAL) represents whether the runtime supports Intel RDT. ### Example ```json "intelRdt": { "enabled": true } ``` ## MountExtensions **`mountExtensions`** (object, OPTIONAL) represents whether the runtime supports certain mount features, irrespective of the availability of the features on the host operating system. * **`idmap`** (object, OPTIONAL) represents whether the runtime supports idmap mounts using the `uidMappings` and `gidMappings` properties of the mount. * **`enabled`** (bool, OPTIONAL) represents whether the runtime parses and attempts to use the `uidMappings` and `gidMappings` properties of mounts if provided. Note that it is possible for runtimes to have partial implementations of id-mapped mounts support (such as only allowing mounts which have mappings matching the container's user namespace, or only allowing the id-mapped bind-mounts). In such cases, runtimes MUST still set this value to `true`, to indicate that the runtime recognises the `uidMappings` and `gidMappings` properties. ### Example ```json "mountExtensions": { "idmap":{ "enabled": true } } ``` crun-1.16.1/libocispec/runtime-spec/bundle.md0000664000000000000000000000274613677106243017303 0ustar0000000000000000# Filesystem Bundle ## Container Format This section defines a format for encoding a container as a *filesystem bundle* - a set of files organized in a certain way, and containing all the necessary data and metadata for any compliant runtime to perform all standard operations against it. See also [MacOS application bundles][macos_bundle] for a similar use of the term *bundle*. The definition of a bundle is only concerned with how a container, and its configuration data, are stored on a local filesystem so that it can be consumed by a compliant runtime. A Standard Container bundle contains all the information needed to load and run a container. This includes the following artifacts: 1. `config.json`: contains configuration data. This REQUIRED file MUST reside in the root of the bundle directory and MUST be named `config.json`. See [`config.json`](config.md) for more details. 2. container's root filesystem: the directory referenced by [`root.path`](config.md#root), if that property is set in `config.json`. When supplied, while these artifacts MUST all be present in a single directory on the local filesystem, that directory itself is not part of the bundle. In other words, a tar archive of a *bundle* will have these artifacts at the root of the archive, not nested within a top-level directory. [macos_bundle]: https://en.wikipedia.org/wiki/Bundle_%28macOS%29 crun-1.16.1/libocispec/runtime-spec/config-zos.md0000664000000000000000000000175414160576556020114 0ustar0000000000000000_This document is a work in progress._ # z/OS Container Configuration This document describes the schema for the [z/OS-specific section](config.md#platform-specific-configuration) of the [container configuration](config.md). ## Devices **`devices`** (array of objects, OPTIONAL) lists devices that MUST be available in the container. The runtime MAY supply them however it likes. Each entry has the following structure: * **`type`** *(string, REQUIRED)* - type of device: `c`, `b`, `u` or `p`. * **`path`** *(string, REQUIRED)* - full path to device inside container. If a file already exists at `path` that does not match the requested device, the runtime MUST generate an error. * **`major, minor`** *(int64, REQUIRED unless `type` is `p`)* - major, minor numbers for the device. * **`fileMode`** *(uint32, OPTIONAL)* - file mode for the device. The same `type`, `major` and `minor` SHOULD NOT be used for multiple devices. crun-1.16.1/libocispec/runtime-spec/config-solaris.md0000664000000000000000000001373013677106243020744 0ustar0000000000000000# Solaris Application Container Configuration Solaris application containers can be configured using the following properties, all of the below properties have mappings to properties specified under [zonecfg(1M)][zonecfg.1m_2] man page, except milestone. ## milestone The SMF(Service Management Facility) FMRI which should go to "online" state before we start the desired process within the container. **`milestone`** *(string, OPTIONAL)* ### Example ```json "milestone": "svc:/milestone/container:default" ``` ## limitpriv The maximum set of privileges any process in this container can obtain. The property should consist of a comma-separated privilege set specification as described in [priv_str_to_set(3C)][priv-str-to-set.3c] man page for the respective release of Solaris. **`limitpriv`** *(string, OPTIONAL)* ### Example ```json "limitpriv": "default" ``` ## maxShmMemory The maximum amount of shared memory allowed for this application container. A scale (K, M, G, T) can be applied to the value for each of these numbers (for example, 1M is one megabyte). Mapped to `max-shm-memory` in [zonecfg(1M)][zonecfg.1m_2] man page. **`maxShmMemory`** *(string, OPTIONAL)* ### Example ```json "maxShmMemory": "512m" ``` ## cappedCPU Sets a limit on the amount of CPU time that can be used by a container. The unit used translates to the percentage of a single CPU that can be used by all user threads in a container, expressed as a fraction (for example, .75) or a mixed number (whole number and fraction, for example, 1.25). An ncpu value of 1 means 100% of a CPU, a value of 1.25 means 125%, .75 mean 75%, and so forth. When projects within a capped container have their own caps, the minimum value takes precedence. cappedCPU is mapped to `capped-cpu` in [zonecfg(1M)][zonecfg.1m_2] man page. * **`ncpus`** *(string, OPTIONAL)* ### Example ```json "cappedCPU": { "ncpus": "8" } ``` ## cappedMemory The physical and swap caps on the memory that can be used by this application container. A scale (K, M, G, T) can be applied to the value for each of these numbers (for example, 1M is one megabyte). cappedMemory is mapped to `capped-memory` in [zonecfg(1M)][zonecfg.1m_2] man page. * **`physical`** *(string, OPTIONAL)* * **`swap`** *(string, OPTIONAL)* ### Example ```json "cappedMemory": { "physical": "512m", "swap": "512m" } ``` ## Network ### Automatic Network (anet) anet is specified as an array that is used to set up networking for Solaris application containers. The anet resource represents the automatic creation of a network resource for an application container. The zones administration daemon, zoneadmd, is the primary process for managing the container's virtual platform. One of the daemon's responsibilities is creation and teardown of the networks for the container. For more information on the daemon see the [zoneadmd(1M)][zoneadmd.1m] man page. When such a container is started, a temporary VNIC(Virtual NIC) is automatically created for the container. The VNIC is deleted when the container is torn down. The following properties can be used to set up automatic networks. For additional information on properties, check the [zonecfg(1M)][zonecfg.1m_2] man page for the respective release of Solaris. * **`linkname`** *(string, OPTIONAL)* Specify a name for the automatically created VNIC datalink. * **`lowerLink`** *(string, OPTIONAL)* Specify the link over which the VNIC will be created. Mapped to `lower-link` in the [zonecfg(1M)][zonecfg.1m_2] man page. * **`allowedAddress`** *(string, OPTIONAL)* The set of IP addresses that the container can use might be constrained by specifying the `allowedAddress` property. If `allowedAddress` has not been specified, then they can use any IP address on the associated physical interface for the network resource. Otherwise, when `allowedAddress` is specified, the container cannot use IP addresses that are not in the `allowedAddress` list for the physical address. Mapped to `allowed-address` in the [zonecfg(1M)][zonecfg.1m_2] man page. * **`configureAllowedAddress`** *(string, OPTIONAL)* If `configureAllowedAddress` is set to true, the addresses specified by `allowedAddress` are automatically configured on the interface each time the container starts. When it is set to false, the `allowedAddress` will not be configured on container start. Mapped to `configure-allowed-address` in the [zonecfg(1M)][zonecfg.1m_2] man page. * **`defrouter`** *(string, OPTIONAL)* The value for the OPTIONAL default router. * **`macAddress`** *(string, OPTIONAL)* Set the VNIC's MAC addresses based on the specified value or keyword. If not a keyword, it is interpreted as a unicast MAC address. For a list of the supported keywords please refer to the [zonecfg(1M)][zonecfg.1m_2] man page of the respective Solaris release. Mapped to `mac-address` in the [zonecfg(1M)][zonecfg.1m_2] man page. * **`linkProtection`** *(string, OPTIONAL)* Enables one or more types of link protection using comma-separated values. See the protection property in dladm(8) for supported values in respective release of Solaris. Mapped to `link-protection` in the [zonecfg(1M)][zonecfg.1m_2] man page. #### Example ```json "anet": [ { "allowedAddress": "172.17.0.2/16", "configureAllowedAddress": "true", "defrouter": "172.17.0.1/16", "linkProtection": "mac-nospoof, ip-nospoof", "linkname": "net0", "lowerLink": "net2", "macAddress": "02:42:f8:52:c7:16" } ] ``` [priv-str-to-set.3c]: http://docs.oracle.com/cd/E86824_01/html/E54766/priv-str-to-set-3c.html [zoneadmd.1m]: http://docs.oracle.com/cd/E86824_01/html/E54764/zoneadmd-1m.html [zonecfg.1m_2]: http://docs.oracle.com/cd/E86824_01/html/E54764/zonecfg-1m.html crun-1.16.1/libocispec/runtime-spec/config-vm.md0000664000000000000000000000706613677106243017717 0ustar0000000000000000# Virtual-machine-specific Container Configuration This section describes the schema for the [virtual-machine-specific section](config.md#platform-specific-configuration) of the [container configuration](config.md). The virtual-machine container specification provides additional configuration for the hypervisor, kernel, and image. ## Hypervisor Object **`hypervisor`** (object, OPTIONAL) specifies details of the hypervisor that manages the container virtual machine. * **`path`** (string, REQUIRED) path to the hypervisor binary that manages the container virtual machine. This value MUST be an absolute path in the [runtime mount namespace](glossary.md#runtime-namespace). * **`parameters`** (array of strings, OPTIONAL) specifies an array of parameters to pass to the hypervisor. ### Example ```json "hypervisor": { "path": "/path/to/vmm", "parameters": ["opts1=foo", "opts2=bar"] } ``` ## Kernel Object **`kernel`** (object, REQUIRED) specifies details of the kernel to boot the container virtual machine with. * **`path`** (string, REQUIRED) path to the kernel used to boot the container virtual machine. This value MUST be an absolute path in the [runtime mount namespace](glossary.md#runtime-namespace). * **`parameters`** (array of strings, OPTIONAL) specifies an array of parameters to pass to the kernel. * **`initrd`** (string, OPTIONAL) path to an initial ramdisk to be used by the container virtual machine. This value MUST be an absolute path in the [runtime mount namespace](glossary.md#runtime-namespace). ### Example ```json "kernel": { "path": "/path/to/vmlinuz", "parameters": ["foo=bar", "hello world"], "initrd": "/path/to/initrd.img" } ``` ## Image Object **`image`** (object, OPTIONAL) specifies details of the image that contains the root filesystem for the container virtual machine. * **`path`** (string, REQUIRED) path to the container virtual machine root image. This value MUST be an absolute path in the [runtime mount namespace](glossary.md#runtime-namespace). * **`format`** (string, REQUIRED) format of the container virtual machine root image. Commonly supported formats are: * **`raw`** [raw disk image format][raw-image-format]. Unset values for `format` will default to that format. * **`qcow2`** [QEMU image format][qcow2-image-format]. * **`vdi`** [VirtualBox 1.1 compatible image format][vdi-image-format]. * **`vmdk`** [VMware compatible image format][vmdk-image-format]. * **`vhd`** [Virtual Hard Disk image format][vhd-image-format]. This image contains the root filesystem that the virtual machine **`kernel`** will boot into, not to be confused with the container root filesystem itself. The latter, as specified by **`path`** from the [Root Configuration](config.md#Root-Configuration) section, will be mounted inside the virtual machine at a location chosen by the virtual-machine-based runtime. ### Example ```json "image": { "path": "/path/to/vm/rootfs.img", "format": "raw" } ``` [raw-image-format]: https://en.wikipedia.org/wiki/IMG_(file_format) [qcow2-image-format]: https://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/interop/qcow2.txt;hb=HEAD [vdi-image-format]: https://forensicswiki.org/wiki/Virtual_Disk_Image_(VDI) [vmdk-image-format]: http://www.vmware.com/app/vmdk/?src=vmdk [vhd-image-format]: https://github.com/libyal/libvhdi/blob/master/documentation/Virtual%20Hard%20Disk%20(VHD)%20image%20format.asciidoc crun-1.16.1/libocispec/runtime-spec/config-windows.md0000664000000000000000000001670514265762063020771 0ustar0000000000000000# Windows-specific Container Configuration This document describes the schema for the [Windows-specific section](config.md#platform-specific-configuration) of the [container configuration](config.md). The Windows container specification uses APIs provided by the Windows Host Compute Service (HCS) to fulfill the spec. ## LayerFolders **`layerFolders`** (array of strings, REQUIRED) specifies a list of layer folders the container image relies on. The list is ordered from topmost layer to base layer with the last entry being the scratch. `layerFolders` MUST contain at least one entry. ### Example ```json "windows": { "layerFolders": [ "C:\\Layers\\layer2", "C:\\Layers\\layer1", "C:\\Layers\\layer-base", "C:\\scratch", ] } ``` ## Devices **`devices`** (array of objects, OPTIONAL) lists devices that MUST be available in the container. Each entry has the following structure: * **`id`** *(string, REQUIRED)* - specifies the device which the runtime MUST make available in the container. * **`idType`** *(string, REQUIRED)* - tells the runtime how to interpret `id`. Today, Windows only supports a value of `class`, which identifies `id` as a [device interface class GUID][interfaceGUID]. [interfaceGUID]: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/overview-of-device-interface-classes ### Example ```json "windows": { "devices": [ { "id": "24E552D7-6523-47F7-A647-D3465BF1F5CA", "idType": "class" }, { "id": "5175d334-c371-4806-b3ba-71fd53c9258d", "idType": "class" } ] } ``` ## Resources You can configure a container's resource limits via the OPTIONAL `resources` field of the Windows configuration. ### Memory `memory` is an OPTIONAL configuration for the container's memory usage. The following parameters can be specified: * **`limit`** *(uint64, OPTIONAL)* - sets limit of memory usage in bytes. #### Example ```json "windows": { "resources": { "memory": { "limit": 2097152 } } } ``` ### CPU `cpu` is an OPTIONAL configuration for the container's CPU usage. The following parameters can be specified (mutually exclusive): * **`count`** *(uint64, OPTIONAL)* - specifies the number of CPUs available to the container. It represents the fraction of the configured processor `count` in a container in relation to the processors available in the host. The fraction ultimately determines the portion of processor cycles that the threads in a container can use during each scheduling interval, as the number of cycles per 10,000 cycles. * **`shares`** *(uint16, OPTIONAL)* - limits the share of processor time given to the container relative to other workloads on the processor. The processor `shares` (`weight` at the platform level) is a value between 0 and 10,000. * **`maximum`** *(uint16, OPTIONAL)* - determines the portion of processor cycles that the threads in a container can use during each scheduling interval, as the number of cycles per 10,000 cycles. Set processor `maximum` to a percentage times 100. Ref: https://docs.microsoft.com/en-us/virtualization/api/hcs/schemareference#Container_Processor #### Example ```json "windows": { "resources": { "cpu": { "maximum": 5000 } } } ``` ### Storage `storage` is an OPTIONAL configuration for the container's storage usage. The following parameters can be specified: * **`iops`** *(uint64, OPTIONAL)* - specifies the maximum IO operations per second for the system drive of the container. * **`bps`** *(uint64, OPTIONAL)* - specifies the maximum bytes per second for the system drive of the container. * **`sandboxSize`** *(uint64, OPTIONAL)* - specifies the minimum size of the system drive in bytes. #### Example ```json "windows": { "resources": { "storage": { "iops": 50 } } } ``` ## Network You can configure a container's networking options via the OPTIONAL `network` field of the Windows configuration. The following parameters can be specified: * **`endpointList`** *(array of strings, OPTIONAL)* - list of HNS (Host Network Service) endpoints that the container should connect to. * **`allowUnqualifiedDNSQuery`** *(bool, OPTIONAL)* - specifies if unqualified DNS name resolution is allowed. * **`DNSSearchList`** *(array of strings, OPTIONAL)* - comma separated list of DNS suffixes to use for name resolution. * **`networkSharedContainerName`** *(string, OPTIONAL)* - name (ID) of the container that we will share with the network stack. * **`networkNamespace`** *(string, OPTIONAL)* - name (ID) of the network namespace that will be used for the container. If a network namespace is specified no other parameter must be specified. ### Example ```json "windows": { "network": { "endpointList": [ "7a010682-17e0-4455-a838-02e5d9655fe6" ], "allowUnqualifiedDNSQuery": true, "DNSSearchList": [ "a.com", "b.com" ], "networkSharedContainerName": "containerName", "networkNamespace": "168f3daf-efc6-4377-b20a-2c86764ba892" } } ``` ## Credential Spec You can configure a container's group Managed Service Account (gMSA) via the OPTIONAL `credentialSpec` field of the Windows configuration. The `credentialSpec` is a JSON object whose properties are implementation-defined. For more information about gMSAs, see [Active Directory Service Accounts for Windows Containers][gMSAOverview]. For more information about tooling to generate a gMSA, see [Deployment Overview][gMSATooling]. [gMSAOverview]: https://aka.ms/windowscontainers/manage-serviceaccounts [gMSATooling]: https://aka.ms/windowscontainers/credentialspec-tools ## Servicing When a container terminates, the Host Compute Service indicates if a Windows update servicing operation is pending. You can indicate that a container should be started in a mode to apply pending servicing operations via the OPTIONAL `servicing` field of the Windows configuration. ### Example ```json "windows": { "servicing": true } ``` ## IgnoreFlushesDuringBoot You can indicate that a container should be started in a mode where disk flushes are not performed during container boot via the OPTIONAL `ignoreFlushesDuringBoot` field of the Windows configuration. ### Example ```json "windows": { "ignoreFlushesDuringBoot": true } ``` ## HyperV `hyperv` is an OPTIONAL field of the Windows configuration. If present, the container MUST be run with Hyper-V isolation. If omitted, the container MUST be run as a Windows Server container. The following parameters can be specified: * **`utilityVMPath`** *(string, OPTIONAL)* - specifies the path to the image used for the utility VM. This would be specified if using a base image which does not contain a utility VM image. If not supplied, the runtime will search the container filesystem layers from the bottom-most layer upwards, until it locates "UtilityVM", and default to that path. ### Example ```json "windows": { "hyperv": { "utilityVMPath": "C:\\path\\to\\utilityvm" } } ``` crun-1.16.1/libocispec/runtime-spec/implementations.md0000664000000000000000000000450214160576556021240 0ustar0000000000000000# Implementations The following sections link to associated projects, some of which are maintained by the OCI and some of which are maintained by external organizations. If you know of any associated projects that are not listed here, please file a pull request adding a link to that project. ## Runtime (Container) * [alibaba/inclavare-containers][rune] - Enclave OCI runtime for confidential computing * [containers/crun][crun] - Runtime implementation in C * [containers/youki][youki] - Runtime implementation in Rust * [opencontainers/runc][runc] - Reference implementation of OCI runtime * [projectatomic/bwrap-oci][bwrap-oci] - Convert the OCI spec file to a command line for [bubblewrap][bubblewrap] ## Runtime (Virtual Machine) * [clearcontainers/runtime][cc-runtime] - Hypervisor-based OCI runtime utilising [virtcontainers][virtcontainers] by Intel®. * [google/gvisor][gvisor] - gVisor is a user-space kernel, contains runsc to run sandboxed containers. * [hyperhq/runv][runv] - Hypervisor-based runtime for OCI * [kata-containers/runtime][kata-runtime] - Hypervisor-based OCI runtime combining technology from [clearcontainers/runtime][cc-runtime] and [hyperhq/runv][runv]. ## Testing & Tools * [huawei-openlab/oct][oct] - Open Container Testing framework for OCI configuration and runtime * [kunalkushwaha/octool][octool] - A config linter and validator. * [opencontainers/runtime-tools][runtime-tools] - A config generator and runtime/bundle testing framework. [bubblewrap]: https://github.com/projectatomic/bubblewrap [bwrap-oci]: https://github.com/projectatomic/bwrap-oci [cc-runtime]: https://github.com/clearcontainers/runtime [crun]: https://github.com/containers/crun [gvisor]: https://github.com/google/gvisor [kata-runtime]: https://github.com/kata-containers/runtime [oct]: https://github.com/huawei-openlab/oct [octool]: https://github.com/kunalkushwaha/octool [runc]: https://github.com/opencontainers/runc [rune]: https://github.com/alibaba/inclavare-containers [runtime-tools]: https://github.com/opencontainers/runtime-tools [runv]: https://github.com/hyperhq/runv [virtcontainers]: https://github.com/containers/virtcontainers [youki]: https://github.com/containers/youkicrun-1.16.1/libocispec/runtime-spec/features.md0000644000000000000000000002203214614670026017631 0ustar0000000000000000# Features Structure A [runtime](glossary.md#runtime) MAY provide a JSON structure about its implemented features to [runtime callers](glossary.md#runtime-caller). This JSON structure is called ["Features structure"](glossary.md#features-structure). The Features structure is irrelevant to the actual availability of the features in the host operating system. Hence, the content of the Features structure SHOULD be determined on the compilation time of the runtime, not on the execution time. All properties in the Features structure except `ociVersionMin` and `ociVersionMax` MAY either be absent or have the `null` value. The `null` value MUST NOT be confused with an empty value such as `0`, `false`, `""`, `[]`, and `{}`. ## Specification version * **`ociVersionMin`** (string, REQUIRED) The minimum recognized version of the Open Container Initiative Runtime Specification. The runtime MUST accept this value as the [`ociVersion` property of `config.json`](config.md#specification-version). * **`ociVersionMax`** (string, REQUIRED) The maximum recognized version of the Open Container Initiative Runtime Specification. The runtime MUST accept this value as the [`ociVersion` property of `config.json`](config.md#specification-version). The value MUST NOT be less than the value of the `ociVersionMin` property. The Features structure MUST NOT contain properties that are not defined in this version of the Open Container Initiative Runtime Specification. ### Example ```json { "ociVersionMin": "1.0.0", "ociVersionMax": "1.1.0" } ``` ## Hooks * **`hooks`** (array of strings, OPTIONAL) The recognized names of the [hooks](config.md#posix-platform-hooks). The runtime MUST support the elements in this array as the [`hooks` property of `config.json`](config.md#posix-platform-hooks). ### Example ```json "hooks": [ "prestart", "createRuntime", "createContainer", "startContainer", "poststart", "poststop" ] ``` ## Mount Options * **`mountOptions`** (array of strings, OPTIONAL) The recognized names of the mount options, including options that might not be supported by the host operating system. The runtime MUST recognize the elements in this array as the [`options` of `mounts` objects in `config.json`](config.md#mounts). * Linux: this array SHOULD NOT contain filesystem-specific mount options that are passed to the [mount(2)][mount.2] syscall as `const void *data`. ### Example ```json "mountOptions": [ "acl", "async", "atime", "bind", "defaults", "dev", "diratime", "dirsync", "exec", "iversion", "lazytime", "loud", "mand", "noacl", "noatime", "nodev", "nodiratime", "noexec", "noiversion", "nolazytime", "nomand", "norelatime", "nostrictatime", "nosuid", "nosymfollow", "private", "ratime", "rbind", "rdev", "rdiratime", "relatime", "remount", "rexec", "rnoatime", "rnodev", "rnodiratime", "rnoexec", "rnorelatime", "rnostrictatime", "rnosuid", "rnosymfollow", "ro", "rprivate", "rrelatime", "rro", "rrw", "rshared", "rslave", "rstrictatime", "rsuid", "rsymfollow", "runbindable", "rw", "shared", "silent", "slave", "strictatime", "suid", "symfollow", "sync", "tmpcopyup", "unbindable" ] ``` ## Platform-specific features * **`linux`** (object, OPTIONAL) [Linux-specific features](features-linux.md). This MAY be set if the runtime supports `linux` platform. ## Annotations **`annotations`** (object, OPTIONAL) contains arbitrary metadata of the runtime. This information MAY be structured or unstructured. Annotations MUST be a key-value map that follows the same convention as the Key and Values of the [`annotations` property of `config.json`](config.md#annotations). However, annotations do not need to contain the possible values of the [`annotations` property of `config.json`](config.md#annotations). The current version of the spec do not provide a way to enumerate the possible values of the [`annotations` property of `config.json`](config.md#annotations). ### Example ```json "annotations": { "org.opencontainers.runc.checkpoint.enabled": "true", "org.opencontainers.runc.version": "1.1.0" } ``` ## Unsafe annotations in `config.json` **`potentiallyUnsafeConfigAnnotations`** (array of strings, OPTIONAL) contains values of [`annotations` property of `config.json`](config.md#annotations) that may potentially change the behavior of the runtime. A value that ends with "." is interpreted as a prefix of annotations. ### Example ```json "potentiallyUnsafeConfigAnnotations": [ "com.example.foo.bar", "org.systemd.property." ] ``` The example above matches `com.example.foo.bar`, `org.systemd.property.ExecStartPre`, etc. The example does not match `com.example.foo.bar.baz`. # Example Here is a full example for reference. ```json { "ociVersionMin": "1.0.0", "ociVersionMax": "1.1.0-rc.2", "hooks": [ "prestart", "createRuntime", "createContainer", "startContainer", "poststart", "poststop" ], "mountOptions": [ "async", "atime", "bind", "defaults", "dev", "diratime", "dirsync", "exec", "iversion", "lazytime", "loud", "mand", "noatime", "nodev", "nodiratime", "noexec", "noiversion", "nolazytime", "nomand", "norelatime", "nostrictatime", "nosuid", "nosymfollow", "private", "ratime", "rbind", "rdev", "rdiratime", "relatime", "remount", "rexec", "rnoatime", "rnodev", "rnodiratime", "rnoexec", "rnorelatime", "rnostrictatime", "rnosuid", "rnosymfollow", "ro", "rprivate", "rrelatime", "rro", "rrw", "rshared", "rslave", "rstrictatime", "rsuid", "rsymfollow", "runbindable", "rw", "shared", "silent", "slave", "strictatime", "suid", "symfollow", "sync", "tmpcopyup", "unbindable" ], "linux": { "namespaces": [ "cgroup", "ipc", "mount", "network", "pid", "user", "uts" ], "capabilities": [ "CAP_CHOWN", "CAP_DAC_OVERRIDE", "CAP_DAC_READ_SEARCH", "CAP_FOWNER", "CAP_FSETID", "CAP_KILL", "CAP_SETGID", "CAP_SETUID", "CAP_SETPCAP", "CAP_LINUX_IMMUTABLE", "CAP_NET_BIND_SERVICE", "CAP_NET_BROADCAST", "CAP_NET_ADMIN", "CAP_NET_RAW", "CAP_IPC_LOCK", "CAP_IPC_OWNER", "CAP_SYS_MODULE", "CAP_SYS_RAWIO", "CAP_SYS_CHROOT", "CAP_SYS_PTRACE", "CAP_SYS_PACCT", "CAP_SYS_ADMIN", "CAP_SYS_BOOT", "CAP_SYS_NICE", "CAP_SYS_RESOURCE", "CAP_SYS_TIME", "CAP_SYS_TTY_CONFIG", "CAP_MKNOD", "CAP_LEASE", "CAP_AUDIT_WRITE", "CAP_AUDIT_CONTROL", "CAP_SETFCAP", "CAP_MAC_OVERRIDE", "CAP_MAC_ADMIN", "CAP_SYSLOG", "CAP_WAKE_ALARM", "CAP_BLOCK_SUSPEND", "CAP_AUDIT_READ", "CAP_PERFMON", "CAP_BPF", "CAP_CHECKPOINT_RESTORE" ], "cgroup": { "v1": true, "v2": true, "systemd": true, "systemdUser": true, "rdma": true }, "seccomp": { "enabled": true, "actions": [ "SCMP_ACT_ALLOW", "SCMP_ACT_ERRNO", "SCMP_ACT_KILL", "SCMP_ACT_KILL_PROCESS", "SCMP_ACT_KILL_THREAD", "SCMP_ACT_LOG", "SCMP_ACT_NOTIFY", "SCMP_ACT_TRACE", "SCMP_ACT_TRAP" ], "operators": [ "SCMP_CMP_EQ", "SCMP_CMP_GE", "SCMP_CMP_GT", "SCMP_CMP_LE", "SCMP_CMP_LT", "SCMP_CMP_MASKED_EQ", "SCMP_CMP_NE" ], "archs": [ "SCMP_ARCH_AARCH64", "SCMP_ARCH_ARM", "SCMP_ARCH_MIPS", "SCMP_ARCH_MIPS64", "SCMP_ARCH_MIPS64N32", "SCMP_ARCH_MIPSEL", "SCMP_ARCH_MIPSEL64", "SCMP_ARCH_MIPSEL64N32", "SCMP_ARCH_PPC", "SCMP_ARCH_PPC64", "SCMP_ARCH_PPC64LE", "SCMP_ARCH_RISCV64", "SCMP_ARCH_S390", "SCMP_ARCH_S390X", "SCMP_ARCH_X32", "SCMP_ARCH_X86", "SCMP_ARCH_X86_64" ], "knownFlags": [ "SECCOMP_FILTER_FLAG_TSYNC", "SECCOMP_FILTER_FLAG_SPEC_ALLOW", "SECCOMP_FILTER_FLAG_LOG" ], "supportedFlags": [ "SECCOMP_FILTER_FLAG_TSYNC", "SECCOMP_FILTER_FLAG_SPEC_ALLOW", "SECCOMP_FILTER_FLAG_LOG" ] }, "apparmor": { "enabled": true }, "selinux": { "enabled": true }, "intelRdt": { "enabled": true } }, "annotations": { "io.github.seccomp.libseccomp.version": "2.5.4", "org.opencontainers.runc.checkpoint.enabled": "true", "org.opencontainers.runc.commit": "v1.1.0-534-g26851168", "org.opencontainers.runc.version": "1.1.0+dev" } } ``` [mount.2]: https://man7.org/linux/man-pages/man2/mount.2.html crun-1.16.1/libocispec/runtime-spec/principles.md0000664000000000000000000000713613677106243020200 0ustar0000000000000000# The 5 principles of Standard Containers Define a unit of software delivery called a Standard Container. The goal of a Standard Container is to encapsulate a software component and all its dependencies in a format that is self-describing and portable, so that any compliant runtime can run it without extra dependencies, regardless of the underlying machine and the contents of the container. The specification for Standard Containers defines: 1. configuration file formats 2. a set of standard operations 3. an execution environment. A great analogy for this is the physical shipping container used by the transportation industry. Shipping containers are a fundamental unit of delivery, they can be lifted, stacked, locked, loaded, unloaded and labelled. Irrespective of their contents, by standardizing the container itself it allowed for a consistent, more streamlined and efficient set of processes to be defined. For software Standard Containers offer similar functionality by being the fundamental, standardized, unit of delivery for a software package. ## 1. Standard operations Standard Containers define a set of STANDARD OPERATIONS. They can be created, started, and stopped using standard container tools; copied and snapshotted using standard filesystem tools; and downloaded and uploaded using standard network tools. ## 2. Content-agnostic Standard Containers are CONTENT-AGNOSTIC: all standard operations have the same effect regardless of the contents. They are started in the same way whether they contain a postgres database, a php application with its dependencies and application server, or Java build artifacts. ## 3. Infrastructure-agnostic Standard Containers are INFRASTRUCTURE-AGNOSTIC: they can be run in any OCI supported infrastructure. For example, a standard container can be bundled on a laptop, uploaded to cloud storage, downloaded, run and snapshotted by a build server at a fiber hotel in Virginia, uploaded to 10 staging servers in a home-made private cloud cluster, then sent to 30 production instances across 3 public cloud regions. ## 4. Designed for automation Standard Containers are DESIGNED FOR AUTOMATION: because they offer the same standard operations regardless of content and infrastructure, Standard Containers, are extremely well-suited for automation. In fact, you could say automation is their secret weapon. Many things that once required time-consuming and error-prone human effort can now be programmed. Before Standard Containers, by the time a software component ran in production, it had been individually built, configured, bundled, documented, patched, vendored, templated, tweaked and instrumented by 10 different people on 10 different computers. Builds failed, libraries conflicted, mirrors crashed, post-it notes were lost, logs were misplaced, cluster updates were half-broken. The process was slow, inefficient and cost a fortune - and was entirely different depending on the language and infrastructure provider. ## 5. Industrial-grade delivery Standard Containers make INDUSTRIAL-GRADE DELIVERY of software a reality. Leveraging all of the properties listed above, Standard Containers are enabling large and small enterprises to streamline and automate their software delivery pipelines. Whether it is in-house devOps flows, or external customer-based software delivery mechanisms, Standard Containers are changing the way the community thinks about software packaging and delivery. crun-1.16.1/libocispec/runtime-spec/runtime-linux.md0000664000000000000000000000200013677106243020631 0ustar0000000000000000# Linux Runtime ## File descriptors By default, only the `stdin`, `stdout` and `stderr` file descriptors are kept open for the application by the runtime. The runtime MAY pass additional file descriptors to the application to support features such as [socket activation][socket-activated-containers]. Some of the file descriptors MAY be redirected to `/dev/null` even though they are open. ## Dev symbolic links While creating the container (step 2 in the [lifecycle](runtime.md#lifecycle)), runtimes MUST create the following symlinks if the source file exists after processing [`mounts`](config.md#mounts): | Source | Destination | | --------------- | ----------- | | /proc/self/fd | /dev/fd | | /proc/self/fd/0 | /dev/stdin | | /proc/self/fd/1 | /dev/stdout | | /proc/self/fd/2 | /dev/stderr | [socket-activated-containers]: http://0pointer.de/blog/projects/socket-activated-containers.html crun-1.16.1/libocispec/runtime-spec/schema/0000775000000000000000000000000014614670026016734 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/schema/test/0000775000000000000000000000000014416051456017713 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/schema/test/state/0000775000000000000000000000000013677106243021036 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/schema/test/state/bad/0000775000000000000000000000000013677106243021564 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/schema/test/state/bad/invalid-json.json0000664000000000000000000000000313677106243025045 0ustar0000000000000000{] crun-1.16.1/libocispec/runtime-spec/schema/test/state/good/0000775000000000000000000000000013677106243021766 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/schema/test/state/good/spec-example.json0000664000000000000000000000027613677106243025251 0ustar0000000000000000{ "ociVersion": "0.2.0", "id": "oci-container1", "status": "running", "pid": 4422, "bundle": "/containers/redis", "annotations": { "myKey": "myValue" } } crun-1.16.1/libocispec/runtime-spec/schema/test/config/0000775000000000000000000000000013677106243021163 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/schema/test/config/bad/0000775000000000000000000000000013677106243021711 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/schema/test/config/bad/invalid-json.json0000664000000000000000000000000313677106243025172 0ustar0000000000000000{] crun-1.16.1/libocispec/runtime-spec/schema/test/config/bad/linux-hugepage.json0000664000000000000000000000044213677106243025526 0ustar0000000000000000{ "ociVersion": "1.0.0", "root": { "path": "rootfs" }, "linux": { "resources": { "hugepageLimits": [ { "limit": 1234123, "pageSize": "64kB" } ] } } } crun-1.16.1/libocispec/runtime-spec/schema/test/config/bad/linux-rdma.json0000664000000000000000000000040613677106243024664 0ustar0000000000000000{ "ociVersion": "1.0.0", "root": { "path": "rootfs" }, "linux": { "resources": { "rdma": { "mlx5_1": { "hcaHandles": "not a uint32" } } } } } crun-1.16.1/libocispec/runtime-spec/schema/test/config/good/0000775000000000000000000000000014416051456022110 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/schema/test/config/good/spec-example.json0000644000000000000000000002456414416051456025377 0ustar0000000000000000{ "ociVersion": "0.5.0-dev", "process": { "terminal": true, "user": { "uid": 1, "gid": 1, "additionalGids": [ 5, 6 ] }, "args": [ "sh" ], "env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm" ], "cwd": "/", "capabilities": { "bounding": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "permitted": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "inheritable": [ "CAP_AUDIT_WRITE", "CAP_KILL", "CAP_NET_BIND_SERVICE" ], "effective": [ "CAP_AUDIT_WRITE", "CAP_KILL" ], "ambient": [ "CAP_NET_BIND_SERVICE" ] }, "rlimits": [ { "type": "RLIMIT_CORE", "hard": 1024, "soft": 1024 }, { "type": "RLIMIT_NOFILE", "hard": 1024, "soft": 1024 } ], "apparmorProfile": "acme_secure_profile", "selinuxLabel": "system_u:system_r:svirt_lxc_net_t:s0:c124,c675", "noNewPrivileges": true }, "root": { "path": "rootfs", "readonly": true }, "hostname": "slartibartfast", "domainname": "foobarbaz.test", "mounts": [ { "destination": "/proc", "type": "proc", "source": "proc" }, { "destination": "/dev", "type": "tmpfs", "source": "tmpfs", "options": [ "nosuid", "strictatime", "mode=755", "size=65536k" ] }, { "destination": "/dev/pts", "type": "devpts", "source": "devpts", "options": [ "nosuid", "noexec", "newinstance", "ptmxmode=0666", "mode=0620", "gid=5" ] }, { "destination": "/dev/shm", "type": "tmpfs", "source": "shm", "options": [ "nosuid", "noexec", "nodev", "mode=1777", "size=65536k" ] }, { "destination": "/dev/mqueue", "type": "mqueue", "source": "mqueue", "options": [ "nosuid", "noexec", "nodev" ] }, { "destination": "/sys", "type": "sysfs", "source": "sysfs", "options": [ "nosuid", "noexec", "nodev" ] }, { "destination": "/sys/fs/cgroup", "type": "cgroup", "source": "cgroup", "options": [ "nosuid", "noexec", "nodev", "relatime", "ro" ] } ], "hooks": { "prestart": [ { "path": "/usr/bin/fix-mounts", "args": [ "fix-mounts", "arg1", "arg2" ], "env": [ "key1=value1" ] }, { "path": "/usr/bin/setup-network" } ], "createRuntime": [ { "path": "/usr/bin/fix-mounts", "args": ["fix-mounts", "arg1", "arg2"], "env": [ "key1=value1"] }, { "path": "/usr/bin/setup-network" } ], "createContainer": [ { "path": "/usr/bin/mount-hook", "args": ["-mount", "arg1", "arg2"], "env": [ "key1=value1"] } ], "startContainer": [ { "path": "/usr/bin/refresh-ldcache" } ], "poststart": [ { "path": "/usr/bin/notify-start", "timeout": 5 } ], "poststop": [ { "path": "/usr/sbin/cleanup.sh", "args": [ "cleanup.sh", "-f" ] } ] }, "linux": { "devices": [ { "path": "/dev/fuse", "type": "c", "major": 10, "minor": 229, "fileMode": 438, "uid": 0, "gid": 0 }, { "path": "/dev/sda", "type": "b", "major": 8, "minor": 0, "fileMode": 432, "uid": 0, "gid": 0 } ], "uidMappings": [ { "containerID": 0, "hostID": 1000, "size": 32000 } ], "gidMappings": [ { "containerID": 0, "hostID": 1000, "size": 32000 } ], "sysctl": { "net.ipv4.ip_forward": "1", "net.core.somaxconn": "256" }, "cgroupsPath": "/myRuntime/myContainer", "resources": { "network": { "classID": 1048577, "priorities": [ { "name": "eth0", "priority": 500 }, { "name": "eth1", "priority": 1000 } ] }, "pids": { "limit": 32771 }, "hugepageLimits": [ { "pageSize": "2MB", "limit": 9223372036854772000 }, { "pageSize": "64KB", "limit": 1000000 } ], "oomScoreAdj": 100, "memory": { "limit": 536870912, "reservation": 536870912, "swap": 536870912, "kernel": -1, "kernelTCP": -1, "swappiness": 0, "disableOOMKiller": false, "useHierarchy": false, "checkBeforeUpdate": false }, "cpu": { "shares": 1024, "quota": 1000000, "burst": 1000000, "period": 500000, "realtimeRuntime": 950000, "realtimePeriod": 1000000, "cpus": "2-3", "mems": "0-7" }, "devices": [ { "allow": false, "access": "rwm" }, { "allow": true, "type": "c", "major": 10, "minor": 229, "access": "rw" }, { "allow": true, "type": "b", "major": 8, "minor": 0, "access": "r" } ], "blockIO": { "weight": 10, "leafWeight": 10, "weightDevice": [ { "major": 8, "minor": 0, "weight": 500, "leafWeight": 300 }, { "major": 8, "minor": 16, "weight": 500 } ], "throttleReadBpsDevice": [ { "major": 8, "minor": 0, "rate": 600 } ], "throttleWriteIOPSDevice": [ { "major": 8, "minor": 16, "rate": 300 } ] } }, "rootfsPropagation": "slave", "seccomp": { "defaultAction": "SCMP_ACT_ALLOW", "architectures": [ "SCMP_ARCH_X86", "SCMP_ARCH_X32" ], "syscalls": [ { "names": [ "getcwd", "chmod" ], "action": "SCMP_ACT_ERRNO" } ] }, "timeOffsets": { "monotonic": { "secs": 172800, "nanosecs": 0 }, "boottime": { "secs": 604800, "nanosecs": 0 } }, "namespaces": [ { "type": "pid" }, { "type": "network" }, { "type": "ipc" }, { "type": "uts" }, { "type": "mount" }, { "type": "user" }, { "type": "cgroup" }, { "type": "time" } ], "maskedPaths": [ "/proc/kcore", "/proc/latency_stats", "/proc/timer_stats", "/proc/sched_debug" ], "readonlyPaths": [ "/proc/asound", "/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger" ], "mountLabel": "system_u:object_r:svirt_sandbox_file_t:s0:c715,c811" }, "annotations": { "com.example.key1": "value1", "com.example.key2": "value2" } } crun-1.16.1/libocispec/runtime-spec/schema/test/config/good/linux-rdma.json0000664000000000000000000000071513677106243025071 0ustar0000000000000000{ "ociVersion": "1.0.0", "root": { "path": "rootfs" }, "linux": { "resources": { "rdma": { "mlx5_1": { "hcaHandles": 3, "hcaObjects": 10000 }, "mlx4_0": { "hcaObjects": 1000 }, "rxe3": { "hcaObjects": 10000 } } } } } crun-1.16.1/libocispec/runtime-spec/schema/test/config/good/minimal-for-start.json0000664000000000000000000000035513677106243026356 0ustar0000000000000000{ "ociVersion": "1.0.0", "root": { "path": "rootfs" }, "process": { "cwd": "/", "args": [ "sh" ], "user": { "uid": 0, "gid": 0 } } } crun-1.16.1/libocispec/runtime-spec/schema/test/config/good/minimal.json0000664000000000000000000000011413677106243024430 0ustar0000000000000000{ "ociVersion": "1.0.0", "root": { "path": "rootfs" } } crun-1.16.1/libocispec/runtime-spec/schema/test/config/good/zos-minimal.json0000664000000000000000000000014014160576556025246 0ustar0000000000000000{ "ociVersion": "1.0.0", "root": { "path": "rootfs" }, "zos": { } } crun-1.16.1/libocispec/runtime-spec/schema/test/features/0000755000000000000000000000000014416051456021527 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/schema/test/features/good/0000755000000000000000000000000014416051456022457 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/schema/test/features/good/minimal.json0000644000000000000000000000007714416051456025004 0ustar0000000000000000{ "ociVersionMin": "1.0.0", "ociVersionMax": "1.1.0" } crun-1.16.1/libocispec/runtime-spec/schema/test/features/good/runc.json0000644000000000000000000001125114416051456024321 0ustar0000000000000000{ "ociVersionMin": "1.0.0", "ociVersionMax": "1.0.2-dev", "hooks": [ "prestart", "createRuntime", "createContainer", "startContainer", "poststart", "poststop" ], "mountOptions": [ "acl", "async", "atime", "bind", "defaults", "dev", "diratime", "dirsync", "exec", "iversion", "lazytime", "loud", "mand", "noacl", "noatime", "nodev", "nodiratime", "noexec", "noiversion", "nolazytime", "nomand", "norelatime", "nostrictatime", "nosuid", "nosymfollow", "private", "ratime", "rbind", "rdev", "rdiratime", "relatime", "remount", "rexec", "rnoatime", "rnodev", "rnodiratime", "rnoexec", "rnorelatime", "rnostrictatime", "rnosuid", "rnosymfollow", "ro", "rprivate", "rrelatime", "rro", "rrw", "rshared", "rslave", "rstrictatime", "rsuid", "rsymfollow", "runbindable", "rw", "shared", "silent", "slave", "strictatime", "suid", "symfollow", "sync", "tmpcopyup", "unbindable" ], "linux": { "namespaces": [ "cgroup", "ipc", "mount", "network", "pid", "user", "uts" ], "capabilities": [ "CAP_CHOWN", "CAP_DAC_OVERRIDE", "CAP_DAC_READ_SEARCH", "CAP_FOWNER", "CAP_FSETID", "CAP_KILL", "CAP_SETGID", "CAP_SETUID", "CAP_SETPCAP", "CAP_LINUX_IMMUTABLE", "CAP_NET_BIND_SERVICE", "CAP_NET_BROADCAST", "CAP_NET_ADMIN", "CAP_NET_RAW", "CAP_IPC_LOCK", "CAP_IPC_OWNER", "CAP_SYS_MODULE", "CAP_SYS_RAWIO", "CAP_SYS_CHROOT", "CAP_SYS_PTRACE", "CAP_SYS_PACCT", "CAP_SYS_ADMIN", "CAP_SYS_BOOT", "CAP_SYS_NICE", "CAP_SYS_RESOURCE", "CAP_SYS_TIME", "CAP_SYS_TTY_CONFIG", "CAP_MKNOD", "CAP_LEASE", "CAP_AUDIT_WRITE", "CAP_AUDIT_CONTROL", "CAP_SETFCAP", "CAP_MAC_OVERRIDE", "CAP_MAC_ADMIN", "CAP_SYSLOG", "CAP_WAKE_ALARM", "CAP_BLOCK_SUSPEND", "CAP_AUDIT_READ", "CAP_PERFMON", "CAP_BPF", "CAP_CHECKPOINT_RESTORE" ], "cgroup": { "v1": true, "v2": true, "systemd": true, "systemdUser": true }, "seccomp": { "enabled": true, "actions": [ "SCMP_ACT_ALLOW", "SCMP_ACT_ERRNO", "SCMP_ACT_KILL", "SCMP_ACT_LOG", "SCMP_ACT_NOTIFY", "SCMP_ACT_TRACE", "SCMP_ACT_TRAP" ], "operators": [ "SCMP_CMP_EQ", "SCMP_CMP_GE", "SCMP_CMP_GT", "SCMP_CMP_LE", "SCMP_CMP_LT", "SCMP_CMP_MASKED_EQ", "SCMP_CMP_NE" ], "archs": [ "SCMP_ARCH_AARCH64", "SCMP_ARCH_ARM", "SCMP_ARCH_MIPS", "SCMP_ARCH_MIPS64", "SCMP_ARCH_MIPS64N32", "SCMP_ARCH_MIPSEL", "SCMP_ARCH_MIPSEL64", "SCMP_ARCH_MIPSEL64N32", "SCMP_ARCH_PPC", "SCMP_ARCH_PPC64", "SCMP_ARCH_PPC64LE", "SCMP_ARCH_S390", "SCMP_ARCH_S390X", "SCMP_ARCH_X32", "SCMP_ARCH_X86", "SCMP_ARCH_X86_64" ], "knownFlags": [ "SECCOMP_FILTER_FLAG_LOG" ], "supportedFlags": [ "SECCOMP_FILTER_FLAG_LOG" ] }, "apparmor": { "enabled": true }, "selinux": { "enabled": true } }, "annotations": { "io.github.seccomp.libseccomp.version": "2.5.4", "org.opencontainers.runc.checkpoint.enabled": "true", "org.opencontainers.runc.commit": "v1.1.0-368-ga1c51c56", "org.opencontainers.runc.version": "1.1.0+dev" } } crun-1.16.1/libocispec/runtime-spec/schema/test/features/bad/0000755000000000000000000000000014416051456022255 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/schema/test/features/bad/missing-ociVersionMax.json0000644000000000000000000000004114416051456027400 0ustar0000000000000000{ "ociVersionMin": "1.1.0" } crun-1.16.1/libocispec/runtime-spec/schema/config-schema.json0000644000000000000000000002027014460417222022325 0ustar0000000000000000{ "description": "Open Container Initiative Runtime Specification Container Configuration Schema", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "ociVersion": { "$ref": "defs.json#/definitions/ociVersion" }, "hooks": { "type": "object", "properties": { "prestart": { "$ref": "defs.json#/definitions/ArrayOfHooks" }, "createRuntime": { "$ref": "defs.json#/definitions/ArrayOfHooks" }, "createContainer": { "$ref": "defs.json#/definitions/ArrayOfHooks" }, "startContainer": { "$ref": "defs.json#/definitions/ArrayOfHooks" }, "poststart": { "$ref": "defs.json#/definitions/ArrayOfHooks" }, "poststop": { "$ref": "defs.json#/definitions/ArrayOfHooks" } } }, "annotations": { "$ref": "defs.json#/definitions/annotations" }, "hostname": { "type": "string" }, "domainname": { "type": "string" }, "mounts": { "type": "array", "items": { "$ref": "defs.json#/definitions/Mount" } }, "root": { "description": "Configures the container's root filesystem.", "type": "object", "required": [ "path" ], "properties": { "path": { "$ref": "defs.json#/definitions/FilePath" }, "readonly": { "type": "boolean" } } }, "process": { "type": "object", "required": [ "cwd" ], "properties": { "args": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "commandLine": { "type": "string" }, "consoleSize": { "type": "object", "required": [ "height", "width" ], "properties": { "height": { "$ref": "defs.json#/definitions/uint64" }, "width": { "$ref": "defs.json#/definitions/uint64" } } }, "cwd": { "type": "string" }, "env": { "$ref": "defs.json#/definitions/Env" }, "terminal": { "type": "boolean" }, "user": { "type": "object", "properties": { "uid": { "$ref": "defs.json#/definitions/UID" }, "gid": { "$ref": "defs.json#/definitions/GID" }, "umask": { "$ref": "defs.json#/definitions/Umask" }, "additionalGids": { "$ref": "defs.json#/definitions/ArrayOfGIDs" }, "username": { "type": "string" } } }, "capabilities": { "type": "object", "properties": { "bounding": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "permitted": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "effective": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "inheritable": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "ambient": { "$ref": "defs.json#/definitions/ArrayOfStrings" } } }, "apparmorProfile": { "type": "string" }, "oomScoreAdj": { "type": "integer" }, "selinuxLabel": { "type": "string" }, "ioPriority": { "type": "object", "required": [ "class" ], "properties": { "class": { "type": "string", "enum": [ "IOPRIO_CLASS_RT", "IOPRIO_CLASS_BE", "IOPRIO_CLASS_IDLE" ] }, "priority": { "$ref": "defs.json#/definitions/int32" } } }, "noNewPrivileges": { "type": "boolean" }, "scheduler": { "type": "object", "required": [ "policy" ], "properties": { "policy": { "$ref": "defs-linux.json#/definitions/SchedulerPolicy" }, "nice": { "$ref": "defs.json#/definitions/int32" }, "priority": { "$ref": "defs.json#/definitions/int32" }, "flags": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/SchedulerFlag" } }, "runtime": { "$ref": "defs.json#/definitions/uint64" }, "deadline": { "$ref": "defs.json#/definitions/uint64" }, "period": { "$ref": "defs.json#/definitions/uint64" } } }, "rlimits": { "type": "array", "items": { "type": "object", "required": [ "type", "soft", "hard" ], "properties": { "hard": { "$ref": "defs.json#/definitions/uint64" }, "soft": { "$ref": "defs.json#/definitions/uint64" }, "type": { "type": "string", "pattern": "^RLIMIT_[A-Z]+$" } } } } } }, "linux": { "$ref": "config-linux.json#/linux" }, "solaris": { "$ref": "config-solaris.json#/solaris" }, "windows": { "$ref": "config-windows.json#/windows" }, "vm": { "$ref": "config-vm.json#/vm" }, "zos": { "$ref": "config-zos.json#/zos" } }, "required": [ "ociVersion" ] } crun-1.16.1/libocispec/runtime-spec/schema/defs-linux.json0000644000000000000000000002356414432210717021710 0ustar0000000000000000{ "definitions": { "PersonalityDomain": { "type": "string", "enum": [ "LINUX", "LINUX32" ] }, "Personality": { "type": "object", "properties": { "domain": { "$ref": "#/definitions/PersonalityDomain" }, "flags": { "$ref": "defs.json#/definitions/ArrayOfStrings" } } }, "RootfsPropagation": { "type": "string", "enum": [ "private", "shared", "slave", "unbindable" ] }, "SeccompArch": { "type": "string", "enum": [ "SCMP_ARCH_X86", "SCMP_ARCH_X86_64", "SCMP_ARCH_X32", "SCMP_ARCH_ARM", "SCMP_ARCH_AARCH64", "SCMP_ARCH_MIPS", "SCMP_ARCH_MIPS64", "SCMP_ARCH_MIPS64N32", "SCMP_ARCH_MIPSEL", "SCMP_ARCH_MIPSEL64", "SCMP_ARCH_MIPSEL64N32", "SCMP_ARCH_PPC", "SCMP_ARCH_PPC64", "SCMP_ARCH_PPC64LE", "SCMP_ARCH_S390", "SCMP_ARCH_S390X", "SCMP_ARCH_PARISC", "SCMP_ARCH_PARISC64", "SCMP_ARCH_RISCV64" ] }, "SeccompAction": { "type": "string", "enum": [ "SCMP_ACT_KILL", "SCMP_ACT_KILL_PROCESS", "SCMP_ACT_KILL_THREAD", "SCMP_ACT_TRAP", "SCMP_ACT_ERRNO", "SCMP_ACT_TRACE", "SCMP_ACT_ALLOW", "SCMP_ACT_LOG", "SCMP_ACT_NOTIFY" ] }, "SeccompFlag": { "type": "string", "enum": [ "SECCOMP_FILTER_FLAG_TSYNC", "SECCOMP_FILTER_FLAG_LOG", "SECCOMP_FILTER_FLAG_SPEC_ALLOW", "SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV" ] }, "SeccompOperators": { "type": "string", "enum": [ "SCMP_CMP_NE", "SCMP_CMP_LT", "SCMP_CMP_LE", "SCMP_CMP_EQ", "SCMP_CMP_GE", "SCMP_CMP_GT", "SCMP_CMP_MASKED_EQ" ] }, "SyscallArg": { "type": "object", "properties": { "index": { "$ref": "defs.json#/definitions/uint32" }, "value": { "$ref": "defs.json#/definitions/uint64" }, "valueTwo": { "$ref": "defs.json#/definitions/uint64" }, "op": { "$ref": "#/definitions/SeccompOperators" } }, "required": [ "index", "value", "op" ] }, "Syscall": { "type": "object", "properties": { "names": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, "action": { "$ref": "#/definitions/SeccompAction" }, "errnoRet": { "$ref": "defs.json#/definitions/uint32" }, "args": { "type": "array", "items": { "$ref": "#/definitions/SyscallArg" } } }, "required": [ "names", "action" ] }, "Major": { "description": "major device number", "$ref": "defs.json#/definitions/int64" }, "Minor": { "description": "minor device number", "$ref": "defs.json#/definitions/int64" }, "FileMode": { "description": "File permissions mode (typically an octal value)", "type": "integer", "minimum": 0, "maximum": 512 }, "FileType": { "description": "Type of a block or special character device", "type": "string", "pattern": "^[cbup]$" }, "Device": { "type": "object", "required": [ "type", "path" ], "properties": { "type": { "$ref": "#/definitions/FileType" }, "path": { "$ref": "defs.json#/definitions/FilePath" }, "fileMode": { "$ref": "#/definitions/FileMode" }, "major": { "$ref": "#/definitions/Major" }, "minor": { "$ref": "#/definitions/Minor" }, "uid": { "$ref": "defs.json#/definitions/UID" }, "gid": { "$ref": "defs.json#/definitions/GID" } } }, "weight": { "$ref": "defs.json#/definitions/uint16" }, "blockIODevice": { "type": "object", "properties": { "major": { "$ref": "#/definitions/Major" }, "minor": { "$ref": "#/definitions/Minor" } }, "required": [ "major", "minor" ] }, "blockIODeviceWeight": { "type": "object", "allOf": [ { "$ref": "#/definitions/blockIODevice" }, { "type": "object", "properties": { "weight": { "$ref": "#/definitions/weight" }, "leafWeight": { "$ref": "#/definitions/weight" } } } ] }, "blockIODeviceThrottle": { "allOf": [ { "$ref": "#/definitions/blockIODevice" }, { "type": "object", "properties": { "rate": { "$ref": "defs.json#/definitions/uint64" } } } ] }, "DeviceCgroup": { "type": "object", "properties": { "allow": { "type": "boolean" }, "type": { "type": "string" }, "major": { "$ref": "#/definitions/Major" }, "minor": { "$ref": "#/definitions/Minor" }, "access": { "type": "string" } }, "required": [ "allow" ] }, "NetworkInterfacePriority": { "type": "object", "properties": { "name": { "type": "string" }, "priority": { "$ref": "defs.json#/definitions/uint32" } }, "required": [ "name", "priority" ] }, "Rdma": { "type": "object", "properties": { "hcaHandles": { "$ref": "defs.json#/definitions/uint32" }, "hcaObjects": { "$ref": "defs.json#/definitions/uint32" } } }, "NamespaceType": { "type": "string", "enum": [ "mount", "pid", "network", "uts", "ipc", "user", "cgroup", "time" ] }, "NamespaceReference": { "type": "object", "properties": { "type": { "$ref": "#/definitions/NamespaceType" }, "path": { "$ref": "defs.json#/definitions/FilePath" } }, "required": [ "type" ] }, "TimeOffsets": { "type": "object", "properties": { "secs": { "$ref": "defs.json#/definitions/int64" }, "nanosecs": { "$ref": "defs.json#/definitions/uint32" } } }, "SchedulerPolicy": { "type": "string", "enum": [ "SCHED_OTHER", "SCHED_FIFO", "SCHED_RR", "SCHED_BATCH", "SCHED_ISO", "SCHED_IDLE", "SCHED_DEADLINE" ] }, "SchedulerFlag": { "type": "string", "enum": [ "SCHED_FLAG_RESET_ON_FORK", "SCHED_FLAG_RECLAIM", "SCHED_FLAG_DL_OVERRUN", "SCHED_FLAG_KEEP_POLICY", "SCHED_FLAG_KEEP_PARAMS", "SCHED_FLAG_UTIL_CLAMP_MIN", "SCHED_FLAG_UTIL_CLAMP_MAX" ] } } } crun-1.16.1/libocispec/runtime-spec/schema/validate.go0000644000000000000000000000426414416051456021060 0ustar0000000000000000package main import ( "fmt" "io" "os" "path/filepath" "strings" "github.com/xeipuuv/gojsonschema" ) const usage = `Validate is used to check document with specified schema. You can use validate in following ways: 1.specify document file as an argument validate 2.pass document content through a pipe cat | validate 3.input document content manually, ended with ctrl+d(or your self-defined EOF keys) validate [INPUT DOCUMENT CONTENT HERE] ` func main() { nargs := len(os.Args[1:]) if nargs == 0 || nargs > 2 { fmt.Printf("ERROR: invalid arguments number\n\n%s\n", usage) os.Exit(1) } if os.Args[1] == "help" || os.Args[1] == "--help" || os.Args[1] == "-h" { fmt.Printf("%s\n", usage) os.Exit(1) } schemaPath := os.Args[1] if !strings.Contains(schemaPath, "://") { var err error schemaPath, err = formatFilePath(schemaPath) if err != nil { fmt.Printf("ERROR: invalid schema-file path: %s\n", err) os.Exit(1) } schemaPath = "file://" + schemaPath } schemaLoader := gojsonschema.NewReferenceLoader(schemaPath) var documentLoader gojsonschema.JSONLoader if nargs > 1 { documentPath, err := formatFilePath(os.Args[2]) if err != nil { fmt.Printf("ERROR: invalid document-file path: %s\n", err) os.Exit(1) } documentLoader = gojsonschema.NewReferenceLoader("file://" + documentPath) } else { documentBytes, err := io.ReadAll(os.Stdin) if err != nil { fmt.Println(err) os.Exit(1) } documentString := string(documentBytes) documentLoader = gojsonschema.NewStringLoader(documentString) } result, err := gojsonschema.Validate(schemaLoader, documentLoader) if err != nil { fmt.Println(err) os.Exit(1) } if result.Valid() { fmt.Printf("The document is valid\n") } else { fmt.Printf("The document is not valid. see errors :\n") for _, desc := range result.Errors() { fmt.Printf("- %s\n", desc) } os.Exit(1) } } func formatFilePath(path string) (string, error) { if _, err := os.Stat(path); err != nil { return "", err } absPath, err := filepath.Abs(path) if err != nil { return "", err } return absPath, nil } crun-1.16.1/libocispec/runtime-spec/schema/features-linux.json0000644000000000000000000000705414614670026022606 0ustar0000000000000000{ "linux": { "description": "Linux platform-specific features", "type": "object", "properties": { "namespaces": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/NamespaceType" } }, "capabilities": { "type": "array", "items": { "type": "string", "pattern": "^CAP_[A-Z_]+$" } }, "cgroup": { "type": "object", "properties": { "v1": { "type": "boolean" }, "v2": { "type": "boolean" }, "systemd": { "type": "boolean" }, "systemdUser": { "type": "boolean" }, "rdma": { "type": "boolean" } } }, "seccomp": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "actions": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/SeccompAction" } }, "operators": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/SeccompOperators" } }, "archs": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/SeccompArch" } }, "knownFlags": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/SeccompFlag" } }, "supportedFlags": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/SeccompFlag" } } } }, "apparmor": { "type": "object", "properties": { "enabled": { "type": "boolean" } } }, "selinux": { "type": "object", "properties": { "enabled": { "type": "boolean" } } }, "intelRdt": { "type": "object", "properties": { "enabled": { "type": "boolean" } } }, "mountExtensions": { "type": "object", "properties": { "idmap": { "type": "object", "properties": { "enabled": { "type": "boolean" } } } } } } } } crun-1.16.1/libocispec/runtime-spec/schema/features-schema.json0000644000000000000000000000166014614670026022704 0ustar0000000000000000{ "description": "Open Container Initiative Runtime Specification Runtime Features Schema", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "ociVersionMin": { "$ref": "defs.json#/definitions/ociVersion" }, "ociVersionMax": { "$ref": "defs.json#/definitions/ociVersion" }, "hooks": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "mountOptions": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "annotations": { "$ref": "defs.json#/definitions/annotations" }, "potentiallyUnsafeConfigAnnotations": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "linux": { "$ref": "features-linux.json#/linux" } }, "required": [ "ociVersionMin", "ociVersionMax" ] } crun-1.16.1/libocispec/runtime-spec/schema/Makefile0000664000000000000000000000251114265762063020400 0ustar0000000000000000GOOD_TESTS = $(wildcard test/good/*.json) BAD_TESTS = $(wildcard test/bad/*.json) default: validate help: @echo "Usage: make [target]" @echo @echo " * 'fmt' - format the json with indentation" @echo " * 'help' - show this help information" @echo " * 'validate' - build the validation tool" fmt: find . -name '*.json' -exec bash -c 'jq --indent 4 -M . {} > xx && mv xx {} || echo "skipping invalid {}"' \; .PHONY: validate validate: validate.go GO111MODULE=auto go get github.com/xeipuuv/gojsonschema GO111MODULE=auto go build ./validate.go test: validate $(TESTS) for TYPE in $$(ls test); \ do \ echo "testing $${TYPE}"; \ for FILE in $$(ls "test/$${TYPE}/good"); \ do \ echo " testing test/$${TYPE}/good/$${FILE}"; \ if ./validate "$${TYPE}-schema.json" "test/$${TYPE}/good/$${FILE}" ; \ then \ echo " received expected validation success" ; \ else \ echo " received unexpected validation failure" ; \ exit 1; \ fi \ done; \ for FILE in $$(ls "test/$${TYPE}/bad"); \ do \ echo " testing test/$${TYPE}/bad/$${FILE}"; \ if ./validate "$${TYPE}-schema.json" "test/$${TYPE}/bad/$${FILE}" ; \ then \ echo " received unexpected validation success" ; \ exit 1; \ else \ echo " received expected validation failure" ; \ fi \ done; \ done clean: rm -f validate crun-1.16.1/libocispec/runtime-spec/schema/README.md0000664000000000000000000000302014265762063020213 0ustar0000000000000000# JSON schema ## Overview This directory contains the [JSON Schema](http://json-schema.org/) for validating JSON covered by this specification. The layout of the files is as follows: * [config-schema.json](config-schema.json) - the primary entrypoint for the [configuration](../config.md) schema * [config-linux.json](config-linux.json) - the [Linux-specific configuration sub-structure](../config-linux.md) * [config-solaris.json](config-solaris.json) - the [Solaris-specific configuration sub-structure](../config-solaris.md) * [config-windows.json](config-windows.json) - the [Windows-specific configuration sub-structure](../config-windows.md) * [state-schema.json](state-schema.json) - the primary entrypoint for the [state JSON](../runtime.md#state) schema * [defs.json](defs.json) - definitions for general types * [defs-linux.json](defs-linux.json) - definitions for Linux-specific types * [defs-windows.json](defs-windows.json) - definitions for Windows-specific types * [validate.go](validate.go) - validation utility source code ## Utility There is also included a simple utility for facilitating validation. To build it: ```bash go get github.com/xeipuuv/gojsonschema go build ./validate.go ``` Or you can just use make command to create the utility: ```bash make validate ``` Then use it like: ```bash ./validate config-schema.json /config.json ``` Or like: ```bash ./validate https://raw.githubusercontent.com/opencontainers/runtime-spec//schema/config-schema.json /config.json ``` crun-1.16.1/libocispec/runtime-spec/schema/config-solaris.json0000664000000000000000000000361413677106243022555 0ustar0000000000000000{ "solaris": { "description": "Solaris platform-specific configurations", "type": "object", "properties": { "milestone": { "type": "string" }, "limitpriv": { "type": "string" }, "maxShmMemory": { "type": "string" }, "cappedCPU": { "type": "object", "properties": { "ncpus": { "type": "string" } } }, "cappedMemory": { "type": "object", "properties": { "physical": { "type": "string" }, "swap": { "type": "string" } } }, "anet": { "type": "array", "items": { "type": "object", "properties": { "linkname": { "type": "string" }, "lowerLink": { "type": "string" }, "allowedAddress": { "type": "string" }, "configureAllowedAddress": { "type": "string" }, "defrouter": { "type": "string" }, "macAddress": { "type": "string" }, "linkProtection": { "type": "string" } } } } } } } crun-1.16.1/libocispec/runtime-spec/schema/config-vm.json0000664000000000000000000000363213677106243021523 0ustar0000000000000000{ "vm": { "description": "configuration for virtual-machine-based containers", "type": "object", "required": [ "kernel" ], "properties": { "hypervisor": { "description": "hypervisor config used by VM-based containers", "type": "object", "required": [ "path" ], "properties": { "path": { "$ref": "defs.json#/definitions/FilePath" }, "parameters": { "$ref": "defs.json#/definitions/ArrayOfStrings" } } }, "kernel": { "description": "kernel config used by VM-based containers", "type": "object", "required": [ "path" ], "properties": { "path": { "$ref": "defs.json#/definitions/FilePath" }, "parameters": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "initrd": { "$ref": "defs.json#/definitions/FilePath" } } }, "image": { "description": "root image config used by VM-based containers", "type": "object", "required": [ "path", "format" ], "properties": { "path": { "$ref": "defs.json#/definitions/FilePath" }, "format": { "$ref": "defs-vm.json#/definitions/RootImageFormat" } } } } } } crun-1.16.1/libocispec/runtime-spec/schema/config-windows.json0000664000000000000000000000653613677106243022601 0ustar0000000000000000{ "windows": { "description": "Windows platform-specific configurations", "type": "object", "properties": { "layerFolders": { "type": "array", "items": { "$ref": "defs.json#/definitions/FilePath" }, "minItems": 1 }, "devices": { "type": "array", "items": { "$ref": "defs-windows.json#/definitions/Device" } }, "resources": { "type": "object", "properties": { "memory": { "type": "object", "properties": { "limit": { "$ref": "defs.json#/definitions/uint64" } } }, "cpu": { "type": "object", "properties": { "count": { "$ref": "defs.json#/definitions/uint64" }, "shares": { "$ref": "defs.json#/definitions/uint16" }, "maximum": { "$ref": "defs.json#/definitions/uint16" } } }, "storage": { "type": "object", "properties": { "iops": { "$ref": "defs.json#/definitions/uint64" }, "bps": { "$ref": "defs.json#/definitions/uint64" }, "sandboxSize": { "$ref": "defs.json#/definitions/uint64" } } } } }, "network": { "type": "object", "properties": { "endpointList": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "allowUnqualifiedDNSQuery": { "type": "boolean" }, "DNSSearchList": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "networkSharedContainerName": { "type": "string" }, "networkNamespace": { "type": "string" } } }, "credentialSpec": { "type": "object" }, "servicing": { "type": "boolean" }, "ignoreFlushesDuringBoot": { "type": "boolean" }, "hyperv": { "type": "object", "properties": { "utilityVMPath": { "type": "string" } } } }, "required": [ "layerFolders" ] } } crun-1.16.1/libocispec/runtime-spec/schema/defs-vm.json0000664000000000000000000000037513677106243021200 0ustar0000000000000000{ "definitions": { "RootImageFormat": { "type": "string", "enum": [ "raw", "qcow2", "vdi", "vmdk", "vhd" ] } } } crun-1.16.1/libocispec/runtime-spec/schema/defs-windows.json0000664000000000000000000000072513677106243022247 0ustar0000000000000000{ "definitions": { "Device": { "type": "object", "properties": { "id": { "type": "string" }, "idType": { "type": "string", "enum": [ "class" ] } }, "required": [ "id", "idType" ] } } } crun-1.16.1/libocispec/runtime-spec/schema/defs.json0000664000000000000000000001074714265762063020566 0ustar0000000000000000{ "description": "Definitions used throughout the Open Container Initiative Runtime Specification", "definitions": { "int8": { "type": "integer", "minimum": -128, "maximum": 127 }, "int16": { "type": "integer", "minimum": -32768, "maximum": 32767 }, "int32": { "type": "integer", "minimum": -2147483648, "maximum": 2147483647 }, "int64": { "type": "integer", "minimum": -9223372036854775808, "maximum": 9223372036854775807 }, "uint8": { "type": "integer", "minimum": 0, "maximum": 255 }, "uint16": { "type": "integer", "minimum": 0, "maximum": 65535 }, "uint32": { "type": "integer", "minimum": 0, "maximum": 4294967295 }, "uint64": { "type": "integer", "minimum": 0, "maximum": 18446744073709551615 }, "percent": { "type": "integer", "minimum": 0, "maximum": 100 }, "mapStringString": { "type": "object", "patternProperties": { ".{1,}": { "type": "string" } } }, "UID": { "$ref": "#/definitions/uint32" }, "GID": { "$ref": "#/definitions/uint32" }, "Umask": { "$ref": "#/definitions/uint32" }, "ArrayOfGIDs": { "type": "array", "items": { "$ref": "#/definitions/GID" } }, "ArrayOfStrings": { "type": "array", "items": { "type": "string" } }, "FilePath": { "type": "string" }, "Env": { "$ref": "#/definitions/ArrayOfStrings" }, "Hook": { "type": "object", "properties": { "path": { "$ref": "#/definitions/FilePath" }, "args": { "$ref": "#/definitions/ArrayOfStrings" }, "env": { "$ref": "#/definitions/Env" }, "timeout": { "type": "integer", "minimum": 1 } }, "required": [ "path" ] }, "ArrayOfHooks": { "type": "array", "items": { "$ref": "#/definitions/Hook" } }, "IDMapping": { "type": "object", "properties": { "containerID": { "$ref": "#/definitions/uint32" }, "hostID": { "$ref": "#/definitions/uint32" }, "size": { "$ref": "#/definitions/uint32" } }, "required": [ "containerID", "hostID", "size" ] }, "Mount": { "type": "object", "properties": { "source": { "$ref": "#/definitions/FilePath" }, "destination": { "$ref": "#/definitions/FilePath" }, "options": { "$ref": "#/definitions/ArrayOfStrings" }, "type": { "type": "string" }, "uidMappings": { "type": "array", "items": { "$ref": "#/definitions/IDMapping" } }, "gidMappings": { "type": "array", "items": { "$ref": "#/definitions/IDMapping" } } }, "required": [ "destination" ] }, "ociVersion": { "description": "The version of Open Container Initiative Runtime Specification that the document complies with", "type": "string" }, "annotations": { "$ref": "#/definitions/mapStringString" } } } crun-1.16.1/libocispec/runtime-spec/schema/state-schema.json0000664000000000000000000000160513677106243022212 0ustar0000000000000000{ "description": "Open Container Runtime State Schema", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "ociVersion": { "$ref": "defs.json#/definitions/ociVersion" }, "id": { "description": "the container's ID", "type": "string" }, "status": { "type": "string", "enum": [ "creating", "created", "running", "stopped" ] }, "pid": { "type": "integer", "minimum": 0 }, "bundle": { "type": "string" }, "annotations": { "$ref": "defs.json#/definitions/annotations" } }, "required": [ "ociVersion", "id", "status", "bundle" ] } crun-1.16.1/libocispec/runtime-spec/schema/config-zos.json0000664000000000000000000000051014160576556021712 0ustar0000000000000000{ "zos": { "description": "z/OS platform-specific configurations", "type": "object", "properties": { "devices": { "type": "array", "items": { "$ref": "defs-zos.json#/definitions/Device" } } } } } crun-1.16.1/libocispec/runtime-spec/schema/defs-zos.json0000664000000000000000000000307014160576556021372 0ustar0000000000000000{ "definitions": { "Major": { "description": "major device number", "$ref": "defs.json#/definitions/int64" }, "Minor": { "description": "minor device number", "$ref": "defs.json#/definitions/int64" }, "FileMode": { "description": "File permissions mode (typically an octal value)", "type": "integer", "minimum": 0, "maximum": 512 }, "FileType": { "description": "Type of a block or special character device", "type": "string", "pattern": "^[cbup]$" }, "Device": { "type": "object", "required": [ "type", "path", "major", "minor" ], "properties": { "path": { "$ref": "defs.json#/definitions/FilePath" }, "type": { "$ref": "#/definitions/FileType" }, "major": { "$ref": "#/definitions/Major" }, "minor": { "$ref": "#/definitions/Minor" }, "fileMode": { "$ref": "#/definitions/FileMode" }, "uid": { "$ref": "defs.json#/definitions/UID" }, "gid": { "$ref": "defs.json#/definitions/GID" } } } } } crun-1.16.1/libocispec/runtime-spec/schema/config-linux.json0000644000000000000000000002650314432210717022230 0ustar0000000000000000{ "linux": { "description": "Linux platform-specific configurations", "type": "object", "properties": { "devices": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/Device" } }, "uidMappings": { "type": "array", "items": { "$ref": "defs.json#/definitions/IDMapping" } }, "gidMappings": { "type": "array", "items": { "$ref": "defs.json#/definitions/IDMapping" } }, "namespaces": { "type": "array", "items": { "anyOf": [ { "$ref": "defs-linux.json#/definitions/NamespaceReference" } ] } }, "resources": { "type": "object", "properties": { "unified": { "$ref": "defs.json#/definitions/mapStringString" }, "devices": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/DeviceCgroup" } }, "pids": { "type": "object", "properties": { "limit": { "$ref": "defs.json#/definitions/int64" } }, "required": [ "limit" ] }, "blockIO": { "type": "object", "properties": { "weight": { "$ref": "defs-linux.json#/definitions/weight" }, "leafWeight": { "$ref": "defs-linux.json#/definitions/weight" }, "throttleReadBpsDevice": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/blockIODeviceThrottle" } }, "throttleWriteBpsDevice": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/blockIODeviceThrottle" } }, "throttleReadIOPSDevice": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/blockIODeviceThrottle" } }, "throttleWriteIOPSDevice": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/blockIODeviceThrottle" } }, "weightDevice": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/blockIODeviceWeight" } } } }, "cpu": { "type": "object", "properties": { "cpus": { "type": "string" }, "mems": { "type": "string" }, "period": { "$ref": "defs.json#/definitions/uint64" }, "quota": { "$ref": "defs.json#/definitions/int64" }, "burst": { "$ref": "defs.json#/definitions/uint64" }, "realtimePeriod": { "$ref": "defs.json#/definitions/uint64" }, "realtimeRuntime": { "$ref": "defs.json#/definitions/int64" }, "shares": { "$ref": "defs.json#/definitions/uint64" }, "idle": { "$ref": "defs.json#/definitions/int64" } } }, "hugepageLimits": { "type": "array", "items": { "type": "object", "properties": { "pageSize": { "type": "string", "pattern": "^[1-9][0-9]*[KMG]B$" }, "limit": { "$ref": "defs.json#/definitions/uint64" } }, "required": [ "pageSize", "limit" ] } }, "memory": { "type": "object", "properties": { "kernel": { "$ref": "defs.json#/definitions/int64" }, "kernelTCP": { "$ref": "defs.json#/definitions/int64" }, "limit": { "$ref": "defs.json#/definitions/int64" }, "reservation": { "$ref": "defs.json#/definitions/int64" }, "swap": { "$ref": "defs.json#/definitions/int64" }, "swappiness": { "$ref": "defs.json#/definitions/uint64" }, "disableOOMKiller": { "type": "boolean" }, "useHierarchy": { "type": "boolean" }, "checkBeforeUpdate": { "type": "boolean" } } }, "network": { "type": "object", "properties": { "classID": { "$ref": "defs.json#/definitions/uint32" }, "priorities": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/NetworkInterfacePriority" } } } }, "rdma": { "type": "object", "additionalProperties": { "$ref": "defs-linux.json#/definitions/Rdma" } } } }, "cgroupsPath": { "type": "string" }, "rootfsPropagation": { "$ref": "defs-linux.json#/definitions/RootfsPropagation" }, "seccomp": { "type": "object", "properties": { "defaultAction": { "$ref": "defs-linux.json#/definitions/SeccompAction" }, "defaultErrnoRet": { "$ref": "defs.json#/definitions/uint32" }, "flags": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/SeccompFlag" } }, "listenerPath": { "type": "string" }, "listenerMetadata": { "type": "string" }, "architectures": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/SeccompArch" } }, "syscalls": { "type": "array", "items": { "$ref": "defs-linux.json#/definitions/Syscall" } } }, "required": [ "defaultAction" ] }, "sysctl": { "$ref": "defs.json#/definitions/mapStringString" }, "maskedPaths": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "readonlyPaths": { "$ref": "defs.json#/definitions/ArrayOfStrings" }, "mountLabel": { "type": "string" }, "intelRdt": { "type": "object", "properties": { "closID": { "type": "string" }, "l3CacheSchema": { "type": "string" }, "memBwSchema": { "type": "string", "pattern": "^MB:[^\\n]*$" }, "enableCMT": { "type": "boolean" }, "enableMBM": { "type": "boolean" } } }, "personality": { "type": "object", "$ref": "defs-linux.json#/definitions/Personality" }, "timeOffsets": { "type": "object", "properties": { "boottime": { "$ref": "defs-linux.json#/definitions/TimeOffsets" }, "monotonic": { "$ref": "defs-linux.json#/definitions/TimeOffsets" } } } } } } crun-1.16.1/libocispec/runtime-spec/specs-go/0000775000000000000000000000000014614670026017214 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/specs-go/features/0000755000000000000000000000000014614670103021024 5ustar0000000000000000crun-1.16.1/libocispec/runtime-spec/specs-go/features/features.go0000644000000000000000000001355714614670103023204 0ustar0000000000000000// Package features provides the Features struct. package features // Features represents the supported features of the runtime. type Features struct { // OCIVersionMin is the minimum OCI Runtime Spec version recognized by the runtime, e.g., "1.0.0". OCIVersionMin string `json:"ociVersionMin,omitempty"` // OCIVersionMax is the maximum OCI Runtime Spec version recognized by the runtime, e.g., "1.0.2-dev". OCIVersionMax string `json:"ociVersionMax,omitempty"` // Hooks is the list of the recognized hook names, e.g., "createRuntime". // Nil value means "unknown", not "no support for any hook". Hooks []string `json:"hooks,omitempty"` // MountOptions is the list of the recognized mount options, e.g., "ro". // Nil value means "unknown", not "no support for any mount option". // This list does not contain filesystem-specific options passed to mount(2) syscall as (const void *). MountOptions []string `json:"mountOptions,omitempty"` // Linux is specific to Linux. Linux *Linux `json:"linux,omitempty"` // Annotations contains implementation-specific annotation strings, // such as the implementation version, and third-party extensions. Annotations map[string]string `json:"annotations,omitempty"` // PotentiallyUnsafeConfigAnnotations the list of the potential unsafe annotations // that may appear in `config.json`. // // A value that ends with "." is interpreted as a prefix of annotations. PotentiallyUnsafeConfigAnnotations []string `json:"potentiallyUnsafeConfigAnnotations,omitempty"` } // Linux is specific to Linux. type Linux struct { // Namespaces is the list of the recognized namespaces, e.g., "mount". // Nil value means "unknown", not "no support for any namespace". Namespaces []string `json:"namespaces,omitempty"` // Capabilities is the list of the recognized capabilities , e.g., "CAP_SYS_ADMIN". // Nil value means "unknown", not "no support for any capability". Capabilities []string `json:"capabilities,omitempty"` Cgroup *Cgroup `json:"cgroup,omitempty"` Seccomp *Seccomp `json:"seccomp,omitempty"` Apparmor *Apparmor `json:"apparmor,omitempty"` Selinux *Selinux `json:"selinux,omitempty"` IntelRdt *IntelRdt `json:"intelRdt,omitempty"` MountExtensions *MountExtensions `json:"mountExtensions,omitempty"` } // Cgroup represents the "cgroup" field. type Cgroup struct { // V1 represents whether Cgroup v1 support is compiled in. // Unrelated to whether the host uses cgroup v1 or not. // Nil value means "unknown", not "false". V1 *bool `json:"v1,omitempty"` // V2 represents whether Cgroup v2 support is compiled in. // Unrelated to whether the host uses cgroup v2 or not. // Nil value means "unknown", not "false". V2 *bool `json:"v2,omitempty"` // Systemd represents whether systemd-cgroup support is compiled in. // Unrelated to whether the host uses systemd or not. // Nil value means "unknown", not "false". Systemd *bool `json:"systemd,omitempty"` // SystemdUser represents whether user-scoped systemd-cgroup support is compiled in. // Unrelated to whether the host uses systemd or not. // Nil value means "unknown", not "false". SystemdUser *bool `json:"systemdUser,omitempty"` // Rdma represents whether RDMA cgroup support is compiled in. // Unrelated to whether the host supports RDMA or not. // Nil value means "unknown", not "false". Rdma *bool `json:"rdma,omitempty"` } // Seccomp represents the "seccomp" field. type Seccomp struct { // Enabled is true if seccomp support is compiled in. // Nil value means "unknown", not "false". Enabled *bool `json:"enabled,omitempty"` // Actions is the list of the recognized actions, e.g., "SCMP_ACT_NOTIFY". // Nil value means "unknown", not "no support for any action". Actions []string `json:"actions,omitempty"` // Operators is the list of the recognized operators, e.g., "SCMP_CMP_NE". // Nil value means "unknown", not "no support for any operator". Operators []string `json:"operators,omitempty"` // Archs is the list of the recognized archs, e.g., "SCMP_ARCH_X86_64". // Nil value means "unknown", not "no support for any arch". Archs []string `json:"archs,omitempty"` // KnownFlags is the list of the recognized filter flags, e.g., "SECCOMP_FILTER_FLAG_LOG". // Nil value means "unknown", not "no flags are recognized". KnownFlags []string `json:"knownFlags,omitempty"` // SupportedFlags is the list of the supported filter flags, e.g., "SECCOMP_FILTER_FLAG_LOG". // This list may be a subset of KnownFlags due to some flags // not supported by the current kernel and/or libseccomp. // Nil value means "unknown", not "no flags are supported". SupportedFlags []string `json:"supportedFlags,omitempty"` } // Apparmor represents the "apparmor" field. type Apparmor struct { // Enabled is true if AppArmor support is compiled in. // Unrelated to whether the host supports AppArmor or not. // Nil value means "unknown", not "false". Enabled *bool `json:"enabled,omitempty"` } // Selinux represents the "selinux" field. type Selinux struct { // Enabled is true if SELinux support is compiled in. // Unrelated to whether the host supports SELinux or not. // Nil value means "unknown", not "false". Enabled *bool `json:"enabled,omitempty"` } // IntelRdt represents the "intelRdt" field. type IntelRdt struct { // Enabled is true if Intel RDT support is compiled in. // Unrelated to whether the host supports Intel RDT or not. // Nil value means "unknown", not "false". Enabled *bool `json:"enabled,omitempty"` } // MountExtensions represents the "mountExtensions" field. type MountExtensions struct { // IDMap represents the status of idmap mounts support. IDMap *IDMap `json:"idmap,omitempty"` } type IDMap struct { // Enabled represents whether idmap mounts supports is compiled in. // Unrelated to whether the host supports it or not. // Nil value means "unknown", not "false". Enabled *bool `json:"enabled,omitempty"` } crun-1.16.1/libocispec/runtime-spec/specs-go/config.go0000644000000000000000000011565714614670026021025 0ustar0000000000000000package specs import "os" // Spec is the base configuration for the container. type Spec struct { // Version of the Open Container Initiative Runtime Specification with which the bundle complies. Version string `json:"ociVersion"` // Process configures the container process. Process *Process `json:"process,omitempty"` // Root configures the container's root filesystem. Root *Root `json:"root,omitempty"` // Hostname configures the container's hostname. Hostname string `json:"hostname,omitempty"` // Domainname configures the container's domainname. Domainname string `json:"domainname,omitempty"` // Mounts configures additional mounts (on top of Root). Mounts []Mount `json:"mounts,omitempty"` // Hooks configures callbacks for container lifecycle events. Hooks *Hooks `json:"hooks,omitempty" platform:"linux,solaris,zos"` // Annotations contains arbitrary metadata for the container. Annotations map[string]string `json:"annotations,omitempty"` // Linux is platform-specific configuration for Linux based containers. Linux *Linux `json:"linux,omitempty" platform:"linux"` // Solaris is platform-specific configuration for Solaris based containers. Solaris *Solaris `json:"solaris,omitempty" platform:"solaris"` // Windows is platform-specific configuration for Windows based containers. Windows *Windows `json:"windows,omitempty" platform:"windows"` // VM specifies configuration for virtual-machine-based containers. VM *VM `json:"vm,omitempty" platform:"vm"` // ZOS is platform-specific configuration for z/OS based containers. ZOS *ZOS `json:"zos,omitempty" platform:"zos"` } // Scheduler represents the scheduling attributes for a process. It is based on // the Linux sched_setattr(2) syscall. type Scheduler struct { // Policy represents the scheduling policy (e.g., SCHED_FIFO, SCHED_RR, SCHED_OTHER). Policy LinuxSchedulerPolicy `json:"policy"` // Nice is the nice value for the process, which affects its priority. Nice int32 `json:"nice,omitempty"` // Priority represents the static priority of the process. Priority int32 `json:"priority,omitempty"` // Flags is an array of scheduling flags. Flags []LinuxSchedulerFlag `json:"flags,omitempty"` // The following ones are used by the DEADLINE scheduler. // Runtime is the amount of time in nanoseconds during which the process // is allowed to run in a given period. Runtime uint64 `json:"runtime,omitempty"` // Deadline is the absolute deadline for the process to complete its execution. Deadline uint64 `json:"deadline,omitempty"` // Period is the length of the period in nanoseconds used for determining the process runtime. Period uint64 `json:"period,omitempty"` } // Process contains information to start a specific application inside the container. type Process struct { // Terminal creates an interactive terminal for the container. Terminal bool `json:"terminal,omitempty"` // ConsoleSize specifies the size of the console. ConsoleSize *Box `json:"consoleSize,omitempty"` // User specifies user information for the process. User User `json:"user"` // Args specifies the binary and arguments for the application to execute. Args []string `json:"args,omitempty"` // CommandLine specifies the full command line for the application to execute on Windows. CommandLine string `json:"commandLine,omitempty" platform:"windows"` // Env populates the process environment for the process. Env []string `json:"env,omitempty"` // Cwd is the current working directory for the process and must be // relative to the container's root. Cwd string `json:"cwd"` // Capabilities are Linux capabilities that are kept for the process. Capabilities *LinuxCapabilities `json:"capabilities,omitempty" platform:"linux"` // Rlimits specifies rlimit options to apply to the process. Rlimits []POSIXRlimit `json:"rlimits,omitempty" platform:"linux,solaris,zos"` // NoNewPrivileges controls whether additional privileges could be gained by processes in the container. NoNewPrivileges bool `json:"noNewPrivileges,omitempty" platform:"linux"` // ApparmorProfile specifies the apparmor profile for the container. ApparmorProfile string `json:"apparmorProfile,omitempty" platform:"linux"` // Specify an oom_score_adj for the container. OOMScoreAdj *int `json:"oomScoreAdj,omitempty" platform:"linux"` // Scheduler specifies the scheduling attributes for a process Scheduler *Scheduler `json:"scheduler,omitempty" platform:"linux"` // SelinuxLabel specifies the selinux context that the container process is run as. SelinuxLabel string `json:"selinuxLabel,omitempty" platform:"linux"` // IOPriority contains the I/O priority settings for the cgroup. IOPriority *LinuxIOPriority `json:"ioPriority,omitempty" platform:"linux"` } // LinuxCapabilities specifies the list of allowed capabilities that are kept for a process. // http://man7.org/linux/man-pages/man7/capabilities.7.html type LinuxCapabilities struct { // Bounding is the set of capabilities checked by the kernel. Bounding []string `json:"bounding,omitempty" platform:"linux"` // Effective is the set of capabilities checked by the kernel. Effective []string `json:"effective,omitempty" platform:"linux"` // Inheritable is the capabilities preserved across execve. Inheritable []string `json:"inheritable,omitempty" platform:"linux"` // Permitted is the limiting superset for effective capabilities. Permitted []string `json:"permitted,omitempty" platform:"linux"` // Ambient is the ambient set of capabilities that are kept. Ambient []string `json:"ambient,omitempty" platform:"linux"` } // IOPriority represents I/O priority settings for the container's processes within the process group. type LinuxIOPriority struct { Class IOPriorityClass `json:"class"` Priority int `json:"priority"` } // IOPriorityClass represents an I/O scheduling class. type IOPriorityClass string // Possible values for IOPriorityClass. const ( IOPRIO_CLASS_RT IOPriorityClass = "IOPRIO_CLASS_RT" IOPRIO_CLASS_BE IOPriorityClass = "IOPRIO_CLASS_BE" IOPRIO_CLASS_IDLE IOPriorityClass = "IOPRIO_CLASS_IDLE" ) // Box specifies dimensions of a rectangle. Used for specifying the size of a console. type Box struct { // Height is the vertical dimension of a box. Height uint `json:"height"` // Width is the horizontal dimension of a box. Width uint `json:"width"` } // User specifies specific user (and group) information for the container process. type User struct { // UID is the user id. UID uint32 `json:"uid" platform:"linux,solaris,zos"` // GID is the group id. GID uint32 `json:"gid" platform:"linux,solaris,zos"` // Umask is the umask for the init process. Umask *uint32 `json:"umask,omitempty" platform:"linux,solaris,zos"` // AdditionalGids are additional group ids set for the container's process. AdditionalGids []uint32 `json:"additionalGids,omitempty" platform:"linux,solaris"` // Username is the user name. Username string `json:"username,omitempty" platform:"windows"` } // Root contains information about the container's root filesystem on the host. type Root struct { // Path is the absolute path to the container's root filesystem. Path string `json:"path"` // Readonly makes the root filesystem for the container readonly before the process is executed. Readonly bool `json:"readonly,omitempty"` } // Mount specifies a mount for a container. type Mount struct { // Destination is the absolute path where the mount will be placed in the container. Destination string `json:"destination"` // Type specifies the mount kind. Type string `json:"type,omitempty" platform:"linux,solaris,zos"` // Source specifies the source path of the mount. Source string `json:"source,omitempty"` // Options are fstab style mount options. Options []string `json:"options,omitempty"` // UID/GID mappings used for changing file owners w/o calling chown, fs should support it. // Every mount point could have its own mapping. UIDMappings []LinuxIDMapping `json:"uidMappings,omitempty" platform:"linux"` GIDMappings []LinuxIDMapping `json:"gidMappings,omitempty" platform:"linux"` } // Hook specifies a command that is run at a particular event in the lifecycle of a container type Hook struct { Path string `json:"path"` Args []string `json:"args,omitempty"` Env []string `json:"env,omitempty"` Timeout *int `json:"timeout,omitempty"` } // Hooks specifies a command that is run in the container at a particular event in the lifecycle of a container // Hooks for container setup and teardown type Hooks struct { // Prestart is Deprecated. Prestart is a list of hooks to be run before the container process is executed. // It is called in the Runtime Namespace // // Deprecated: use [Hooks.CreateRuntime], [Hooks.CreateContainer], and // [Hooks.StartContainer] instead, which allow more granular hook control // during the create and start phase. Prestart []Hook `json:"prestart,omitempty"` // CreateRuntime is a list of hooks to be run after the container has been created but before pivot_root or any equivalent operation has been called // It is called in the Runtime Namespace CreateRuntime []Hook `json:"createRuntime,omitempty"` // CreateContainer is a list of hooks to be run after the container has been created but before pivot_root or any equivalent operation has been called // It is called in the Container Namespace CreateContainer []Hook `json:"createContainer,omitempty"` // StartContainer is a list of hooks to be run after the start operation is called but before the container process is started // It is called in the Container Namespace StartContainer []Hook `json:"startContainer,omitempty"` // Poststart is a list of hooks to be run after the container process is started. // It is called in the Runtime Namespace Poststart []Hook `json:"poststart,omitempty"` // Poststop is a list of hooks to be run after the container process exits. // It is called in the Runtime Namespace Poststop []Hook `json:"poststop,omitempty"` } // Linux contains platform-specific configuration for Linux based containers. type Linux struct { // UIDMapping specifies user mappings for supporting user namespaces. UIDMappings []LinuxIDMapping `json:"uidMappings,omitempty"` // GIDMapping specifies group mappings for supporting user namespaces. GIDMappings []LinuxIDMapping `json:"gidMappings,omitempty"` // Sysctl are a set of key value pairs that are set for the container on start Sysctl map[string]string `json:"sysctl,omitempty"` // Resources contain cgroup information for handling resource constraints // for the container Resources *LinuxResources `json:"resources,omitempty"` // CgroupsPath specifies the path to cgroups that are created and/or joined by the container. // The path is expected to be relative to the cgroups mountpoint. // If resources are specified, the cgroups at CgroupsPath will be updated based on resources. CgroupsPath string `json:"cgroupsPath,omitempty"` // Namespaces contains the namespaces that are created and/or joined by the container Namespaces []LinuxNamespace `json:"namespaces,omitempty"` // Devices are a list of device nodes that are created for the container Devices []LinuxDevice `json:"devices,omitempty"` // Seccomp specifies the seccomp security settings for the container. Seccomp *LinuxSeccomp `json:"seccomp,omitempty"` // RootfsPropagation is the rootfs mount propagation mode for the container. RootfsPropagation string `json:"rootfsPropagation,omitempty"` // MaskedPaths masks over the provided paths inside the container. MaskedPaths []string `json:"maskedPaths,omitempty"` // ReadonlyPaths sets the provided paths as RO inside the container. ReadonlyPaths []string `json:"readonlyPaths,omitempty"` // MountLabel specifies the selinux context for the mounts in the container. MountLabel string `json:"mountLabel,omitempty"` // IntelRdt contains Intel Resource Director Technology (RDT) information for // handling resource constraints and monitoring metrics (e.g., L3 cache, memory bandwidth) for the container IntelRdt *LinuxIntelRdt `json:"intelRdt,omitempty"` // Personality contains configuration for the Linux personality syscall Personality *LinuxPersonality `json:"personality,omitempty"` // TimeOffsets specifies the offset for supporting time namespaces. TimeOffsets map[string]LinuxTimeOffset `json:"timeOffsets,omitempty"` } // LinuxNamespace is the configuration for a Linux namespace type LinuxNamespace struct { // Type is the type of namespace Type LinuxNamespaceType `json:"type"` // Path is a path to an existing namespace persisted on disk that can be joined // and is of the same type Path string `json:"path,omitempty"` } // LinuxNamespaceType is one of the Linux namespaces type LinuxNamespaceType string const ( // PIDNamespace for isolating process IDs PIDNamespace LinuxNamespaceType = "pid" // NetworkNamespace for isolating network devices, stacks, ports, etc NetworkNamespace LinuxNamespaceType = "network" // MountNamespace for isolating mount points MountNamespace LinuxNamespaceType = "mount" // IPCNamespace for isolating System V IPC, POSIX message queues IPCNamespace LinuxNamespaceType = "ipc" // UTSNamespace for isolating hostname and NIS domain name UTSNamespace LinuxNamespaceType = "uts" // UserNamespace for isolating user and group IDs UserNamespace LinuxNamespaceType = "user" // CgroupNamespace for isolating cgroup hierarchies CgroupNamespace LinuxNamespaceType = "cgroup" // TimeNamespace for isolating the clocks TimeNamespace LinuxNamespaceType = "time" ) // LinuxIDMapping specifies UID/GID mappings type LinuxIDMapping struct { // ContainerID is the starting UID/GID in the container ContainerID uint32 `json:"containerID"` // HostID is the starting UID/GID on the host to be mapped to 'ContainerID' HostID uint32 `json:"hostID"` // Size is the number of IDs to be mapped Size uint32 `json:"size"` } // LinuxTimeOffset specifies the offset for Time Namespace type LinuxTimeOffset struct { // Secs is the offset of clock (in secs) in the container Secs int64 `json:"secs,omitempty"` // Nanosecs is the additional offset for Secs (in nanosecs) Nanosecs uint32 `json:"nanosecs,omitempty"` } // POSIXRlimit type and restrictions type POSIXRlimit struct { // Type of the rlimit to set Type string `json:"type"` // Hard is the hard limit for the specified type Hard uint64 `json:"hard"` // Soft is the soft limit for the specified type Soft uint64 `json:"soft"` } // LinuxHugepageLimit structure corresponds to limiting kernel hugepages. // Default to reservation limits if supported. Otherwise fallback to page fault limits. type LinuxHugepageLimit struct { // Pagesize is the hugepage size. // Format: "B' (e.g. 64KB, 2MB, 1GB, etc.). Pagesize string `json:"pageSize"` // Limit is the limit of "hugepagesize" hugetlb reservations (if supported) or usage. Limit uint64 `json:"limit"` } // LinuxInterfacePriority for network interfaces type LinuxInterfacePriority struct { // Name is the name of the network interface Name string `json:"name"` // Priority for the interface Priority uint32 `json:"priority"` } // LinuxBlockIODevice holds major:minor format supported in blkio cgroup type LinuxBlockIODevice struct { // Major is the device's major number. Major int64 `json:"major"` // Minor is the device's minor number. Minor int64 `json:"minor"` } // LinuxWeightDevice struct holds a `major:minor weight` pair for weightDevice type LinuxWeightDevice struct { LinuxBlockIODevice // Weight is the bandwidth rate for the device. Weight *uint16 `json:"weight,omitempty"` // LeafWeight is the bandwidth rate for the device while competing with the cgroup's child cgroups, CFQ scheduler only LeafWeight *uint16 `json:"leafWeight,omitempty"` } // LinuxThrottleDevice struct holds a `major:minor rate_per_second` pair type LinuxThrottleDevice struct { LinuxBlockIODevice // Rate is the IO rate limit per cgroup per device Rate uint64 `json:"rate"` } // LinuxBlockIO for Linux cgroup 'blkio' resource management type LinuxBlockIO struct { // Specifies per cgroup weight Weight *uint16 `json:"weight,omitempty"` // Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, CFQ scheduler only LeafWeight *uint16 `json:"leafWeight,omitempty"` // Weight per cgroup per device, can override BlkioWeight WeightDevice []LinuxWeightDevice `json:"weightDevice,omitempty"` // IO read rate limit per cgroup per device, bytes per second ThrottleReadBpsDevice []LinuxThrottleDevice `json:"throttleReadBpsDevice,omitempty"` // IO write rate limit per cgroup per device, bytes per second ThrottleWriteBpsDevice []LinuxThrottleDevice `json:"throttleWriteBpsDevice,omitempty"` // IO read rate limit per cgroup per device, IO per second ThrottleReadIOPSDevice []LinuxThrottleDevice `json:"throttleReadIOPSDevice,omitempty"` // IO write rate limit per cgroup per device, IO per second ThrottleWriteIOPSDevice []LinuxThrottleDevice `json:"throttleWriteIOPSDevice,omitempty"` } // LinuxMemory for Linux cgroup 'memory' resource management type LinuxMemory struct { // Memory limit (in bytes). Limit *int64 `json:"limit,omitempty"` // Memory reservation or soft_limit (in bytes). Reservation *int64 `json:"reservation,omitempty"` // Total memory limit (memory + swap). Swap *int64 `json:"swap,omitempty"` // Kernel memory limit (in bytes). // // Deprecated: kernel-memory limits are not supported in cgroups v2, and // were obsoleted in [kernel v5.4]. This field should no longer be used, // as it may be ignored by runtimes. // // [kernel v5.4]: https://github.com/torvalds/linux/commit/0158115f702b0ba208ab0 Kernel *int64 `json:"kernel,omitempty"` // Kernel memory limit for tcp (in bytes) KernelTCP *int64 `json:"kernelTCP,omitempty"` // How aggressive the kernel will swap memory pages. Swappiness *uint64 `json:"swappiness,omitempty"` // DisableOOMKiller disables the OOM killer for out of memory conditions DisableOOMKiller *bool `json:"disableOOMKiller,omitempty"` // Enables hierarchical memory accounting UseHierarchy *bool `json:"useHierarchy,omitempty"` // CheckBeforeUpdate enables checking if a new memory limit is lower // than the current usage during update, and if so, rejecting the new // limit. CheckBeforeUpdate *bool `json:"checkBeforeUpdate,omitempty"` } // LinuxCPU for Linux cgroup 'cpu' resource management type LinuxCPU struct { // CPU shares (relative weight (ratio) vs. other cgroups with cpu shares). Shares *uint64 `json:"shares,omitempty"` // CPU hardcap limit (in usecs). Allowed cpu time in a given period. Quota *int64 `json:"quota,omitempty"` // CPU hardcap burst limit (in usecs). Allowed accumulated cpu time additionally for burst in a // given period. Burst *uint64 `json:"burst,omitempty"` // CPU period to be used for hardcapping (in usecs). Period *uint64 `json:"period,omitempty"` // How much time realtime scheduling may use (in usecs). RealtimeRuntime *int64 `json:"realtimeRuntime,omitempty"` // CPU period to be used for realtime scheduling (in usecs). RealtimePeriod *uint64 `json:"realtimePeriod,omitempty"` // CPUs to use within the cpuset. Default is to use any CPU available. Cpus string `json:"cpus,omitempty"` // List of memory nodes in the cpuset. Default is to use any available memory node. Mems string `json:"mems,omitempty"` // cgroups are configured with minimum weight, 0: default behavior, 1: SCHED_IDLE. Idle *int64 `json:"idle,omitempty"` } // LinuxPids for Linux cgroup 'pids' resource management (Linux 4.3) type LinuxPids struct { // Maximum number of PIDs. Default is "no limit". Limit int64 `json:"limit"` } // LinuxNetwork identification and priority configuration type LinuxNetwork struct { // Set class identifier for container's network packets ClassID *uint32 `json:"classID,omitempty"` // Set priority of network traffic for container Priorities []LinuxInterfacePriority `json:"priorities,omitempty"` } // LinuxRdma for Linux cgroup 'rdma' resource management (Linux 4.11) type LinuxRdma struct { // Maximum number of HCA handles that can be opened. Default is "no limit". HcaHandles *uint32 `json:"hcaHandles,omitempty"` // Maximum number of HCA objects that can be created. Default is "no limit". HcaObjects *uint32 `json:"hcaObjects,omitempty"` } // LinuxResources has container runtime resource constraints type LinuxResources struct { // Devices configures the device allowlist. Devices []LinuxDeviceCgroup `json:"devices,omitempty"` // Memory restriction configuration Memory *LinuxMemory `json:"memory,omitempty"` // CPU resource restriction configuration CPU *LinuxCPU `json:"cpu,omitempty"` // Task resource restriction configuration. Pids *LinuxPids `json:"pids,omitempty"` // BlockIO restriction configuration BlockIO *LinuxBlockIO `json:"blockIO,omitempty"` // Hugetlb limits (in bytes). Default to reservation limits if supported. HugepageLimits []LinuxHugepageLimit `json:"hugepageLimits,omitempty"` // Network restriction configuration Network *LinuxNetwork `json:"network,omitempty"` // Rdma resource restriction configuration. // Limits are a set of key value pairs that define RDMA resource limits, // where the key is device name and value is resource limits. Rdma map[string]LinuxRdma `json:"rdma,omitempty"` // Unified resources. Unified map[string]string `json:"unified,omitempty"` } // LinuxDevice represents the mknod information for a Linux special device file type LinuxDevice struct { // Path to the device. Path string `json:"path"` // Device type, block, char, etc. Type string `json:"type"` // Major is the device's major number. Major int64 `json:"major"` // Minor is the device's minor number. Minor int64 `json:"minor"` // FileMode permission bits for the device. FileMode *os.FileMode `json:"fileMode,omitempty"` // UID of the device. UID *uint32 `json:"uid,omitempty"` // Gid of the device. GID *uint32 `json:"gid,omitempty"` } // LinuxDeviceCgroup represents a device rule for the devices specified to // the device controller type LinuxDeviceCgroup struct { // Allow or deny Allow bool `json:"allow"` // Device type, block, char, etc. Type string `json:"type,omitempty"` // Major is the device's major number. Major *int64 `json:"major,omitempty"` // Minor is the device's minor number. Minor *int64 `json:"minor,omitempty"` // Cgroup access permissions format, rwm. Access string `json:"access,omitempty"` } // LinuxPersonalityDomain refers to a personality domain. type LinuxPersonalityDomain string // LinuxPersonalityFlag refers to an additional personality flag. None are currently defined. type LinuxPersonalityFlag string // Define domain and flags for Personality const ( // PerLinux is the standard Linux personality PerLinux LinuxPersonalityDomain = "LINUX" // PerLinux32 sets personality to 32 bit PerLinux32 LinuxPersonalityDomain = "LINUX32" ) // LinuxPersonality represents the Linux personality syscall input type LinuxPersonality struct { // Domain for the personality Domain LinuxPersonalityDomain `json:"domain"` // Additional flags Flags []LinuxPersonalityFlag `json:"flags,omitempty"` } // Solaris contains platform-specific configuration for Solaris application containers. type Solaris struct { // SMF FMRI which should go "online" before we start the container process. Milestone string `json:"milestone,omitempty"` // Maximum set of privileges any process in this container can obtain. LimitPriv string `json:"limitpriv,omitempty"` // The maximum amount of shared memory allowed for this container. MaxShmMemory string `json:"maxShmMemory,omitempty"` // Specification for automatic creation of network resources for this container. Anet []SolarisAnet `json:"anet,omitempty"` // Set limit on the amount of CPU time that can be used by container. CappedCPU *SolarisCappedCPU `json:"cappedCPU,omitempty"` // The physical and swap caps on the memory that can be used by this container. CappedMemory *SolarisCappedMemory `json:"cappedMemory,omitempty"` } // SolarisCappedCPU allows users to set limit on the amount of CPU time that can be used by container. type SolarisCappedCPU struct { Ncpus string `json:"ncpus,omitempty"` } // SolarisCappedMemory allows users to set the physical and swap caps on the memory that can be used by this container. type SolarisCappedMemory struct { Physical string `json:"physical,omitempty"` Swap string `json:"swap,omitempty"` } // SolarisAnet provides the specification for automatic creation of network resources for this container. type SolarisAnet struct { // Specify a name for the automatically created VNIC datalink. Linkname string `json:"linkname,omitempty"` // Specify the link over which the VNIC will be created. Lowerlink string `json:"lowerLink,omitempty"` // The set of IP addresses that the container can use. Allowedaddr string `json:"allowedAddress,omitempty"` // Specifies whether allowedAddress limitation is to be applied to the VNIC. Configallowedaddr string `json:"configureAllowedAddress,omitempty"` // The value of the optional default router. Defrouter string `json:"defrouter,omitempty"` // Enable one or more types of link protection. Linkprotection string `json:"linkProtection,omitempty"` // Set the VNIC's macAddress Macaddress string `json:"macAddress,omitempty"` } // Windows defines the runtime configuration for Windows based containers, including Hyper-V containers. type Windows struct { // LayerFolders contains a list of absolute paths to directories containing image layers. LayerFolders []string `json:"layerFolders"` // Devices are the list of devices to be mapped into the container. Devices []WindowsDevice `json:"devices,omitempty"` // Resources contains information for handling resource constraints for the container. Resources *WindowsResources `json:"resources,omitempty"` // CredentialSpec contains a JSON object describing a group Managed Service Account (gMSA) specification. CredentialSpec interface{} `json:"credentialSpec,omitempty"` // Servicing indicates if the container is being started in a mode to apply a Windows Update servicing operation. Servicing bool `json:"servicing,omitempty"` // IgnoreFlushesDuringBoot indicates if the container is being started in a mode where disk writes are not flushed during its boot process. IgnoreFlushesDuringBoot bool `json:"ignoreFlushesDuringBoot,omitempty"` // HyperV contains information for running a container with Hyper-V isolation. HyperV *WindowsHyperV `json:"hyperv,omitempty"` // Network restriction configuration. Network *WindowsNetwork `json:"network,omitempty"` } // WindowsDevice represents information about a host device to be mapped into the container. type WindowsDevice struct { // Device identifier: interface class GUID, etc. ID string `json:"id"` // Device identifier type: "class", etc. IDType string `json:"idType"` } // WindowsResources has container runtime resource constraints for containers running on Windows. type WindowsResources struct { // Memory restriction configuration. Memory *WindowsMemoryResources `json:"memory,omitempty"` // CPU resource restriction configuration. CPU *WindowsCPUResources `json:"cpu,omitempty"` // Storage restriction configuration. Storage *WindowsStorageResources `json:"storage,omitempty"` } // WindowsMemoryResources contains memory resource management settings. type WindowsMemoryResources struct { // Memory limit in bytes. Limit *uint64 `json:"limit,omitempty"` } // WindowsCPUResources contains CPU resource management settings. type WindowsCPUResources struct { // Count is the number of CPUs available to the container. It represents the // fraction of the configured processor `count` in a container in relation // to the processors available in the host. The fraction ultimately // determines the portion of processor cycles that the threads in a // container can use during each scheduling interval, as the number of // cycles per 10,000 cycles. Count *uint64 `json:"count,omitempty"` // Shares limits the share of processor time given to the container relative // to other workloads on the processor. The processor `shares` (`weight` at // the platform level) is a value between 0 and 10000. Shares *uint16 `json:"shares,omitempty"` // Maximum determines the portion of processor cycles that the threads in a // container can use during each scheduling interval, as the number of // cycles per 10,000 cycles. Set processor `maximum` to a percentage times // 100. Maximum *uint16 `json:"maximum,omitempty"` } // WindowsStorageResources contains storage resource management settings. type WindowsStorageResources struct { // Specifies maximum Iops for the system drive. Iops *uint64 `json:"iops,omitempty"` // Specifies maximum bytes per second for the system drive. Bps *uint64 `json:"bps,omitempty"` // Sandbox size specifies the minimum size of the system drive in bytes. SandboxSize *uint64 `json:"sandboxSize,omitempty"` } // WindowsNetwork contains network settings for Windows containers. type WindowsNetwork struct { // List of HNS endpoints that the container should connect to. EndpointList []string `json:"endpointList,omitempty"` // Specifies if unqualified DNS name resolution is allowed. AllowUnqualifiedDNSQuery bool `json:"allowUnqualifiedDNSQuery,omitempty"` // Comma separated list of DNS suffixes to use for name resolution. DNSSearchList []string `json:"DNSSearchList,omitempty"` // Name (ID) of the container that we will share with the network stack. NetworkSharedContainerName string `json:"networkSharedContainerName,omitempty"` // name (ID) of the network namespace that will be used for the container. NetworkNamespace string `json:"networkNamespace,omitempty"` } // WindowsHyperV contains information for configuring a container to run with Hyper-V isolation. type WindowsHyperV struct { // UtilityVMPath is an optional path to the image used for the Utility VM. UtilityVMPath string `json:"utilityVMPath,omitempty"` } // VM contains information for virtual-machine-based containers. type VM struct { // Hypervisor specifies hypervisor-related configuration for virtual-machine-based containers. Hypervisor VMHypervisor `json:"hypervisor,omitempty"` // Kernel specifies kernel-related configuration for virtual-machine-based containers. Kernel VMKernel `json:"kernel"` // Image specifies guest image related configuration for virtual-machine-based containers. Image VMImage `json:"image,omitempty"` } // VMHypervisor contains information about the hypervisor to use for a virtual machine. type VMHypervisor struct { // Path is the host path to the hypervisor used to manage the virtual machine. Path string `json:"path"` // Parameters specifies parameters to pass to the hypervisor. Parameters []string `json:"parameters,omitempty"` } // VMKernel contains information about the kernel to use for a virtual machine. type VMKernel struct { // Path is the host path to the kernel used to boot the virtual machine. Path string `json:"path"` // Parameters specifies parameters to pass to the kernel. Parameters []string `json:"parameters,omitempty"` // InitRD is the host path to an initial ramdisk to be used by the kernel. InitRD string `json:"initrd,omitempty"` } // VMImage contains information about the virtual machine root image. type VMImage struct { // Path is the host path to the root image that the VM kernel would boot into. Path string `json:"path"` // Format is the root image format type (e.g. "qcow2", "raw", "vhd", etc). Format string `json:"format"` } // LinuxSeccomp represents syscall restrictions type LinuxSeccomp struct { DefaultAction LinuxSeccompAction `json:"defaultAction"` DefaultErrnoRet *uint `json:"defaultErrnoRet,omitempty"` Architectures []Arch `json:"architectures,omitempty"` Flags []LinuxSeccompFlag `json:"flags,omitempty"` ListenerPath string `json:"listenerPath,omitempty"` ListenerMetadata string `json:"listenerMetadata,omitempty"` Syscalls []LinuxSyscall `json:"syscalls,omitempty"` } // Arch used for additional architectures type Arch string // LinuxSeccompFlag is a flag to pass to seccomp(2). type LinuxSeccompFlag string const ( // LinuxSeccompFlagLog is a seccomp flag to request all returned // actions except SECCOMP_RET_ALLOW to be logged. An administrator may // override this filter flag by preventing specific actions from being // logged via the /proc/sys/kernel/seccomp/actions_logged file. (since // Linux 4.14) LinuxSeccompFlagLog LinuxSeccompFlag = "SECCOMP_FILTER_FLAG_LOG" // LinuxSeccompFlagSpecAllow can be used to disable Speculative Store // Bypass mitigation. (since Linux 4.17) LinuxSeccompFlagSpecAllow LinuxSeccompFlag = "SECCOMP_FILTER_FLAG_SPEC_ALLOW" // LinuxSeccompFlagWaitKillableRecv can be used to switch to the wait // killable semantics. (since Linux 5.19) LinuxSeccompFlagWaitKillableRecv LinuxSeccompFlag = "SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV" ) // Additional architectures permitted to be used for system calls // By default only the native architecture of the kernel is permitted const ( ArchX86 Arch = "SCMP_ARCH_X86" ArchX86_64 Arch = "SCMP_ARCH_X86_64" ArchX32 Arch = "SCMP_ARCH_X32" ArchARM Arch = "SCMP_ARCH_ARM" ArchAARCH64 Arch = "SCMP_ARCH_AARCH64" ArchMIPS Arch = "SCMP_ARCH_MIPS" ArchMIPS64 Arch = "SCMP_ARCH_MIPS64" ArchMIPS64N32 Arch = "SCMP_ARCH_MIPS64N32" ArchMIPSEL Arch = "SCMP_ARCH_MIPSEL" ArchMIPSEL64 Arch = "SCMP_ARCH_MIPSEL64" ArchMIPSEL64N32 Arch = "SCMP_ARCH_MIPSEL64N32" ArchPPC Arch = "SCMP_ARCH_PPC" ArchPPC64 Arch = "SCMP_ARCH_PPC64" ArchPPC64LE Arch = "SCMP_ARCH_PPC64LE" ArchS390 Arch = "SCMP_ARCH_S390" ArchS390X Arch = "SCMP_ARCH_S390X" ArchPARISC Arch = "SCMP_ARCH_PARISC" ArchPARISC64 Arch = "SCMP_ARCH_PARISC64" ArchRISCV64 Arch = "SCMP_ARCH_RISCV64" ) // LinuxSeccompAction taken upon Seccomp rule match type LinuxSeccompAction string // Define actions for Seccomp rules const ( ActKill LinuxSeccompAction = "SCMP_ACT_KILL" ActKillProcess LinuxSeccompAction = "SCMP_ACT_KILL_PROCESS" ActKillThread LinuxSeccompAction = "SCMP_ACT_KILL_THREAD" ActTrap LinuxSeccompAction = "SCMP_ACT_TRAP" ActErrno LinuxSeccompAction = "SCMP_ACT_ERRNO" ActTrace LinuxSeccompAction = "SCMP_ACT_TRACE" ActAllow LinuxSeccompAction = "SCMP_ACT_ALLOW" ActLog LinuxSeccompAction = "SCMP_ACT_LOG" ActNotify LinuxSeccompAction = "SCMP_ACT_NOTIFY" ) // LinuxSeccompOperator used to match syscall arguments in Seccomp type LinuxSeccompOperator string // Define operators for syscall arguments in Seccomp const ( OpNotEqual LinuxSeccompOperator = "SCMP_CMP_NE" OpLessThan LinuxSeccompOperator = "SCMP_CMP_LT" OpLessEqual LinuxSeccompOperator = "SCMP_CMP_LE" OpEqualTo LinuxSeccompOperator = "SCMP_CMP_EQ" OpGreaterEqual LinuxSeccompOperator = "SCMP_CMP_GE" OpGreaterThan LinuxSeccompOperator = "SCMP_CMP_GT" OpMaskedEqual LinuxSeccompOperator = "SCMP_CMP_MASKED_EQ" ) // LinuxSeccompArg used for matching specific syscall arguments in Seccomp type LinuxSeccompArg struct { Index uint `json:"index"` Value uint64 `json:"value"` ValueTwo uint64 `json:"valueTwo,omitempty"` Op LinuxSeccompOperator `json:"op"` } // LinuxSyscall is used to match a syscall in Seccomp type LinuxSyscall struct { Names []string `json:"names"` Action LinuxSeccompAction `json:"action"` ErrnoRet *uint `json:"errnoRet,omitempty"` Args []LinuxSeccompArg `json:"args,omitempty"` } // LinuxIntelRdt has container runtime resource constraints for Intel RDT CAT and MBA // features and flags enabling Intel RDT CMT and MBM features. // Intel RDT features are available in Linux 4.14 and newer kernel versions. type LinuxIntelRdt struct { // The identity for RDT Class of Service ClosID string `json:"closID,omitempty"` // The schema for L3 cache id and capacity bitmask (CBM) // Format: "L3:=;=;..." L3CacheSchema string `json:"l3CacheSchema,omitempty"` // The schema of memory bandwidth per L3 cache id // Format: "MB:=bandwidth0;=bandwidth1;..." // The unit of memory bandwidth is specified in "percentages" by // default, and in "MBps" if MBA Software Controller is enabled. MemBwSchema string `json:"memBwSchema,omitempty"` // EnableCMT is the flag to indicate if the Intel RDT CMT is enabled. CMT (Cache Monitoring Technology) supports monitoring of // the last-level cache (LLC) occupancy for the container. EnableCMT bool `json:"enableCMT,omitempty"` // EnableMBM is the flag to indicate if the Intel RDT MBM is enabled. MBM (Memory Bandwidth Monitoring) supports monitoring of // total and local memory bandwidth for the container. EnableMBM bool `json:"enableMBM,omitempty"` } // ZOS contains platform-specific configuration for z/OS based containers. type ZOS struct { // Devices are a list of device nodes that are created for the container Devices []ZOSDevice `json:"devices,omitempty"` } // ZOSDevice represents the mknod information for a z/OS special device file type ZOSDevice struct { // Path to the device. Path string `json:"path"` // Device type, block, char, etc. Type string `json:"type"` // Major is the device's major number. Major int64 `json:"major"` // Minor is the device's minor number. Minor int64 `json:"minor"` // FileMode permission bits for the device. FileMode *os.FileMode `json:"fileMode,omitempty"` // UID of the device. UID *uint32 `json:"uid,omitempty"` // Gid of the device. GID *uint32 `json:"gid,omitempty"` } // LinuxSchedulerPolicy represents different scheduling policies used with the Linux Scheduler type LinuxSchedulerPolicy string const ( // SchedOther is the default scheduling policy SchedOther LinuxSchedulerPolicy = "SCHED_OTHER" // SchedFIFO is the First-In-First-Out scheduling policy SchedFIFO LinuxSchedulerPolicy = "SCHED_FIFO" // SchedRR is the Round-Robin scheduling policy SchedRR LinuxSchedulerPolicy = "SCHED_RR" // SchedBatch is the Batch scheduling policy SchedBatch LinuxSchedulerPolicy = "SCHED_BATCH" // SchedISO is the Isolation scheduling policy SchedISO LinuxSchedulerPolicy = "SCHED_ISO" // SchedIdle is the Idle scheduling policy SchedIdle LinuxSchedulerPolicy = "SCHED_IDLE" // SchedDeadline is the Deadline scheduling policy SchedDeadline LinuxSchedulerPolicy = "SCHED_DEADLINE" ) // LinuxSchedulerFlag represents the flags used by the Linux Scheduler. type LinuxSchedulerFlag string const ( // SchedFlagResetOnFork represents the reset on fork scheduling flag SchedFlagResetOnFork LinuxSchedulerFlag = "SCHED_FLAG_RESET_ON_FORK" // SchedFlagReclaim represents the reclaim scheduling flag SchedFlagReclaim LinuxSchedulerFlag = "SCHED_FLAG_RECLAIM" // SchedFlagDLOverrun represents the deadline overrun scheduling flag SchedFlagDLOverrun LinuxSchedulerFlag = "SCHED_FLAG_DL_OVERRUN" // SchedFlagKeepPolicy represents the keep policy scheduling flag SchedFlagKeepPolicy LinuxSchedulerFlag = "SCHED_FLAG_KEEP_POLICY" // SchedFlagKeepParams represents the keep parameters scheduling flag SchedFlagKeepParams LinuxSchedulerFlag = "SCHED_FLAG_KEEP_PARAMS" // SchedFlagUtilClampMin represents the utilization clamp minimum scheduling flag SchedFlagUtilClampMin LinuxSchedulerFlag = "SCHED_FLAG_UTIL_CLAMP_MIN" // SchedFlagUtilClampMin represents the utilization clamp maximum scheduling flag SchedFlagUtilClampMax LinuxSchedulerFlag = "SCHED_FLAG_UTIL_CLAMP_MAX" ) crun-1.16.1/libocispec/runtime-spec/specs-go/version.go0000644000000000000000000000103014614670026021220 0ustar0000000000000000package specs import "fmt" const ( // VersionMajor is for an API incompatible changes VersionMajor = 1 // VersionMinor is for functionality in a backwards-compatible manner VersionMinor = 2 // VersionPatch is for backwards-compatible bug fixes VersionPatch = 0 // VersionDev indicates development branch. Releases will be empty string. VersionDev = "+dev" ) // Version is the specification version that the package types support. var Version = fmt.Sprintf("%d.%d.%d%s", VersionMajor, VersionMinor, VersionPatch, VersionDev) crun-1.16.1/libocispec/runtime-spec/specs-go/state.go0000664000000000000000000000371014031115653020655 0ustar0000000000000000package specs // ContainerState represents the state of a container. type ContainerState string const ( // StateCreating indicates that the container is being created StateCreating ContainerState = "creating" // StateCreated indicates that the runtime has finished the create operation StateCreated ContainerState = "created" // StateRunning indicates that the container process has executed the // user-specified program but has not exited StateRunning ContainerState = "running" // StateStopped indicates that the container process has exited StateStopped ContainerState = "stopped" ) // State holds information about the runtime state of the container. type State struct { // Version is the version of the specification that is supported. Version string `json:"ociVersion"` // ID is the container ID ID string `json:"id"` // Status is the runtime status of the container. Status ContainerState `json:"status"` // Pid is the process ID for the container process. Pid int `json:"pid,omitempty"` // Bundle is the path to the container's bundle directory. Bundle string `json:"bundle"` // Annotations are key values associated with the container. Annotations map[string]string `json:"annotations,omitempty"` } const ( // SeccompFdName is the name of the seccomp notify file descriptor. SeccompFdName string = "seccompFd" ) // ContainerProcessState holds information about the state of a container process. type ContainerProcessState struct { // Version is the version of the specification that is supported. Version string `json:"ociVersion"` // Fds is a string array containing the names of the file descriptors passed. // The index of the name in this array corresponds to index of the file // descriptor in the `SCM_RIGHTS` array. Fds []string `json:"fds"` // Pid is the process ID as seen by the runtime. Pid int `json:"pid"` // Opaque metadata. Metadata string `json:"metadata,omitempty"` // State of the container. State State `json:"state"` } crun-1.16.1/libocispec/runtime-spec/style.md0000664000000000000000000001241713677106243017166 0ustar0000000000000000# Style and conventions ## One sentence per line To keep consistency throughout the Markdown files in the Open Container spec all files should be formatted one sentence per line. This fixes two things: it makes diffing easier with git and it resolves fights about line wrapping length. For example, this paragraph will span three lines in the Markdown source. ## Traditionally hex settings should use JSON integers, not JSON strings For example, [`"classID": 1048577`](config-linux.md#network) instead of `"classID": "0x100001"`. The config JSON isn't enough of a UI to be worth jumping through string <-> integer hoops to support an 0x… form ([source][integer-over-hex]). ## Constant names should keep redundant prefixes For example, `CAP_KILL` instead of `KILL` in [**`process.capabilities`**](config.md#process). The redundancy reduction from removing the namespacing prefix is not useful enough to be worth trimming the upstream identifier ([source][keep-prefix]). ## Optional settings should not have pointer Go types Because in many cases the Go default for the type is a no-op in the spec (sources [here][no-pointer-for-strings], [here][no-pointer-for-slices], and [here][no-pointer-for-boolean]). The exceptions are entries where we need to distinguish between “not set†and “set to the Go default for that type†([source][pointer-when-updates-require-changes]), and this decision should be made on a per-setting case. ## Links Internal links should be [relative links][markdown-relative-links] when linking to content within the repository. Internal links should be used inline. External links should be collected at the bottom of a markdown file and used as referenced links. See 'Referenced Links' in this [markdown quick reference][markdown-quick-reference]. The use of referenced links in the markdown body helps to keep files clean and organized. This also facilitates updates of external link targets on a per-file basis. Referenced links should be kept in two alphabetically sorted sets, a general reference section followed by a man page section. To keep Pandoc happy, duplicate naming of links within pages listed in the Makefile's `DOC_FILES` variable should be avoided by appending an `_N` to the link tagname, where `N` is some number not currently in use. The organization and style of an existing reference section should be maintained unless it violates these style guidelines. An exception to these rules is when a URL is needed contextually, for example when showing an explicit link to the reader. ## Examples ### Anchoring For any given section that provides a notable example, it is ideal to have it denoted with [markdown headers][markdown-headers]. The level of header should be such that it is a subheader of the header it is an example of. #### Example ```markdown ## Some Topic ### Some Subheader #### Further Subheader ##### Example To use Further Subheader, ... ### Example To use Some Topic, ... ``` ### Content Where necessary, the values in the example can be empty or unset, but accommodate with comments regarding this intention. Where feasible, the content and values used in an example should convey the fullest use of the data structures concerned. Most commonly onlookers will intend to copy-and-paste a "working example". If the intention of the example is to be a fully utilized example, rather than a copy-and-paste example, perhaps add a comment as such. ```markdown ### Example ``` ```json { "foo": null, "bar": "" } ``` **vs.** ```markdown ### Example Following is a fully populated example (not necessarily for copy/paste use) ``` ```json { "foo": [ 1, 2, 3 ], "bar": "waffles", "bif": { "baz": "potatoes" } } ``` ### Links The following is an example of different types of links. This is shown as a complete markdown file, where the referenced links are at the bottom. ```markdown The specification repository's [glossary](glossary.md) is where readers can find definitions of commonly used terms. Readers may click through to the [Open Containers namespace][open-containers] on [GitHub][github]. The URL for the Open Containers link above is: https://github.com/opencontainers [github]: https://github.com [open-containers]: https://github.com/opencontainers ``` [integer-over-hex]: https://github.com/opencontainers/runtime-spec/pull/267#r48360013 [keep-prefix]: https://github.com/opencontainers/runtime-spec/pull/159#issuecomment-138728337 [no-pointer-for-boolean]: https://github.com/opencontainers/runtime-spec/pull/290#r50296396 [no-pointer-for-slices]: https://github.com/opencontainers/runtime-spec/pull/316#r50782982 [no-pointer-for-strings]: https://github.com/opencontainers/runtime-spec/pull/653#issue-200439192 [pointer-when-updates-require-changes]: https://github.com/opencontainers/runtime-spec/pull/317#r50932706 [markdown-headers]: https://help.github.com/articles/basic-writing-and-formatting-syntax/#headings [markdown-quick-reference]: https://en.support.wordpress.com/markdown-quick-reference [markdown-relative-links]: https://help.github.com/articles/basic-writing-and-formatting-syntax/#relative-links crun-1.16.1/libocispec/runtime-spec/spec.md0000644000000000000000000000642014460417222016744 0ustar0000000000000000# Open Container Initiative Runtime Specification The [Open Container Initiative][oci] develops specifications for standards on Operating System process and application containers. # Abstract The Open Container Initiative Runtime Specification aims to specify the configuration, execution environment, and lifecycle of a container. A container's configuration is specified as the `config.json` for the supported platforms and details the fields that enable the creation of a container. The execution environment is specified to ensure that applications running inside a container have a consistent environment between runtimes along with common actions defined for the container's lifecycle. # Platforms Platforms defined by this specification are: * `linux`: [runtime.md](runtime.md), [config.md](config.md), [features.md](features.md), [config-linux.md](config-linux.md), [runtime-linux.md](runtime-linux.md), and [features-linux.md](features-linux.md). * `solaris`: [runtime.md](runtime.md), [config.md](config.md), [features.md](features.md), and [config-solaris.md](config-solaris.md). * `windows`: [runtime.md](runtime.md), [config.md](config.md), [features.md](features.md), and [config-windows.md](config-windows.md). * `vm`: [runtime.md](runtime.md), [config.md](config.md), [features.md](features.md), and [config-vm.md](config-vm.md). * `zos`: [runtime.md](runtime.md), [config.md](config.md), [features.md](features.md), and [config-zos.md](config-zos.md). # Table of Contents - [Introduction](spec.md) - [Notational Conventions](#notational-conventions) - [Container Principles](principles.md) - [Filesystem Bundle](bundle.md) - [Runtime and Lifecycle](runtime.md) - [Linux-specific Runtime and Lifecycle](runtime-linux.md) - [Configuration](config.md) - [Linux-specific Configuration](config-linux.md) - [Solaris-specific Configuration](config-solaris.md) - [Windows-specific Configuration](config-windows.md) - [Virtual-Machine-specific Configuration](config-vm.md) - [z/OS-specific Configuration](config-zos.md) - [Features Structure](features.md) - [Linux-specific Features Structure](features-linux.md) - [Glossary](glossary.md) # Notational Conventions The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in [RFC 2119][rfc2119]. The key words "unspecified", "undefined", and "implementation-defined" are to be interpreted as described in the [rationale for the C99 standard][c99-unspecified]. An implementation is not compliant for a given CPU architecture if it fails to satisfy one or more of the MUST, REQUIRED, or SHALL requirements for the [platforms](#platforms) it implements. An implementation is compliant for a given CPU architecture if it satisfies all the MUST, REQUIRED, and SHALL requirements for the [platforms](#platforms) it implements. [c99-unspecified]: http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf#page=18 [oci]: http://www.opencontainers.org [rfc2119]: https://www.rfc-editor.org/rfc/rfc2119.html crun-1.16.1/libocispec/image-spec/0000775000000000000000000000000014614670026015073 5ustar0000000000000000crun-1.16.1/libocispec/image-spec/.tool/0000775000000000000000000000000014265762063016133 5ustar0000000000000000crun-1.16.1/libocispec/image-spec/.tool/check-license0000775000000000000000000000044013677106243020552 0ustar0000000000000000#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail ret=0 for file in $(find . -type f -iname '*.go' ! -path './vendor/*'); do if ! head -n3 "${file}" | grep -Eq "(Copyright|generated|GENERATED)"; then echo "${file}:missing license header" ret=1 fi done exit $ret crun-1.16.1/libocispec/image-spec/.tool/genheader.go0000664000000000000000000000262713677106243020411 0ustar0000000000000000// Copyright 2017 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "bytes" "fmt" "os" "os/exec" "strings" "text/template" specs "github.com/opencontainers/image-spec/specs-go" ) var headerTemplate = template.Must(template.New("gen").Parse(`image-spec {{.Version}} `)) type Obj struct { Version string Branch string } func main() { obj := Obj{ Version: specs.Version, Branch: specs.Version, } if strings.HasSuffix(specs.Version, "-dev") { cmd := exec.Command("git", "log", "-1", `--pretty=%H`, "HEAD") var out bytes.Buffer cmd.Stdout = &out cmd.Stderr = os.Stderr if err := cmd.Run(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } obj.Branch = strings.Trim(out.String(), " \n\r") } headerTemplate.Execute(os.Stdout, obj) } crun-1.16.1/libocispec/image-spec/specs-go/0000775000000000000000000000000014614670026016613 5ustar0000000000000000crun-1.16.1/libocispec/image-spec/specs-go/versioned.go0000664000000000000000000000165213677106243021147 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package specs // Versioned provides a struct with the manifest schemaVersion and mediaType. // Incoming content with unknown schema version can be decoded against this // struct to check the version. type Versioned struct { // SchemaVersion is the image manifest schema that this image follows SchemaVersion int `json:"schemaVersion"` } crun-1.16.1/libocispec/image-spec/specs-go/version.go0000644000000000000000000000215614614670026020631 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package specs import "fmt" const ( // VersionMajor is for an API incompatible changes VersionMajor = 1 // VersionMinor is for functionality in a backwards-compatible manner VersionMinor = 1 // VersionPatch is for backwards-compatible bug fixes VersionPatch = 0 // VersionDev indicates development branch. Releases will be empty string. VersionDev = "+dev" ) // Version is the specification version that the package types support. var Version = fmt.Sprintf("%d.%d.%d%s", VersionMajor, VersionMinor, VersionPatch, VersionDev) crun-1.16.1/libocispec/image-spec/specs-go/v1/0000775000000000000000000000000014614670026017141 5ustar0000000000000000crun-1.16.1/libocispec/image-spec/specs-go/v1/descriptor.go0000644000000000000000000000604614614670026021652 0ustar0000000000000000// Copyright 2016-2022 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package v1 import digest "github.com/opencontainers/go-digest" // Descriptor describes the disposition of targeted content. // This structure provides `application/vnd.oci.descriptor.v1+json` mediatype // when marshalled to JSON. type Descriptor struct { // MediaType is the media type of the object this schema refers to. MediaType string `json:"mediaType"` // Digest is the digest of the targeted content. Digest digest.Digest `json:"digest"` // Size specifies the size in bytes of the blob. Size int64 `json:"size"` // URLs specifies a list of URLs from which this object MAY be downloaded URLs []string `json:"urls,omitempty"` // Annotations contains arbitrary metadata relating to the targeted content. Annotations map[string]string `json:"annotations,omitempty"` // Data is an embedding of the targeted content. This is encoded as a base64 // string when marshalled to JSON (automatically, by encoding/json). If // present, Data can be used directly to avoid fetching the targeted content. Data []byte `json:"data,omitempty"` // Platform describes the platform which the image in the manifest runs on. // // This should only be used when referring to a manifest. Platform *Platform `json:"platform,omitempty"` // ArtifactType is the IANA media type of this artifact. ArtifactType string `json:"artifactType,omitempty"` } // Platform describes the platform which the image in the manifest runs on. type Platform struct { // Architecture field specifies the CPU architecture, for example // `amd64` or `ppc64le`. Architecture string `json:"architecture"` // OS specifies the operating system, for example `linux` or `windows`. OS string `json:"os"` // OSVersion is an optional field specifying the operating system // version, for example on Windows `10.0.14393.1066`. OSVersion string `json:"os.version,omitempty"` // OSFeatures is an optional field specifying an array of strings, // each listing a required OS feature (for example on Windows `win32k`). OSFeatures []string `json:"os.features,omitempty"` // Variant is an optional field specifying a variant of the CPU, for // example `v7` to specify ARMv7 when architecture is `arm`. Variant string `json:"variant,omitempty"` } // DescriptorEmptyJSON is the descriptor of a blob with content of `{}`. var DescriptorEmptyJSON = Descriptor{ MediaType: MediaTypeEmptyJSON, Digest: `sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a`, Size: 2, Data: []byte(`{}`), } crun-1.16.1/libocispec/image-spec/specs-go/v1/index.go0000644000000000000000000000310314614670026020572 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package v1 import "github.com/opencontainers/image-spec/specs-go" // Index references manifests for various platforms. // This structure provides `application/vnd.oci.image.index.v1+json` mediatype when marshalled to JSON. type Index struct { specs.Versioned // MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.index.v1+json` MediaType string `json:"mediaType,omitempty"` // ArtifactType specifies the IANA media type of artifact when the manifest is used for an artifact. ArtifactType string `json:"artifactType,omitempty"` // Manifests references platform specific manifests. Manifests []Descriptor `json:"manifests"` // Subject is an optional link from the image manifest to another manifest forming an association between the image manifest and the other manifest. Subject *Descriptor `json:"subject,omitempty"` // Annotations contains arbitrary metadata for the image index. Annotations map[string]string `json:"annotations,omitempty"` } crun-1.16.1/libocispec/image-spec/specs-go/v1/layout.go0000644000000000000000000000236514614670026021011 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package v1 const ( // ImageLayoutFile is the file name containing ImageLayout in an OCI Image Layout ImageLayoutFile = "oci-layout" // ImageLayoutVersion is the version of ImageLayout ImageLayoutVersion = "1.0.0" // ImageIndexFile is the file name of the entry point for references and descriptors in an OCI Image Layout ImageIndexFile = "index.json" // ImageBlobsDir is the directory name containing content addressable blobs in an OCI Image Layout ImageBlobsDir = "blobs" ) // ImageLayout is the structure in the "oci-layout" file, found in the root // of an OCI Image-layout directory. type ImageLayout struct { Version string `json:"imageLayoutVersion"` } crun-1.16.1/libocispec/image-spec/specs-go/v1/manifest.go0000644000000000000000000000337614614670026021305 0ustar0000000000000000// Copyright 2016-2022 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package v1 import "github.com/opencontainers/image-spec/specs-go" // Manifest provides `application/vnd.oci.image.manifest.v1+json` mediatype structure when marshalled to JSON. type Manifest struct { specs.Versioned // MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.manifest.v1+json` MediaType string `json:"mediaType,omitempty"` // ArtifactType specifies the IANA media type of artifact when the manifest is used for an artifact. ArtifactType string `json:"artifactType,omitempty"` // Config references a configuration object for a container, by digest. // The referenced configuration object is a JSON blob that the runtime uses to set up the container. Config Descriptor `json:"config"` // Layers is an indexed list of layers referenced by the manifest. Layers []Descriptor `json:"layers"` // Subject is an optional link from the image manifest to another manifest forming an association between the image manifest and the other manifest. Subject *Descriptor `json:"subject,omitempty"` // Annotations contains arbitrary metadata for the image manifest. Annotations map[string]string `json:"annotations,omitempty"` } crun-1.16.1/libocispec/image-spec/specs-go/v1/mediatype.go0000644000000000000000000000721014614670026021447 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package v1 const ( // MediaTypeDescriptor specifies the media type for a content descriptor. MediaTypeDescriptor = "application/vnd.oci.descriptor.v1+json" // MediaTypeLayoutHeader specifies the media type for the oci-layout. MediaTypeLayoutHeader = "application/vnd.oci.layout.header.v1+json" // MediaTypeImageIndex specifies the media type for an image index. MediaTypeImageIndex = "application/vnd.oci.image.index.v1+json" // MediaTypeImageManifest specifies the media type for an image manifest. MediaTypeImageManifest = "application/vnd.oci.image.manifest.v1+json" // MediaTypeImageConfig specifies the media type for the image configuration. MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json" // MediaTypeEmptyJSON specifies the media type for an unused blob containing the value "{}". MediaTypeEmptyJSON = "application/vnd.oci.empty.v1+json" ) const ( // MediaTypeImageLayer is the media type used for layers referenced by the manifest. MediaTypeImageLayer = "application/vnd.oci.image.layer.v1.tar" // MediaTypeImageLayerGzip is the media type used for gzipped layers // referenced by the manifest. MediaTypeImageLayerGzip = "application/vnd.oci.image.layer.v1.tar+gzip" // MediaTypeImageLayerZstd is the media type used for zstd compressed // layers referenced by the manifest. MediaTypeImageLayerZstd = "application/vnd.oci.image.layer.v1.tar+zstd" ) // Non-distributable layer media-types. // // Deprecated: Non-distributable layers are deprecated, and not recommended // for future use. Implementations SHOULD NOT produce new non-distributable // layers. // https://github.com/opencontainers/image-spec/pull/965 const ( // MediaTypeImageLayerNonDistributable is the media type for layers referenced by // the manifest but with distribution restrictions. // // Deprecated: Non-distributable layers are deprecated, and not recommended // for future use. Implementations SHOULD NOT produce new non-distributable // layers. // https://github.com/opencontainers/image-spec/pull/965 MediaTypeImageLayerNonDistributable = "application/vnd.oci.image.layer.nondistributable.v1.tar" // MediaTypeImageLayerNonDistributableGzip is the media type for // gzipped layers referenced by the manifest but with distribution // restrictions. // // Deprecated: Non-distributable layers are deprecated, and not recommended // for future use. Implementations SHOULD NOT produce new non-distributable // layers. // https://github.com/opencontainers/image-spec/pull/965 MediaTypeImageLayerNonDistributableGzip = "application/vnd.oci.image.layer.nondistributable.v1.tar+gzip" // MediaTypeImageLayerNonDistributableZstd is the media type for zstd // compressed layers referenced by the manifest but with distribution // restrictions. // // Deprecated: Non-distributable layers are deprecated, and not recommended // for future use. Implementations SHOULD NOT produce new non-distributable // layers. // https://github.com/opencontainers/image-spec/pull/965 MediaTypeImageLayerNonDistributableZstd = "application/vnd.oci.image.layer.nondistributable.v1.tar+zstd" ) crun-1.16.1/libocispec/image-spec/specs-go/v1/annotations.go0000644000000000000000000000615114614670026022026 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package v1 const ( // AnnotationCreated is the annotation key for the date and time on which the image was built (date-time string as defined by RFC 3339). AnnotationCreated = "org.opencontainers.image.created" // AnnotationAuthors is the annotation key for the contact details of the people or organization responsible for the image (freeform string). AnnotationAuthors = "org.opencontainers.image.authors" // AnnotationURL is the annotation key for the URL to find more information on the image. AnnotationURL = "org.opencontainers.image.url" // AnnotationDocumentation is the annotation key for the URL to get documentation on the image. AnnotationDocumentation = "org.opencontainers.image.documentation" // AnnotationSource is the annotation key for the URL to get source code for building the image. AnnotationSource = "org.opencontainers.image.source" // AnnotationVersion is the annotation key for the version of the packaged software. // The version MAY match a label or tag in the source code repository. // The version MAY be Semantic versioning-compatible. AnnotationVersion = "org.opencontainers.image.version" // AnnotationRevision is the annotation key for the source control revision identifier for the packaged software. AnnotationRevision = "org.opencontainers.image.revision" // AnnotationVendor is the annotation key for the name of the distributing entity, organization or individual. AnnotationVendor = "org.opencontainers.image.vendor" // AnnotationLicenses is the annotation key for the license(s) under which contained software is distributed as an SPDX License Expression. AnnotationLicenses = "org.opencontainers.image.licenses" // AnnotationRefName is the annotation key for the name of the reference for a target. // SHOULD only be considered valid when on descriptors on `index.json` within image layout. AnnotationRefName = "org.opencontainers.image.ref.name" // AnnotationTitle is the annotation key for the human-readable title of the image. AnnotationTitle = "org.opencontainers.image.title" // AnnotationDescription is the annotation key for the human-readable description of the software packaged in the image. AnnotationDescription = "org.opencontainers.image.description" // AnnotationBaseImageDigest is the annotation key for the digest of the image's base image. AnnotationBaseImageDigest = "org.opencontainers.image.base.digest" // AnnotationBaseImageName is the annotation key for the image reference of the image's base image. AnnotationBaseImageName = "org.opencontainers.image.base.name" ) crun-1.16.1/libocispec/image-spec/specs-go/v1/config.go0000644000000000000000000001070414416051456020735 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package v1 import ( "time" digest "github.com/opencontainers/go-digest" ) // ImageConfig defines the execution parameters which should be used as a base when running a container using an image. type ImageConfig struct { // User defines the username or UID which the process in the container should run as. User string `json:"User,omitempty"` // ExposedPorts a set of ports to expose from a container running this image. ExposedPorts map[string]struct{} `json:"ExposedPorts,omitempty"` // Env is a list of environment variables to be used in a container. Env []string `json:"Env,omitempty"` // Entrypoint defines a list of arguments to use as the command to execute when the container starts. Entrypoint []string `json:"Entrypoint,omitempty"` // Cmd defines the default arguments to the entrypoint of the container. Cmd []string `json:"Cmd,omitempty"` // Volumes is a set of directories describing where the process is likely write data specific to a container instance. Volumes map[string]struct{} `json:"Volumes,omitempty"` // WorkingDir sets the current working directory of the entrypoint process in the container. WorkingDir string `json:"WorkingDir,omitempty"` // Labels contains arbitrary metadata for the container. Labels map[string]string `json:"Labels,omitempty"` // StopSignal contains the system call signal that will be sent to the container to exit. StopSignal string `json:"StopSignal,omitempty"` // ArgsEscaped // // Deprecated: This field is present only for legacy compatibility with // Docker and should not be used by new image builders. It is used by Docker // for Windows images to indicate that the `Entrypoint` or `Cmd` or both, // contains only a single element array, that is a pre-escaped, and combined // into a single string `CommandLine`. If `true` the value in `Entrypoint` or // `Cmd` should be used as-is to avoid double escaping. // https://github.com/opencontainers/image-spec/pull/892 ArgsEscaped bool `json:"ArgsEscaped,omitempty"` } // RootFS describes a layer content addresses type RootFS struct { // Type is the type of the rootfs. Type string `json:"type"` // DiffIDs is an array of layer content hashes (DiffIDs), in order from bottom-most to top-most. DiffIDs []digest.Digest `json:"diff_ids"` } // History describes the history of a layer. type History struct { // Created is the combined date and time at which the layer was created, formatted as defined by RFC 3339, section 5.6. Created *time.Time `json:"created,omitempty"` // CreatedBy is the command which created the layer. CreatedBy string `json:"created_by,omitempty"` // Author is the author of the build point. Author string `json:"author,omitempty"` // Comment is a custom message set when creating the layer. Comment string `json:"comment,omitempty"` // EmptyLayer is used to mark if the history item created a filesystem diff. EmptyLayer bool `json:"empty_layer,omitempty"` } // Image is the JSON structure which describes some basic information about the image. // This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON. type Image struct { // Created is the combined date and time at which the image was created, formatted as defined by RFC 3339, section 5.6. Created *time.Time `json:"created,omitempty"` // Author defines the name and/or email address of the person or entity which created and is responsible for maintaining the image. Author string `json:"author,omitempty"` // Platform describes the platform which the image in the manifest runs on. Platform // Config defines the execution parameters which should be used as a base when running a container using the image. Config ImageConfig `json:"config,omitempty"` // RootFS references the layer content addresses used by the image. RootFS RootFS `json:"rootfs"` // History describes the history of each layer. History []History `json:"history,omitempty"` } crun-1.16.1/libocispec/image-spec/HACKING.md0000644000000000000000000000341014614670026016455 0ustar0000000000000000# Hacking Guide ## Overview This guide contains instructions for building artifacts contained in this repository. ### Go This spec includes several Go packages, and a command line tool considered to be a reference implementation of the OCI image specification. Prerequisites: - Go - current release only, earlier releases are not supported - make The following make targets are relevant for any work involving the Go packages. ### Linting The included Go source code is being examined for any linting violations not included in the standard Go compiler. Linting is done using [golangci-lint][golangci-lint]. Invocation: ```shell make lint ``` ### Tests This target executes all Go based tests. Invocation: ```shell make test make validate-examples ``` ### JSON schema formatting This target auto-formats all JSON files in the `schema` directory using the `jq` tool. Prerequisites: - [jq][jq] >=1.5 Invocation: ```shell make fmt ``` ### OCI image specification PDF/HTML documentation files This target generates a PDF/HTML version of the OCI image specification. Prerequisites: - [Docker][docker] Invocation: ```shell make docs ``` ### License header check This target checks if the source code includes necessary headers. Invocation: ```shell make check-license ``` ### Clean build artifacts This target cleans all generated/compiled artifacts. Invocation: ```shell make clean ``` ### Create PNG images from dot files This target generates PNG image files from DOT source files in the `img` directory. Prerequisites: - [graphviz][graphviz] Invocation: ```shell make img/media-types.png ``` [docker]: https://www.docker.com/ [golangci-lint]: https://github.com/golangci/golangci-lint [graphviz]: https://www.graphviz.org/ [jq]: https://stedolan.github.io/jq/ crun-1.16.1/libocispec/image-spec/Makefile0000644000000000000000000001056414614670026016537 0ustar0000000000000000EPOCH_TEST_COMMIT ?= v0.2.0 DOCKER ?= $(shell command -v docker 2>/dev/null) PANDOC ?= $(shell command -v pandoc 2>/dev/null) GOPATH:=$(shell go env GOPATH) OUTPUT_DIRNAME ?= output DOC_FILENAME ?= oci-image-spec PANDOC_CONTAINER ?= ghcr.io/opencontainers/pandoc:2.9.2.1-8.fc33.x86_64@sha256:5d81ff930a043295a557be8b003ece2a33d14e91b28c50d368413b83372f8d28 ifeq "$(strip $(PANDOC))" '' ifneq "$(strip $(DOCKER))" '' PANDOC = $(DOCKER) run \ --rm \ -v $(shell pwd)/:/input/:ro \ -v $(shell pwd)/$(OUTPUT_DIRNAME)/:/$(OUTPUT_DIRNAME)/ \ -u $(shell id -u) \ --workdir /input \ $(PANDOC_CONTAINER) PANDOC_SRC := /input/ PANDOC_DST := / endif endif # These docs are in an order that determines how they show up in the PDF/HTML docs. DOC_FILES := \ spec.md \ media-types.md \ descriptor.md \ image-layout.md \ manifest.md \ image-index.md \ layer.md \ config.md \ annotations.md \ conversion.md \ considerations.md \ implementations.md FIGURE_FILES := \ img/media-types.png MARKDOWN_LINT_VER?=v0.8.1 TOOLS := gitvalidation default: check-license lint test .PHONY: fmt fmt: ## format the json with indentation for i in schema/*.json ; do jq --indent 2 -M . "$${i}" > xx && cat xx > "$${i}" && rm xx ; done .PHONY: docs docs: $(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf $(OUTPUT_DIRNAME)/$(DOC_FILENAME).html ## generate a PDF/HTML version of the OCI image specification ifeq "$(strip $(PANDOC))" '' $(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf: $(DOC_FILES) $(FIGURE_FILES) $(error cannot build $@ without either pandoc or docker) else $(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf: $(DOC_FILES) $(FIGURE_FILES) @mkdir -p $(OUTPUT_DIRNAME)/ && \ $(PANDOC) -f gfm -t latex --pdf-engine=xelatex -V geometry:margin=0.5in,bottom=0.8in -V block-headings -o $(PANDOC_DST)$@ $(patsubst %,$(PANDOC_SRC)%,$(DOC_FILES)) ls -sh $(realpath $@) $(OUTPUT_DIRNAME)/$(DOC_FILENAME).html: header.html $(DOC_FILES) $(FIGURE_FILES) @mkdir -p $(OUTPUT_DIRNAME)/ && \ cp -ap img/ $(shell pwd)/$(OUTPUT_DIRNAME)/&& \ $(PANDOC) -f gfm -t html5 -H $(PANDOC_SRC)header.html --standalone -o $(PANDOC_DST)$@ $(patsubst %,$(PANDOC_SRC)%,$(DOC_FILES)) ls -sh $(realpath $@) endif header.html: .tool/genheader.go specs-go/version.go go run .tool/genheader.go > $@ .PHONY: validate-examples validate-examples: schema/schema.go ## validate examples in the specification markdown files go test -run TestValidate ./schema .PHONY: check-license check-license: ## check license headers in source files @echo "checking license headers" @./.tool/check-license .PHONY: lint .PHONY: lint lint: lint-go lint-md ## Run all linters .PHONY: lint-go lint-go: .install.lint ## lint check of Go files using golangci-lint @echo "checking Go lint" @GO111MODULE=on $(GOPATH)/bin/golangci-lint run .PHONY: lint-md lint-md: ## Run linting for markdown docker run --rm -v "$(PWD):/workdir:ro" docker.io/davidanson/markdownlint-cli2:$(MARKDOWN_LINT_VER) \ "**/*.md" "#vendor" .PHONY: test test: ## run the unit tests go test -race -cover $(shell go list ./... | grep -v /vendor/) img/%.png: img/%.dot ## generate PNG from dot file dot -Tpng $^ > $@ # When this is running in GitHub, it will only check the commit range .PHONY: .gitvalidation .gitvalidation: @which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false) ifdef GITHUB_SHA $(GOPATH)/bin/git-validation -q -run DCO,short-subject,dangling-whitespace -range $(GITHUB_SHA)..HEAD else $(GOPATH)/bin/git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD endif .PHONY: .install.tools install.tools: $(TOOLS:%=.install.%) .PHONY: .install.lint .install.lint: case "$$(go env GOVERSION)" in \ go1.18.*) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.3;; \ go1.19.*) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.1;; \ go1.20.*) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2;; \ *) go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest;; \ esac .PHONY: .install.gitvalidation .install.gitvalidation: go install github.com/vbatts/git-validation@latest .PHONY: clean clean: ## clean all generated and compiled artifacts rm -rf *~ $(OUTPUT_DIRNAME) header.html .PHONY: help help: # Display help @awk -F ':|##' '/^[^\t].+?:.*?##/ { printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF }' $(MAKEFILE_LIST) crun-1.16.1/libocispec/image-spec/README.md0000644000000000000000000001660514614670026016360 0ustar0000000000000000# OCI Image Format Specification ![GitHub Actions for Docs and Linting](https://img.shields.io/github/actions/workflow/status/opencontainers/image-spec/docs-and-linting.yml?branch=main&label=GHA%20docs%20and%20linting) ![License](https://img.shields.io/github/license/opencontainers/image-spec) [![Go Reference](https://pkg.go.dev/badge/github.com/opencontainers/image-spec.svg)](https://pkg.go.dev/github.com/opencontainers/image-spec) The OCI Image Format project creates and maintains the software shipping container image format spec (OCI Image Format). **[The specification can be found here](spec.md).** This repository also provides [Go types](specs-go), [intra-blob validation tooling, and JSON Schema](schema). The Go types and validation should be compatible with the current Go release; earlier Go releases are not supported. Additional documentation about how this group operates: - [Code of Conduct][code-of-conduct] - [Roadmap](#roadmap) - [Releases](RELEASES.md) - [Project Documentation](project.md) ## Running an OCI Image The OCI Image Format partner project is the [OCI Runtime Spec project](https://github.com/opencontainers/runtime-spec). The Runtime Specification outlines how to run a "[filesystem bundle](https://github.com/opencontainers/runtime-spec/blob/master/bundle.md)" that is unpacked on disk. At a high-level an OCI implementation would download an OCI Image then unpack that image into an OCI Runtime filesystem bundle. At this point the OCI Runtime Bundle would be run by an OCI Runtime. This entire workflow supports the UX that users have come to expect from container engines like Docker and rkt: primarily, the ability to run an image with no additional arguments: - docker run example.com/org/app:v1.0.0 - rkt run example.com/org/app,version=v1.0.0 To support this UX the OCI Image Format contains sufficient information to launch the application on the target platform (e.g. command, arguments, environment variables, etc). ## Distributing an OCI Image The [OCI Distribution Spec Project](https://github.com/opencontainers/distribution-spec/) defines an API protocol to facilitate and standardize the distribution of content. This API includes support for pushing and pulling OCI images to an OCI conformant registry. ## FAQ **Q: What happens to AppC or Docker Image Formats?** A: Existing formats can continue to be a proving ground for technologies, as needed. The OCI Image Format project strives to provide a dependable open specification that can be shared between different tools and be evolved for years or decades of compatibility; as the deb and rpm format have. Find more [FAQ on the OCI site](https://www.opencontainers.org/faq). ## Roadmap The [GitHub milestones](https://github.com/opencontainers/image-spec/milestones) lay out the path to the future improvements. ## Contributing Development happens on GitHub for the spec. Issues are used for bugs and actionable items and longer discussions can happen on the [mailing list](#mailing-list). The specification and code is licensed under the Apache 2.0 license found in the `LICENSE` file of this repository. ### Discuss your design The project welcomes submissions, but please let everyone know what you are working on. Before undertaking a nontrivial change to this specification, send mail to the [mailing list](#mailing-list) to discuss what you plan to do. This gives everyone a chance to validate the design, helps prevent duplication of effort, and ensures that the idea fits. It also guarantees that the design is sound before code is written; a GitHub pull-request is not the place for high-level discussions. Typos and grammatical errors can go straight to a pull-request. When in doubt, start on the [mailing-list](#mailing-list). ### Meetings Please see the [OCI org repository README](https://github.com/opencontainers/org#meetings) for the most up-to-date information on OCI contributor and maintainer meeting schedules. You can also find links to meeting agendas and minutes for all prior meetings. ### Mailing List You can subscribe and join the mailing list on [Google Groups](https://groups.google.com/a/opencontainers.org/forum/#!forum/dev). ### IRC OCI discussion happens on #opencontainers on Freenode ([logs][irc-logs]). ### Markdown style To keep consistency throughout the Markdown files in the Open Container spec all files should be formatted one sentence per line. This fixes two things: it makes diffing easier with git and it resolves fights about line wrapping length. For example, this paragraph will span three lines in the Markdown source. ### Git commit #### Sign your work The sign-off is a simple line at the end of the explanation for the patch, which certifies that you wrote it or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify the below (from [developercertificate.org](https://developercertificate.org/)): ```text Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 660 York Street, Suite 102, San Francisco, CA 94110 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` then you just add a line to every git commit message: ```text Signed-off-by: Joe Smith ``` using your real name (sorry, no pseudonyms or anonymous contributions.) You can add the sign off when creating the git commit via `git commit -s`. ### Commit Style Simple house-keeping for clean git history. Read more on [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/) or the Discussion section of [`git-commit(1)`](https://git-scm.com/docs/git-commit). 1. Separate the subject from body with a blank line 2. Limit the subject line to 50 characters 3. Capitalize the subject line 4. Do not end the subject line with a period 5. Use the imperative mood in the subject line 6. Wrap the body at 72 characters 7. Use the body to explain what and why vs. how - If there was important/useful/essential conversation or information, copy or include a reference 8. When possible, one keyword to scope the change in the subject (i.e. "README: ...", "runtime: ...") [code-of-conduct]: https://github.com/opencontainers/org/blob/master/CODE_OF_CONDUCT.md [irc-logs]: http://ircbot.wl.linuxfoundation.org/eavesdrop/%23opencontainers/ crun-1.16.1/libocispec/image-spec/RELEASES.md0000644000000000000000000001407214614670026016622 0ustar0000000000000000# Releases The release process hopes to encourage early, consistent consensus-building during project development. The mechanisms used are regular community communication on the mailing list about progress, scheduled meetings for issue resolution and release triage, and regularly paced and communicated releases. Releases are proposed and adopted or rejected using the usual [project governance](GOVERNANCE.md) rules and procedures. An anti-pattern that we want to avoid is heavy development or discussions "late cycle" around major releases. We want to build a community that is involved and communicates consistently through all releases instead of relying on "silent periods" as a judge of stability. ## Parallel releases A single project MAY consider several motions to release in parallel. However each motion to release after the initial 0.1.0 MUST be based on a previous release that has already landed. For example, runtime-spec maintainers may propose a v1.0.0-rc2 on the 1st of the month and a v0.9.1 bugfix on the 2nd of the month. They may not propose a v1.0.0-rc3 until the v1.0.0-rc2 is accepted (on the 7th if the vote initiated on the 1st passes). ## Specifications The OCI maintains three categories of projects: specifications, applications, and conformance-testing tools. However, specification releases have special restrictions in the [OCI charter][charter]: - They are the target of backwards compatibility (§7.g), and - They are subject to the OFWa patent grant (§8.d and e). To avoid unfortunate side effects (onerous backwards compatibility requirements or Member resignations), the following additional procedures apply to specification releases: ### Planning a release Every OCI specification project SHOULD hold meetings that involve maintainers reviewing pull requests, debating outstanding issues, and planning releases. This meeting MUST be advertised on the project README and MAY happen on a phone call, video conference, or on IRC. Maintainers MUST send updates to the with results of these meetings. Before the specification reaches v1.0.0, the meetings SHOULD be weekly. Once a specification has reached v1.0.0, the maintainers may alter the cadence, but a meeting MUST be held within four weeks of the previous meeting. The release plans, corresponding milestones and estimated due dates MUST be published on GitHub (e.g. ). GitHub milestones and issues are only used for community organization and all releases MUST follow the [project governance](GOVERNANCE.md) rules and procedures. ### Timelines Specifications have a variety of different timelines in their lifecycle. - Pre-v1.0.0 specifications SHOULD release on a monthly cadence to garner feedback. - Major specification releases MUST release at least three release candidates spaced a minimum of one week apart. This means a major release like a v1.0.0 or v2.0.0 release will take 1 month at minimum: one week for rc1, one week for rc2, one week for rc3, and one week for the major release itself. Maintainers SHOULD strive to make zero breaking changes during this cycle of release candidates and SHOULD restart the three-candidate count when a breaking change is introduced. For example if a breaking change is introduced in v1.0.0-rc2 then the series would end with v1.0.0-rc4 and v1.0.0. - Minor and patch releases SHOULD be made on an as-needed basis. ## Checklist Releases usually follow a few steps: - [ ] prepare a pull-request for the release - [ ] a commit updating `./ChangeLog` - [ ] `git log --oneline --no-merges --decorate --name-status v1.0.1..HEAD | vim -` - [ ] `:% s/(pr\/\(\d*\))\(.*\)/\2 (#\1)/` to move the PR to the end of line and match previous formatting - [ ] review `(^M|^A|^D)` for impact of the commit - [ ] group commits to `Additions:`, `Minor fixes and documentation:`, `Breaking changes:` - [ ] delete the `(^M|^A|^D)` lines, `:%!grep -vE '(^M|^A|^D)'` - [ ] merge multi-commit PRs (so each line has a `(#num)` suffix) - [ ] drop hash and indent, `:'<,'> s/^\w* /^I* /` - [ ] a commit bumping `./specs-go/version.go` to next version and empty the `VersionDev` variable - [ ] a commit adding back the "+dev" to `VersionDev` - [ ] send email to - [ ] copy the exact commit hash for bumping the version from the pull-request (since master always stays as "-dev") - [ ] count the PRs since last release (that this version is tracking, in the cases of multiple branching), like `git log --pretty=oneline --no-merges --decorate $priorTag..$versionBumpCommit | grep \(pr\/ | wc -l` - [ ] get the date for a week from now, like `TZ=UTC date --date='next week'` - [ ] OPTIONAL find a cute animal gif to attach to the email, and subsequently the release description - [ ] subject line like `[image-spec VOTE] tag $versionBumpCommit as $version (closes $dateWeekFromNowUTC)` - [ ] email body like ```text Hey everyone, There have been $numPRs PRs merged since $priorTag release (https://github.com/opencontainers/image-spec/compare/$priorTag...$versionBumpCommit). $linkToPullRequest Please respond LGTM or REJECT (with reasoning). $sig ``` - [ ] edit/update the pull-request to link to the VOTE thread, from - [ ] a week later, if the vote passes, merge the PR - [ ] `git tag -s $version $versionBumpCommit` - [ ] `git push --tags` - [ ] produce release documents - [ ] git checkout the release tag, like `git checkout $version` - [ ] `make docs` - [ ] rename the output PDF and HTML file to include version, like `mv output/oci-image-spec.pdf output/oci-image-spec-$version.pdf`` - [ ] attach these docs to the release on - [ ] link to the the VOTE thread and include the passing vote count - [ ] link to the pull request that merged the release - [ ] add release notes to the website [charter]: https://github.com/opencontainers/tob/blob/main/CHARTER.md crun-1.16.1/libocispec/image-spec/annotations.md0000644000000000000000000001361714614670026017760 0ustar0000000000000000# Annotations Several components of the specification, like [Image Manifests](manifest.md) and [Descriptors](descriptor.md), feature an optional annotations property, whose format is common and defined in this section. This property contains arbitrary metadata. ## Rules - Annotations MUST be a key-value map where both the key and value MUST be strings. - While the value MUST be present, it MAY be an empty string. - Keys MUST be unique within this map, and best practice is to namespace the keys. - Keys SHOULD be named using a reverse domain notation - e.g. `com.example.myKey`. - The prefix `org.opencontainers` is reserved for keys defined in Open Container Initiative (OCI) specifications and MUST NOT be used by other specifications and extensions. - Keys using the `org.opencontainers.image` namespace are reserved for use in the OCI Image Specification and MUST NOT be used by other specifications and extensions, including other OCI specifications. - If there are no annotations then this property MUST either be absent or be an empty map. - Consumers MUST NOT generate an error if they encounter an unknown annotation key. ## Pre-Defined Annotation Keys This specification defines the following annotation keys, intended for but not limited to [image index](image-index.md), image [manifest](manifest.md), and [descriptor](descriptor.md) authors. - **org.opencontainers.image.created** date and time on which the image was built, conforming to [RFC 3339][rfc3339]. - **org.opencontainers.image.authors** contact details of the people or organization responsible for the image (freeform string) - **org.opencontainers.image.url** URL to find more information on the image (string) - **org.opencontainers.image.documentation** URL to get documentation on the image (string) - **org.opencontainers.image.source** URL to get source code for building the image (string) - **org.opencontainers.image.version** version of the packaged software - The version MAY match a label or tag in the source code repository - version MAY be [Semantic versioning-compatible](https://semver.org/) - **org.opencontainers.image.revision** Source control revision identifier for the packaged software. - **org.opencontainers.image.vendor** Name of the distributing entity, organization or individual. - **org.opencontainers.image.licenses** License(s) under which contained software is distributed as an [SPDX License Expression][spdx-license-expression]. - **org.opencontainers.image.ref.name** Name of the reference for a target (string). - SHOULD only be considered valid when on descriptors on `index.json` within [image layout](image-layout.md). - Character set of the value SHOULD conform to alphanum of `A-Za-z0-9` and separator set of `-._:@/+` - The reference must match the following [grammar](considerations.md#ebnf): ```ebnf ref ::= component ("/" component)* component ::= alphanum (separator alphanum)* alphanum ::= [A-Za-z0-9]+ separator ::= [-._:@+] | "--" ``` - **org.opencontainers.image.title** Human-readable title of the image (string) - **org.opencontainers.image.description** Human-readable description of the software packaged in the image (string) - **org.opencontainers.image.base.digest** [Digest](descriptor.md#digests) of the image this image is based on (string) - This SHOULD be the immediate image sharing zero-indexed layers with the image, such as from a Dockerfile `FROM` statement. - This SHOULD NOT reference any other images used to generate the contents of the image (e.g., multi-stage Dockerfile builds). - **org.opencontainers.image.base.name** Image reference of the image this image is based on (string) - This SHOULD be image references in the format defined by [distribution/distribution][distribution-reference]. - This SHOULD be a fully qualified reference name, without any assumed default registry. (e.g., `registry.example.com/my-org/my-image:tag` instead of `my-org/my-image:tag`). - This SHOULD be the immediate image sharing zero-indexed layers with the image, such as from a Dockerfile `FROM` statement. - This SHOULD NOT reference any other images used to generate the contents of the image (e.g., multi-stage Dockerfile builds). - If the `image.base.name` annotation is specified, the `image.base.digest` annotation SHOULD be the digest of the manifest referenced by the `image.ref.name` annotation. ## Back-compatibility with Label Schema [Label Schema][label-schema] defined a number of conventional labels for container images, and these are now superceded by annotations with keys starting **org.opencontainers.image**. While users are encouraged to use the **org.opencontainers.image** keys, tools MAY choose to support compatible annotations using the **org.label-schema** prefix as follows. | `org.opencontainers.image` prefix | `org.label-schema` prefix | Compatibility notes | |---------------------------|-------------------------|---------------------| | `created` | `build-date` | Compatible | | `url` | `url` | Compatible | | `source` | `vcs-url` | Compatible | | `version` | `version` | Compatible | | `revision` | `vcs-ref` | Compatible | | `vendor` | `vendor` | Compatible | | `title` | `name` | Compatible | | `description` | `description` | Compatible | | `documentation` | `usage` | Value is compatible if the documentation is located by a URL | | `authors` | | No equivalent in Label Schema | | `licenses` | | No equivalent in Label Schema | | `ref.name` | | No equivalent in Label Schema | | | `schema-version`| No equivalent in the OCI Image Spec | | | `docker.*`, `rkt.*` | No equivalent in the OCI Image Spec | [distribution-reference]: https://github.com/distribution/distribution/blob/d0deff9cd6c2b8c82c6f3d1c713af51df099d07b/reference/reference.go [label-schema]: https://github.com/label-schema/label-schema.org/blob/gh-pages/rc1.md [rfc3339]: https://tools.ietf.org/html/rfc3339#section-5.6 [spdx-license-expression]: https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/ crun-1.16.1/libocispec/image-spec/artifacts-guidance.md0000644000000000000000000000113314614670026021146 0ustar0000000000000000# Guidance for Artifacts Authors Content other than OCI container images MAY be packaged using the image manifest. When this is done, the `config.mediaType` value should not be a known OCI image config [media type](media-types.md). Historically, due to registry limitations, some tools have created non-OCI conformant artifacts using the `application/vnd.oci.image.config.v1+json` value for `config.mediaType` and values specific to the artifact in `layer[*].mediaType`. Implementation details and examples are provided in the [image manifest specification](manifest.md#guidelines-for-artifact-usage). crun-1.16.1/libocispec/image-spec/config.md0000644000000000000000000003616514614670026016673 0ustar0000000000000000# OCI Image Configuration An OCI _Image_ is an ordered collection of root filesystem changes and the corresponding execution parameters for use within a container runtime. This specification outlines the JSON format describing images for use with a container runtime and execution tool and its relationship to filesystem changesets, described in [Layers](layer.md). This section defines the `application/vnd.oci.image.config.v1+json` [media type](media-types.md). ## Terminology This specification uses the following terms: ### [Layer](layer.md) - Image filesystems are composed of _layers_. - Each layer represents a set of filesystem changes in a tar-based [layer format](layer.md), recording files to be added, changed, or deleted relative to its parent layer. - Layers do not have configuration metadata such as environment variables or default arguments - these are properties of the image as a whole rather than any particular layer. - Using a layer-based or union filesystem such as AUFS, or by computing the diff from filesystem snapshots, the filesystem changeset can be used to present a series of image layers as if they were one cohesive filesystem. ### Image JSON - Each image has an associated JSON structure which describes some basic information about the image such as date created, author, as well as execution/runtime configuration like its entrypoint, default arguments, networking, and volumes. - The JSON structure also references a cryptographic hash of each layer used by the image, and provides history information for those layers. - This JSON is considered to be immutable, because changing it would change the computed [ImageID](#imageid). - Changing it means creating a new derived image, instead of changing the existing image. ### Layer DiffID A layer DiffID is the digest over the layer's uncompressed tar archive and serialized in the descriptor digest format, e.g., `sha256:a9561eb1b190625c9adb5a9513e72c4dedafc1cb2d4c5236c9a6957ec7dfd5a9`. Layers SHOULD be packed and unpacked reproducibly to avoid changing the layer DiffID, for example by using [tar-split][] to save the tar headers. NOTE: Do not confuse DiffIDs with [layer digests](manifest.md#image-manifest-property-descriptions), often referenced in the manifest, which are digests over compressed or uncompressed content. ### Layer ChainID For convenience, it is sometimes useful to refer to a stack of layers with a single identifier. While a layer's `DiffID` identifies a single changeset, the `ChainID` identifies the subsequent application of those changesets. This ensures that we have handles referring to both the layer itself, as well as the result of the application of a series of changesets. Use in combination with `rootfs.diff_ids` while applying layers to a root filesystem to uniquely and safely identify the result. #### Definition The `ChainID` of an applied set of layers is defined with the following recursion: ```text ChainID(Lâ‚€) = DiffID(Lâ‚€) ChainID(Lâ‚€|...|Lₙ₋â‚|Lâ‚™) = Digest(ChainID(Lâ‚€|...|Lₙ₋â‚) + " " + DiffID(Lâ‚™)) ``` For this, we define the binary `|` operation to be the result of applying the right operand to the left operand. For example, given base layer `A` and a changeset `B`, we refer to the result of applying `B` to `A` as `A|B`. Above, we define the `ChainID` for a single layer (`Lâ‚€`) as equivalent to the `DiffID` for that layer. Otherwise, the `ChainID` for a set of applied layers (`Lâ‚€|...|Lₙ₋â‚|Lâ‚™`) is defined as the recursion `Digest(ChainID(Lâ‚€|...|Lₙ₋â‚) + " " + DiffID(Lâ‚™))`. #### Explanation Let's say we have layers A, B, C, ordered from bottom to top, where A is the base and C is the top. Defining `|` as a binary application operator, the root filesystem may be `A|B|C`. While it is implied that `C` is only useful when applied to `A|B`, the identifier `C` is insufficient to identify this result, as we'd have the equality `C = A|B|C`, which isn't true. The main issue is when we have two definitions of `C`, `C = C` and `C = A|B|C`. If this is true (with some handwaving), `C = x|C` where `x = any application`. This means that if an attacker can define `x`, relying on `C` provides no guarantee that the layers were applied in any order. The `ChainID` addresses this problem by being defined as a compound hash. **We differentiate the changeset `C`, from the order-dependent application `A|B|C` by saying that the resulting rootfs is identified by ChainID(A|B|C), which can be calculated by `ImageConfig.rootfs`.** Let's expand the definition of `ChainID(A|B|C)` to explore its internal structure: ```text ChainID(A) = DiffID(A) ChainID(A|B) = Digest(ChainID(A) + " " + DiffID(B)) ChainID(A|B|C) = Digest(ChainID(A|B) + " " + DiffID(C)) ``` We can replace each definition and reduce to a single equality: ```text ChainID(A|B|C) = Digest(Digest(DiffID(A) + " " + DiffID(B)) + " " + DiffID(C)) ``` Hopefully, the above is illustrative of the _actual_ contents of the `ChainID`. Most importantly, we can easily see that `ChainID(C) != ChainID(A|B|C)`, otherwise, `ChainID(C) = DiffID(C)`, which is the base case, could not be true. ### ImageID Each image's ID is given by the SHA256 hash of its [configuration JSON](#image-json). It is represented as a hexadecimal encoding of 256 bits, e.g., `sha256:a9561eb1b190625c9adb5a9513e72c4dedafc1cb2d4c5236c9a6957ec7dfd5a9`. Since the [configuration JSON](#image-json) that gets hashed references hashes of each layer in the image, this formulation of the ImageID makes images content-addressable. ## Properties Note: Any OPTIONAL field MAY also be set to null, which is equivalent to being absent. - **created** _string_, OPTIONAL An combined date and time at which the image was created, formatted as defined by [RFC 3339, section 5.6][rfc3339-s5.6]. - **author** _string_, OPTIONAL Gives the name and/or email address of the person or entity which created and is responsible for maintaining the image. - **architecture** _string_, REQUIRED The CPU architecture which the binaries in this image are built to run on. Configurations SHOULD use, and implementations SHOULD understand, values listed in the Go Language document for [`GOARCH`][go-environment]. - **os** _string_, REQUIRED The name of the operating system which the image is built to run on. Configurations SHOULD use, and implementations SHOULD understand, values listed in the Go Language document for [`GOOS`][go-environment]. - **os.version** _string_, OPTIONAL This OPTIONAL property specifies the version of the operating system targeted by the referenced blob. Implementations MAY refuse to use manifests where `os.version` is not known to work with the host OS version. Valid values are implementation-defined. e.g. `10.0.14393.1066` on `windows`. - **os.features** _array of strings_, OPTIONAL This OPTIONAL property specifies an array of strings, each specifying a mandatory OS feature. When `os` is `windows`, image indexes SHOULD use, and implementations SHOULD understand the following values: - `win32k`: image requires `win32k.sys` on the host (Note: `win32k.sys` is missing on Nano Server) - **variant** _string_, OPTIONAL The variant of the specified CPU architecture. Configurations SHOULD use, and implementations SHOULD understand, `variant` values listed in the [Platform Variants](image-index.md#platform-variants) table. - **config** _object_, OPTIONAL The execution parameters which SHOULD be used as a base when running a container using the image. This field can be `null`, in which case any execution parameters should be specified at creation of the container. - **User** _string_, OPTIONAL The username or UID which is a platform-specific structure that allows specific control over which user the process run as. This acts as a default value to use when the value is not specified when creating a container. For Linux based systems, all of the following are valid: `user`, `uid`, `user:group`, `uid:gid`, `uid:group`, `user:gid`. If `group`/`gid` is not specified, the default group and supplementary groups of the given `user`/`uid` in `/etc/passwd` and `/etc/group` from the container are applied. If `group`/`gid` is specified, supplementary groups from the container are ignored. - **ExposedPorts** _object_, OPTIONAL A set of ports to expose from a container running this image. Its keys can be in the format of: `port/tcp`, `port/udp`, `port` with the default protocol being `tcp` if not specified. These values act as defaults and are merged with any specified when creating a container. **NOTE:** This JSON structure value is unusual because it is a direct JSON serialization of the Go type `map[string]struct{}` and is represented in JSON as an object mapping its keys to an empty object. - **Env** _array of strings_, OPTIONAL Entries are in the format of `VARNAME=VARVALUE`. These values act as defaults and are merged with any specified when creating a container. - **Entrypoint** _array of strings_, OPTIONAL A list of arguments to use as the command to execute when the container starts. These values act as defaults and may be replaced by an entrypoint specified when creating a container. - **Cmd** _array of strings_, OPTIONAL Default arguments to the entrypoint of the container. These values act as defaults and may be replaced by any specified when creating a container. If an `Entrypoint` value is not specified, then the first entry of the `Cmd` array SHOULD be interpreted as the executable to run. - **Volumes** _object_, OPTIONAL A set of directories describing where the process is likely to write data specific to a container instance. **NOTE:** This JSON structure value is unusual because it is a direct JSON serialization of the Go type `map[string]struct{}` and is represented in JSON as an object mapping its keys to an empty object. - **WorkingDir** _string_, OPTIONAL Sets the current working directory of the entrypoint process in the container. This value acts as a default and may be replaced by a working directory specified when creating a container. - **Labels** _object_, OPTIONAL The field contains arbitrary metadata for the container. This property MUST use the [annotation rules](annotations.md#rules). - **StopSignal** _string_, OPTIONAL The field contains the system call signal that will be sent to the container to exit. The signal can be a signal name in the format `SIGNAME`, for instance `SIGKILL` or `SIGRTMIN+3`. - **ArgsEscaped** _boolean_, OPTIONAL `[Deprecated]` - This field is present only for legacy compatibility with Docker and should not be used by new image builders. It is used by Docker for Windows images to indicate that the `Entrypoint` or `Cmd` or both, contains only a single element array, that is a pre-escaped, and combined into a single string `CommandLine`. If `true` the value in `Entrypoint` or `Cmd` should be used as-is to avoid double escaping. Note, the exact behavior of `ArgsEscaped` is complex and subject to implementation details in Moby project. - **Memory** _integer_, OPTIONAL This property is _reserved_ for use, to [maintain compatibility](media-types.md#compatibility-matrix). - **MemorySwap** _integer_, OPTIONAL This property is _reserved_ for use, to [maintain compatibility](media-types.md#compatibility-matrix). - **CpuShares** _integer_, OPTIONAL This property is _reserved_ for use, to [maintain compatibility](media-types.md#compatibility-matrix). - **Healthcheck** _object_, OPTIONAL This property is _reserved_ for use, to [maintain compatibility](media-types.md#compatibility-matrix). - **rootfs** _object_, REQUIRED The rootfs key references the layer content addresses used by the image. This makes the image config hash depend on the filesystem hash. - **type** _string_, REQUIRED MUST be set to `layers`. Implementations MUST generate an error if they encounter a unknown value while verifying or unpacking an image. - **diff_ids** _array of strings_, REQUIRED An array of layer content hashes (`DiffIDs`), in order from first to last. - **history** _array of objects_, OPTIONAL Describes the history of each layer. The array is ordered from first to last. The object has the following fields: - **created** _string_, OPTIONAL A combined date and time at which the layer was created, formatted as defined by [RFC 3339, section 5.6][rfc3339-s5.6]. - **author** _string_, OPTIONAL The author of the build point. - **created_by** _string_, OPTIONAL The command which created the layer. - **comment** _string_, OPTIONAL A custom message set when creating the layer. - **empty_layer** _boolean_, OPTIONAL This field is used to mark if the history item created a filesystem diff. It is set to true if this history item doesn't correspond to an actual layer in the rootfs section (for example, Dockerfile's [ENV](https://docs.docker.com/engine/reference/builder/#/env) command results in no change to the filesystem). Any extra fields in the Image JSON struct are considered implementation specific and MUST NOT generate an error by any implementations which are unable to interpret them. Whitespace is OPTIONAL and implementations MAY have compact JSON with no whitespace. ## Example Here is an example image configuration JSON document: ```json,title=Image%20JSON&mediatype=application/vnd.oci.image.config.v1%2Bjson { "created": "2015-10-31T22:22:56.015925234Z", "author": "Alyssa P. Hacker ", "architecture": "amd64", "os": "linux", "config": { "User": "alice", "ExposedPorts": { "8080/tcp": {} }, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "FOO=oci_is_a", "BAR=well_written_spec" ], "Entrypoint": [ "/bin/my-app-binary" ], "Cmd": [ "--foreground", "--config", "/etc/my-app.d/default.cfg" ], "Volumes": { "/var/job-result-data": {}, "/var/log/my-app-logs": {} }, "WorkingDir": "/home/alice", "Labels": { "com.example.project.git.url": "https://example.com/project.git", "com.example.project.git.commit": "45a939b2999782a3f005621a8d0f29aa387e1d6b" } }, "rootfs": { "diff_ids": [ "sha256:c6f988f4874bb0add23a778f753c65efe992244e148a1d2ec2a8b664fb66bbd1", "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" ], "type": "layers" }, "history": [ { "created": "2015-10-31T22:22:54.690851953Z", "created_by": "/bin/sh -c #(nop) ADD file:a3bc1e842b69636f9df5256c49c5374fb4eef1e281fe3f282c65fb853ee171c5 in /" }, { "created": "2015-10-31T22:22:55.613815829Z", "created_by": "/bin/sh -c #(nop) CMD [\"sh\"]", "empty_layer": true }, { "created": "2015-10-31T22:22:56.329850019Z", "created_by": "/bin/sh -c apk add curl" } ] } ``` [rfc3339-s5.6]: https://tools.ietf.org/html/rfc3339#section-5.6 [go-environment]: https://golang.org/doc/install/source#environment [tar-split]: https://github.com/vbatts/tar-split crun-1.16.1/libocispec/image-spec/considerations.md0000644000000000000000000001375114614670026020446 0ustar0000000000000000# Considerations ## Extensibility Implementations storing or copying content MUST NOT modify or alter the content in a way that would change the digest of the content. Examples of these implementations include: - A [registry implementing the distribution specification][distribution-spec], including local registries, caching proxies - An application which copies content to disk or between registries Implementations processing content SHOULD NOT generate an error if they encounter an unknown property in a known media type. Examples of these implementations include: - A [runtime implementing the runtime specification][runtime-spec] - An implementation using OCI to retrieve and utilize artifacts, e.g.: a WASM runtime ## Canonicalization - OCI Images are [content-addressable](https://en.wikipedia.org/wiki/Content-addressable_storage). See [descriptors](descriptor.md) for more. - One benefit of content-addressable storage is easy deduplication. - Many images might depend on a particular [layer](layer.md), but there will only be one blob in the [store](image-layout.md). - With a different serialization, that same semantic layer would have a different hash, and if both versions of the layer are referenced there will be two blobs with the same semantic content. - To allow efficient storage, implementations serializing content for blobs SHOULD use a canonical serialization. - This increases the chance that different implementations can push the same semantic content to the store without creating redundant blobs. ### JSON [JSON][JSON] content SHOULD be serialized as [canonical JSON][canonical-json]. Of the [OCI Image Format Specification media types](media-types.md), all the types ending in `+json` contain JSON content. Implementations: - [Go][Go]: [github.com/docker/go][docker-go], which claims to implement [canonical JSON][canonical-json] except for Unicode normalization. ## EBNF For field formats described in this specification, we use a limited subset of [Extended Backus-Naur Form][ebnf], similar to that used by the [XML specification][xmlebnf]. Grammars present in the OCI specification are regular and can be converted to a single regular expressions. However, regular expressions are avoided to limit ambiguity between regular expression syntax. By defining a subset of EBNF used here, the possibility of variation, misunderstanding or ambiguities from linking to a larger specification can be avoided. Grammars are made up of rules in the following form: ```ebnf symbol ::= expression ``` We can say we have the production identified by symbol if the input is matched by the expression. Whitespace is completely ignored in rule definitions. ### Expressions The simplest expression is the literal, surrounded by quotes: ```ebnf literal ::= "matchthis" ``` The above expression defines a symbol, "literal", that matches the exact input of "matchthis". Character classes are delineated by brackets (`[]`), describing either a set, range or multiple range of characters: ```ebnf set := [abc] range := [A-Z] ``` The above symbol "set" would match one character of either "a", "b" or "c". The symbol "range" would match any character, "A" to "Z", inclusive. Currently, only matching for 7-bit ascii literals and character classes is defined, as that is all that is required by this specification. Multiple character ranges and explicit characters can be specified in a single character classes, as follows: ```ebnf multipleranges := [a-zA-Z=-] ``` The above matches the characters in the range `A` to `Z`, `a` to `z` and the individual characters `-` and `=`. Expressions can be made up of one or more expressions, such that one must be followed by the other. This is known as an implicit concatenation operator. For example, to satisfy the following rule, both `A` and `B` must be matched to satisfy the rule: ```ebnf symbol ::= A B ``` Each expression must be matched once and only once, `A` followed by `B`. To support the description of repetition and optional match criteria, the postfix operators `*` and `+` are defined. `*` indicates that the preceding expression can be matched zero or more times. `+` indicates that the preceding expression must be matched one or more times. These appear in the following form: ```ebnf zeroormore ::= expression* oneormore ::= expression+ ``` Parentheses are used to group expressions into a larger expression: ```ebnf group ::= (A B) ``` Like simpler expressions above, operators can be applied to groups, as well. To allow for alternates, we also define the infix operator `|`. ```ebnf oneof ::= A | B ``` The above indicates that the expression should match one of the expressions, `A` or `B`. ### Precedence The operator precedence is in the following order: - Terminals (literals and character classes) - Grouping `()` - Unary operators `+*` - Concatenation - Alternates `|` The precedence can be better described using grouping to show equivalents. Concatenation has higher precedence than alternates, such `A B | C D` is equivalent to `(A B) | (C D)`. Unary operators have higher precedence than alternates and concatenation, such that `A+ | B+` is equivalent to `(A+) | (B+)`. ### Examples The following combines the previous definitions to match a simple, relative path name, describing the individual components: ```ebnf path ::= component ("/" component)* component ::= [a-z]+ ``` The production "component" is one or more lowercase letters. A "path" is then at least one component, possibly followed by zero or more slash-component pairs. The above can be converted into the following regular expression: ```regex [a-z]+(?:/[a-z]+)* ``` [canonical-json]: https://wiki.laptop.org/go/Canonical_JSON [distribution-spec]: https://github.com/opencontainers/distribution-spec/blob/main/spec.md [docker-go]: https://github.com/docker/go/ [ebnf]: https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form [Go]: https://golang.org/ [JSON]: https://json.org/ [runtime-spec]: https://github.com/opencontainers/runtime-spec/blob/main/spec.md [xmlebnf]: https://www.w3.org/TR/REC-xml/#sec-notation crun-1.16.1/libocispec/image-spec/conversion.md0000644000000000000000000002263314614670026017606 0ustar0000000000000000# Conversion to OCI Runtime Configuration When extracting an OCI Image into an [OCI Runtime bundle][oci-runtime-bundle], two orthogonal components of the extraction are relevant: 1. Extraction of the root filesystem from the set of [filesystem layers](layer.md). 2. Conversion of the [image configuration blob](config.md) to an [OCI Runtime configuration blob][oci-runtime-config]. This section defines how to convert an `application/vnd.oci.image.config.v1+json` blob to an [OCI runtime configuration blob][oci-runtime-config] (the latter component of extraction). The former component of extraction is defined [elsewhere](layer.md) and is orthogonal to configuration of a runtime bundle. The values of runtime configuration properties not specified by this document are implementation-defined. A converter MUST rely on the OCI image configuration to build the OCI runtime configuration as described by this document; this will create the "default generated runtime configuration". The "default generated runtime configuration" MAY be overridden or combined with externally provided inputs from the caller. In addition, a converter MAY have its own implementation-defined defaults and extensions which MAY be combined with the "default generated runtime configuration". The restrictions in this document refer only to combining implementation-defined defaults with the "default generated runtime configuration". Externally provided inputs are considered to be a modification of the `application/vnd.oci.image.config.v1+json` used as a source, and such modifications have no restrictions. For example, externally provided inputs MAY cause an environment variable to be added, removed or changed. However an implementation-defined default SHOULD NOT result in an environment variable being removed or changed. [oci-runtime-bundle]: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/bundle.md [oci-runtime-config]: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md ## Verbatim Fields Certain image configuration fields have an identical counterpart in the runtime configuration. Some of these are purely annotation-based fields, and have been extracted into a [separate subsection](#annotation-fields). A compliant configuration converter MUST extract the following fields verbatim to the corresponding field in the generated runtime configuration: | Image Field | Runtime Field | Notes | | ------------------- | --------------- | ----- | | `Config.WorkingDir` | `process.cwd` | | | `Config.Env` | `process.env` | 1 | | `Config.Entrypoint` | `process.args` | 2 | | `Config.Cmd` | `process.args` | 2 | 1. The converter MAY add additional entries to `process.env` but it SHOULD NOT add entries that have variable names present in `Config.Env`. 2. If both `Config.Entrypoint` and `Config.Cmd` are specified, the converter MUST append the value of `Config.Cmd` to the value of `Config.Entrypoint` and set `process.args` to that combined value. ### Annotation Fields These fields all affect the `annotations` of the runtime configuration, and are thus subject to [precedence](#annotations). | Image Field | Runtime Field | Notes | | ------------------- | --------------- | ----- | | `os` | `annotations` | 1,2 | | `architecture` | `annotations` | 1,3 | | `variant` | `annotations` | 1,4 | | `os.version` | `annotations` | 1,5 | | `os.features` | `annotations` | 1,6 | | `author` | `annotations` | 1,7 | | `created` | `annotations` | 1,8 | | `Config.Labels` | `annotations` | | | `Config.StopSignal` | `annotations` | 1,9 | 1. If a user has explicitly specified this annotation with `Config.Labels`, then the value specified in this field takes lower [precedence](#annotations) and the converter MUST instead use the value from `Config.Labels`. 2. The value of this field MUST be set as the value of `org.opencontainers.image.os` in `annotations`. 3. The value of this field MUST be set as the value of `org.opencontainers.image.architecture` in `annotations`. 4. The value of this field MUST be set as the value of `org.opencontainers.image.variant` in `annotations`. 5. The value of this field MUST be set as the value of `org.opencontainers.image.os.version` in `annotations`. 6. The value of this field MUST be set as the value of `org.opencontainers.image.os.features` in `annotations`. 7. The value of this field MUST be set as the value of `org.opencontainers.image.author` in `annotations`. 8. The value of this field MUST be set as the value of `org.opencontainers.image.created` in `annotations`. 9. The value of this field MUST be set as the value of `org.opencontainers.image.stopSignal` in `annotations`. ## Parsed Fields Certain image configuration fields have a counterpart that must first be translated. A compliant configuration converter SHOULD parse all of these fields and set the corresponding fields in the generated runtime configuration: | Image Field | Runtime Field | | ------------------- | --------------- | | `Config.User` | `process.user.*` | The method of parsing the above image fields are described in the following sections. ### `Config.User` If the values of [`user` or `group`](config.md#properties) in `Config.User` are numeric (`uid` or `gid`) then the values MUST be copied verbatim to `process.user.uid` and `process.user.gid` respectively. If the values of [`user` or `group`](config.md#properties) in `Config.User` are not numeric (`user` or `group`) then a converter SHOULD resolve the user information using a method appropriate for the container's context. For Unix-like systems, this MAY involve resolution through NSS or parsing `/etc/passwd` from the extracted container's root filesystem to determine the values of `process.user.uid` and `process.user.gid`. In addition, a converter SHOULD set the value of `process.user.additionalGids` to a value corresponding to the user in the container's context described by `Config.User`. For Unix-like systems, this MAY involve resolution through NSS or parsing `/etc/group` and determining the group memberships of the user specified in `process.user.uid`. The converter SHOULD NOT modify `process.user.additionalGids` if the value of [`user`](config.md#properties) in `Config.User` is numeric or if `Config.User` specifies a group. If `Config.User` is not defined, the converted `process.user` value is implementation-defined. If `Config.User` does not correspond to a user in the container's context, the converter MUST return an error. ## Optional Fields Certain image configuration fields are not applicable to all conversion use cases, and thus are optional for configuration converters to implement. A compliant configuration converter SHOULD provide a way for users to extract these fields into the generated runtime configuration: | Image Field | Runtime Field | Notes | | --------------------- | ------------------ | ----- | | `Config.ExposedPorts` | `annotations` | 1 | | `Config.Volumes` | `mounts` | 2 | 1. The runtime configuration does not have a corresponding field for this image field. However, converters SHOULD set the [`org.opencontainers.image.exposedPorts` annotation](#configexposedports). 2. Implementations SHOULD provide mounts for these locations such that application data is not written to the container's root filesystem. If a converter implements conversion for this field using mountpoints, it SHOULD set the `destination` of the mountpoint to the value specified in `Config.Volumes`. An implementation MAY seed the contents of the mount with data in the image at the same location. If a _new_ image is created from a container based on the image described by this configuration, data in these paths SHOULD NOT be included in the _new_ image. The other `mounts` fields are platform and context dependent, and thus are implementation-defined. Note that the implementation of `Config.Volumes` need not use mountpoints, as it is effectively a mask of the filesystem. ### `Config.ExposedPorts` The OCI runtime configuration does not provide a way of expressing the concept of "container exposed ports". However, converters SHOULD set the **org.opencontainers.image.exposedPorts** annotation, unless doing so will [cause a conflict](#annotations). **org.opencontainers.image.exposedPorts** is the list of values that correspond to the [keys defined for `Config.ExposedPorts`](config.md) (string, comma-separated values). ## Annotations There are three ways of annotating an OCI image in this specification: 1. `Config.Labels` in the [configuration](config.md) of the image. 2. `annotations` in the [manifest](manifest.md) of the image. 3. `annotations` in the [image index](image-index.md) of the image. In addition, there are also implicit annotations that are defined by this section which are determined from the values of the image configuration. A converter SHOULD NOT attempt to extract annotations from [manifests](manifest.md) or [image indices](image-index.md). If there is a conflict (same key but different value) between an implicit annotation (or annotation in [manifests](manifest.md) or [image indices](image-index.md)) and an explicitly specified annotation in `Config.Labels`, the value specified in `Config.Labels` MUST take precedence. A converter MAY add annotations which have keys not specified in the image. A converter MUST NOT modify the values of annotations specified in the image. crun-1.16.1/libocispec/image-spec/descriptor.md0000644000000000000000000002721214614670026017575 0ustar0000000000000000# OCI Content Descriptors - An OCI image consists of several different components, arranged in a [Merkle Directed Acyclic Graph (DAG)](https://en.wikipedia.org/wiki/Merkle_tree). - References between components in the graph are expressed through _Content Descriptors_. - A Content Descriptor (or simply _Descriptor_) describes the disposition of the targeted content. - A Content Descriptor includes the type of the content, a content identifier (_digest_), and the byte-size of the raw content. Optionally, it includes the type of artifact it is describing. - Descriptors SHOULD be embedded in other formats to securely reference external content. - Other formats SHOULD use descriptors to securely reference external content. This section defines the `application/vnd.oci.descriptor.v1+json` [media type](media-types.md). ## Properties A descriptor consists of a set of properties encapsulated in key-value fields. The following fields contain the primary properties that constitute a Descriptor: - **`mediaType`** *string* This REQUIRED property contains the media type of the referenced content. Values MUST comply with [RFC 6838][rfc6838], including the [naming requirements in its section 4.2][rfc6838-s4.2]. The OCI image specification defines [several of its own MIME types](media-types.md) for resources defined in the specification. - **`digest`** *string* This REQUIRED property is the _digest_ of the targeted content, conforming to the requirements outlined in [Digests](#digests). Retrieved content SHOULD be verified against this digest when consumed via untrusted sources. - **`size`** *int64* This REQUIRED property specifies the size, in bytes, of the raw content. This property exists so that a client will have an expected size for the content before processing. If the length of the retrieved content does not match the specified length, the content SHOULD NOT be trusted. - **`urls`** *array of strings* This OPTIONAL property specifies a list of URIs from which this object MAY be downloaded. Each entry MUST conform to [RFC 3986][rfc3986]. Entries SHOULD use the `http` and `https` schemes, as defined in [RFC 7230][rfc7230-s2.7]. - **`annotations`** *string-string map* This OPTIONAL property contains arbitrary metadata for this descriptor. This OPTIONAL property MUST use the [annotation rules](annotations.md#rules). - **`data`** *string* This OPTIONAL property contains an embedded representation of the referenced content. Values MUST conform to the Base 64 encoding, as defined in [RFC 4648][rfc4648-s4]. The decoded data MUST be identical to the referenced content and SHOULD be verified against the [`digest`](#digests) and `size` fields by content consumers. See [Embedded Content](#embedded-content) for when this is appropriate. - **`artifactType`** *string* This OPTIONAL property contains the type of an artifact when the descriptor points to an artifact. This is the value of the config descriptor `mediaType` when the descriptor references an [image manifest](manifest.md). If defined, the value MUST comply with [RFC 6838][rfc6838], including the [naming requirements in its section 4.2][rfc6838-s4.2], and MAY be registered with [IANA][iana]. Descriptors pointing to [`application/vnd.oci.image.manifest.v1+json`](manifest.md) SHOULD include the extended field `platform`, see [Image Index Property Descriptions](image-index.md#image-index-property-descriptions) for details. ### Reserved Extended _Descriptor_ field additions proposed in other OCI specifications SHOULD first be considered for addition into this specification. ## Digests The _digest_ property of a Descriptor acts as a content identifier, enabling [content addressability](https://en.wikipedia.org/wiki/Content-addressable_storage). It uniquely identifies content by taking a [collision-resistant hash](https://en.wikipedia.org/wiki/Cryptographic_hash_function) of the bytes. If the _digest_ can be communicated in a secure manner, one can verify content from an insecure source by recalculating the digest independently, ensuring the content has not been modified. The value of the `digest` property is a string consisting of an _algorithm_ portion and an _encoded_ portion. The _algorithm_ specifies the cryptographic hash function and encoding used for the digest; the _encoded_ portion contains the encoded result of the hash function. A digest string MUST match the following [grammar](considerations.md#ebnf): ```ebnf digest ::= algorithm ":" encoded algorithm ::= algorithm-component (algorithm-separator algorithm-component)* algorithm-component ::= [a-z0-9]+ algorithm-separator ::= [+._-] encoded ::= [a-zA-Z0-9=_-]+ ``` Note that _algorithm_ MAY impose algorithm-specific restriction on the grammar of the _encoded_ portion. See also [Registered Algorithms](#registered-algorithms). Some example digest strings include the following: | digest | algorithm | Registered | |---------------------------------------------------------------------------|-----------------------------|------------| | `sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b` | [SHA-256](#sha-256) | Yes | | `sha512:401b09eab3c013d4ca54922bb802bec8fd5318192b0a75f201d8b372742...` | [SHA-512](#sha-512) | Yes | | `multihash+base58:QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8` | Multihash | No | | `sha256+b64u:LCa0a2j_xo_5m0U8HTBBNBNCLXBkg7-g-YpeiGJm564` | SHA-256 with urlsafe base64 | No | Please see [Registered Algorithms](#registered-algorithms) for a list of registered algorithms. Implementations SHOULD allow digests with unrecognized algorithms to pass validation if they comply with the above grammar. While `sha256` will only use hex encoded digests, separators in _algorithm_ and alphanumerics in _encoded_ are included to allow for extensions. As an example, we can parameterize the encoding and algorithm as `multihash+base58:QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8`, which would be considered valid but unregistered by this specification. ### Verification Before consuming content targeted by a descriptor from untrusted sources, the byte content SHOULD be verified against the digest string. Before calculating the digest, the size of the content SHOULD be verified to reduce hash collision space. Heavy processing before calculating a hash SHOULD be avoided. Implementations MAY employ [canonicalization](considerations.md#canonicalization) of the underlying content to ensure stable content identifiers. ### Digest calculations A _digest_ is calculated by the following pseudo-code, where `H` is the selected hash algorithm, identified by string ``: ```text let ID(C) = Descriptor.digest let C = let D = ':' + Encode(H(C)) let verified = ID(C) == D ``` Above, we define the content identifier as `ID(C)`, extracted from the `Descriptor.digest` field. Content `C` is a string of bytes. Function `H` returns the hash of `C` in bytes and is passed to function `Encode` and prefixed with the algorithm to obtain the digest. The result `verified` is true if `ID(C)` is equal to `D`, confirming that `C` is the content identified by `D`. After verification, the following is true: ```text D == ID(C) == ':' + Encode(H(C)) ``` The _digest_ is confirmed as the content identifier by independently calculating the _digest_. ### Registered algorithms While the _algorithm_ component of the digest string allows the use of a variety of cryptographic algorithms, compliant implementations SHOULD use [SHA-256](#sha-256). The following algorithm identifiers are currently defined by this specification: | algorithm identifier | algorithm | |----------------------|---------------------| | `sha256` | [SHA-256](#sha-256) | | `sha512` | [SHA-512](#sha-512) | If a useful algorithm is not included in the above table, it SHOULD be submitted to this specification for registration. #### SHA-256 [SHA-256][rfc4634-s4.1] is a collision-resistant hash function, chosen for ubiquity, reasonable size and secure characteristics. Implementations MUST implement SHA-256 digest verification for use in descriptors. When the _algorithm identifier_ is `sha256`, the _encoded_ portion MUST match `/[a-f0-9]{64}/`. Note that `[A-F]` MUST NOT be used here. #### SHA-512 [SHA-512][rfc4634-s4.2] is a collision-resistant hash function which [may be more performant][sha256-vs-sha512] than [SHA-256](#sha-256) on some CPUs. Implementations MAY implement SHA-512 digest verification for use in descriptors. When the _algorithm identifier_ is `sha512`, the _encoded_ portion MUST match `/[a-f0-9]{128}/`. Note that `[A-F]` MUST NOT be used here. ## Embedded Content In many contexts, such as when downloading content over a network, resolving a descriptor to its content has a measurable fixed "roundtrip" latency cost. For large blobs, the fixed cost is usually inconsequential, as the majority of time will be spent actually fetching the content. For very small blobs, the fixed cost can be quite significant. Implementations MAY choose to embed small pieces of content directly within a descriptor to avoid roundtrips. Implementations MUST NOT populate the `data` field in situations where doing so would modify existing content identifiers. For example, a registry MUST NOT arbitrarily populate `data` fields within uploaded manifests, as that would modify the content identifier of those manifests. In contrast, a client MAY populate the `data` field before uploading a manifest, because the manifest would not yet have a content identifier in the registry. Implementations SHOULD consider portability when deciding whether to embed data, as some providers are known to refuse to accept or parse manifests that exceed a certain size. ## Examples The following example describes a [_Manifest_](manifest.md#image-manifest) with a content identifier of "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" and a size of 7682 bytes: ```json,title=Content%20Descriptor&mediatype=application/vnd.oci.descriptor.v1%2Bjson { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } ``` In the following example, the descriptor indicates that the referenced manifest is retrievable from a particular URL: ```json,title=Content%20Descriptor&mediatype=application/vnd.oci.descriptor.v1%2Bjson { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "urls": [ "https://example.com/example-manifest" ] } ``` In the following example, the descriptor indicates the type of artifact it is referencing: ```json,title=Content%20Descriptor&mediatype=application/vnd.oci.descriptor.v1%2Bjson { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 123, "digest": "sha256:87923725d74f4bfb94c9e86d64170f7521aad8221a5de834851470ca142da630", "artifactType": "application/vnd.example.sbom.v1" } ``` [rfc3986]: https://tools.ietf.org/html/rfc3986 [rfc4634-s4.1]: https://tools.ietf.org/html/rfc4634#section-4.1 [rfc4634-s4.2]: https://tools.ietf.org/html/rfc4634#section-4.2 [rfc4648-s4]: https://tools.ietf.org/html/rfc4648#section-4 [rfc6838]: https://tools.ietf.org/html/rfc6838 [rfc6838-s4.2]: https://tools.ietf.org/html/rfc6838#section-4.2 [rfc7230-s2.7]: https://tools.ietf.org/html/rfc7230#section-2.7 [sha256-vs-sha512]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/hsMw7cAwrZE [iana]: https://www.iana.org/assignments/media-types/media-types.xhtml crun-1.16.1/libocispec/image-spec/go.mod0000644000000000000000000000100314614670026016171 0ustar0000000000000000module github.com/opencontainers/image-spec go 1.18 require ( github.com/opencontainers/go-digest v1.0.0 github.com/russross/blackfriday v1.6.0 github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 github.com/xeipuuv/gojsonschema v1.2.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/stretchr/testify v1.7.0 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) crun-1.16.1/libocispec/image-spec/go.sum0000644000000000000000000000430214614670026016223 0ustar0000000000000000github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= crun-1.16.1/libocispec/image-spec/image-index.md0000644000000000000000000001745614614670026017617 0ustar0000000000000000# OCI Image Index Specification The image index is a higher-level manifest which points to specific [image manifests](manifest.md), ideal for one or more platforms. While the use of an image index is OPTIONAL for image providers, image consumers SHOULD be prepared to process them. This section defines the `application/vnd.oci.image.index.v1+json` [media type](media-types.md). For the media type(s) that this document is compatible with, see the [matrix][matrix]. ## _Image Index_ Property Descriptions - **`schemaVersion`** *int* This REQUIRED property specifies the image manifest schema version. For this version of the specification, this MUST be `2` to ensure backward compatibility with older versions of Docker. The value of this field will not change. This field MAY be removed in a future version of the specification. - **`mediaType`** *string* This property SHOULD be used and [remain compatible][matrix] with earlier versions of this specification and with other similar external formats. When used, this field MUST contain the media type `application/vnd.oci.image.index.v1+json`. This field usage differs from the [descriptor](descriptor.md#properties) use of `mediaType`. - **`artifactType`** *string* This OPTIONAL property contains the type of an artifact when the manifest is used for an artifact. If defined, the value MUST comply with [RFC 6838][rfc6838], including the [naming requirements in its section 4.2][rfc6838-s4.2], and MAY be registered with [IANA][iana]. - **`manifests`** *array of objects* This REQUIRED property contains a list of [manifests](manifest.md) for specific platforms. While this property MUST be present, the size of the array MAY be zero. Each object in `manifests` includes a set of [descriptor properties](descriptor.md#properties) with the following additional properties and restrictions: - **`mediaType`** *string* This [descriptor property](descriptor.md#properties) has additional restrictions for `manifests`. Implementations MUST support at least the following media types: - [`application/vnd.oci.image.manifest.v1+json`](manifest.md) Also, implementations SHOULD support the following media types: - `application/vnd.oci.image.index.v1+json` (nested index) Image indexes concerned with portability SHOULD use one of the above media types. Future versions of the spec MAY use a different mediatype (i.e. a new versioned format). An encountered `mediaType` that is unknown to the implementation MUST NOT generate an error. - **`platform`** *object* This OPTIONAL property describes the minimum runtime requirements of the image. This property SHOULD be present if its target is platform-specific. - **`architecture`** *string* This REQUIRED property specifies the CPU architecture. Image indexes SHOULD use, and implementations SHOULD understand, values listed in the Go Language document for [`GOARCH`][go-environment2]. - **`os`** *string* This REQUIRED property specifies the operating system. Image indexes SHOULD use, and implementations SHOULD understand, values listed in the Go Language document for [`GOOS`][go-environment2]. - **`os.version`** *string* This OPTIONAL property specifies the version of the operating system targeted by the referenced blob. Implementations MAY refuse to use manifests where `os.version` is not known to work with the host OS version. Valid values are implementation-defined. e.g. `10.0.14393.1066` on `windows`. - **`os.features`** *array of strings* This OPTIONAL property specifies an array of strings, each specifying a mandatory OS feature. When `os` is `windows`, image indexes SHOULD use, and implementations SHOULD understand the following values: - `win32k`: image requires `win32k.sys` on the host (Note: `win32k.sys` is missing on Nano Server) When `os` is not `windows`, values are implementation-defined and SHOULD be submitted to this specification for standardization. - **`variant`** *string* This OPTIONAL property specifies the variant of the CPU. Image indexes SHOULD use, and implementations SHOULD understand, `variant` values listed in the [Platform Variants](#platform-variants) table. - **`features`** *array of strings* This property is RESERVED for future versions of the specification. If multiple manifests match a client or runtime's requirements, the first matching entry SHOULD be used. - **`subject`** *[descriptor](descriptor.md)* This OPTIONAL property specifies a [descriptor](descriptor.md) of another manifest. This value defines a weak association to a separate [Merkle Directed Acyclic Graph (DAG)][dag] structure, and is used by the [`referrers` API][referrers-api] to include this manifest in the list of responses for the subject digest. - **`annotations`** *string-string map* This OPTIONAL property contains arbitrary metadata for the image index. This OPTIONAL property MUST use the [annotation rules](annotations.md#rules). See [Pre-Defined Annotation Keys](annotations.md#pre-defined-annotation-keys). ## Platform Variants When the variant of the CPU is not listed in the table, values are implementation-defined and SHOULD be submitted to this specification for standardization. | ISA/ABI | `architecture` | `variant` | |-----------------|----------------|-------------| | ARM 32-bit, v6 | `arm` | `v6` | | ARM 32-bit, v7 | `arm` | `v7` | | ARM 32-bit, v8 | `arm` | `v8` | | ARM 64-bit, v8 | `arm64` | `v8` | ## Example Image Index *Example showing a simple image index pointing to image manifests for two platforms:* ```json,title=Image%20Index&mediatype=application/vnd.oci.image.index.v1%2Bjson { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7143, "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", "platform": { "architecture": "ppc64le", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "platform": { "architecture": "amd64", "os": "linux" } } ], "annotations": { "com.example.key1": "value1", "com.example.key2": "value2" } } ``` ## Example Image Index with multiple media types *Example showing an image index pointing to manifests with multiple media types:* ```json,title=Image%20Index&mediatype=application/vnd.oci.image.index.v1%2Bjson { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7143, "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", "platform": { "architecture": "ppc64le", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.index.v1+json", "size": 7682, "digest": "sha256:601570aaff1b68a61eb9c85b8beca1644e698003e0cdb5bce960f193d265a8b7" } ], "annotations": { "com.example.key1": "value1", "com.example.key2": "value2" } } ``` [dag]: https://en.wikipedia.org/wiki/Merkle_tree [go-environment2]: https://golang.org/doc/install/source#environment [iana]: https://www.iana.org/assignments/media-types/media-types.xhtml [matrix]: media-types.md#compatibility-matrix [referrers-api]: https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers [rfc6838]: https://tools.ietf.org/html/rfc6838 [rfc6838-s4.2]: https://tools.ietf.org/html/rfc6838#section-4.2 crun-1.16.1/libocispec/image-spec/image-layout.md0000644000000000000000000002045314614670026020014 0ustar0000000000000000# OCI Image Layout Specification - The OCI Image Layout is the directory structure for OCI content-addressable blobs and [location-addressable](https://en.wikipedia.org/wiki/Content-addressable_storage#Content-addressed_vs._location-addressed) references (refs). - This layout MAY be used in a variety of different transport mechanisms: archive formats (e.g. tar, zip), shared filesystem environments (e.g. nfs), or networked file fetching (e.g. http, ftp, rsync). Given an image layout and a ref, a tool can create an [OCI Runtime Specification bundle](https://github.com/opencontainers/runtime-spec/blob/v1.0.0/bundle.md) by: - Following the ref to find a [manifest](manifest.md#image-manifest), possibly via an [image index](image-index.md) - [Applying the filesystem layers](layer.md#applying) in the specified order - Converting the [image configuration](config.md) into an [OCI Runtime Specification `config.json`](https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md) ## Content The image layout is as follows: - `blobs` directory - Contains content-addressable blobs - A blob has no schema and SHOULD be considered opaque - Directory MUST exist and MAY be empty - See [blobs](#blobs) section - `oci-layout` file - It MUST exist - It MUST be a JSON object - It MUST contain an `imageLayoutVersion` field - See [oci-layout file](#oci-layout-file) section - It MAY include additional fields - `index.json` file - It MUST exist - It MUST be an [image index](image-index.md) JSON object. - See [index.json](#indexjson-file) section ## Example Layout This is an example image layout: ```shell $ cd example.com/app/ $ find . -type f ./index.json ./oci-layout ./blobs/sha256/3588d02542238316759cbf24502f4344ffcc8a60c803870022f335d1390c13b4 ./blobs/sha256/4b0bc1c4050b03c95ef2a8e36e25feac42fd31283e8c30b3ee5df6b043155d3c ./blobs/sha256/7968321274dc6b6171697c33df7815310468e694ac5be0ec03ff053bb135e768 ``` Blobs are named by their contents: ```shell $ shasum -a 256 ./blobs/sha256/afff3924849e458c5ef237db5f89539274d5e609db5db935ed3959c90f1f2d51 afff3924849e458c5ef237db5f89539274d5e609db5db935ed3959c90f1f2d51 ./blobs/sha256/afff3924849e458c5ef237db5f89539274d5e609db5db935ed3959c90f1f2d51 ``` ## Blobs - Object names in the `blobs` subdirectories are composed of a directory for each hash algorithm, the children of which will contain the actual content. - The content of `blobs//` MUST match the digest `:` (referenced per [descriptor](descriptor.md#digests)). For example, the content of `blobs/sha256/da39a3ee5e6b4b0d3255bfef95601890afd80709` MUST match the digest `sha256:da39a3ee5e6b4b0d3255bfef95601890afd80709`. - The character set of the entry name for `` and `` MUST match the respective grammar elements described in [descriptor](descriptor.md#digests). - The blobs directory MAY contain blobs which are not referenced by any of the [refs](#indexjson-file). - The blobs directory MAY be missing referenced blobs, in which case the missing blobs SHOULD be fulfilled by an external blob store. ### Example Blobs ```shell $ cat ./blobs/sha256/9b97579de92b1c195b85bb42a11011378ee549b02d7fe9c17bf2a6b35d5cb079 | jq { "schemaVersion": 2, "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7143, "digest": "sha256:afff3924849e458c5ef237db5f89539274d5e609db5db935ed3959c90f1f2d51", "platform": { "architecture": "ppc64le", "os": "linux" } }, ... ``` ```shell $ cat ./blobs/sha256/afff3924849e458c5ef237db5f89539274d5e609db5db935ed3959c90f1f2d51 | jq { "schemaVersion": 2, "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 7023, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 32654, "digest": "sha256:9834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f0" }, ... ``` ```shell $ cat ./blobs/sha256/5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270 | jq { "architecture": "amd64", "author": "Alyssa P. Hacker ", "config": { "Hostname": "8dfe43d80430", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": null, "Image": "sha256:6986ae504bbf843512d680cc959484452034965db15f75ee8bdd1b107f61500b", ... ``` ```shell $ cat ./blobs/sha256/9834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f0 [gzipped tar stream] ``` ## oci-layout file This JSON object serves as a marker for the base of an Open Container Image Layout and to provide the version of the image-layout in use. The `imageLayoutVersion` value will align with the OCI Image Specification version at the time changes to the layout are made, and will pin a given version until changes to the image layout are required. This section defines the `application/vnd.oci.layout.header.v1+json` [media type](media-types.md). ### oci-layout Example ```json,title=OCI%20Layout&mediatype=application/vnd.oci.layout.header.v1%2Bjson { "imageLayoutVersion": "1.0.0" } ``` ## index.json file This REQUIRED file is the entry point for references and descriptors of the image-layout. The [image index](image-index.md) is a multi-descriptor entry point. This index provides an established path (`/index.json`) to have an entry point for an image-layout and to discover auxiliary descriptors. - No semantic restriction is given for the "org.opencontainers.image.ref.name" annotation of descriptors. - In general the `mediaType` of each [descriptor][descriptors] object in the `manifests` field will be either `application/vnd.oci.image.index.v1+json` or `application/vnd.oci.image.manifest.v1+json`. - Future versions of the spec MAY use a different mediatype (i.e. a new versioned format). - An encountered `mediaType` that is unknown MUST NOT generate an error. **Implementor's Note:** A common use case of descriptors with a "org.opencontainers.image.ref.name" annotation is representing a "tag" for a container image. For example, an image may have a tag for different versions or builds of the software. In the wild you often see "tags" like "v1.0.0-vendor.0", "2.0.0-debug", etc. Those tags will often be represented in an image-layout repository with matching "org.opencontainers.image.ref.name" annotations like "v1.0.0-vendor.0", "2.0.0-debug", etc. ### Index Example ```json,title=Image%20Index&mediatype=application/vnd.oci.image.index.v1%2Bjson { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.index.v1+json", "size": 7143, "digest": "sha256:0228f90e926ba6b96e4f39cf294b2586d38fbb5a1e385c05cd1ee40ea54fe7fd", "annotations": { "org.opencontainers.image.ref.name": "stable-release" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7143, "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", "platform": { "architecture": "ppc64le", "os": "linux" }, "annotations": { "org.opencontainers.image.ref.name": "v1.0" } }, { "mediaType": "application/xml", "size": 7143, "digest": "sha256:b3d63d132d21c3ff4c35a061adf23cf43da8ae054247e32faa95494d904a007e", "annotations": { "org.freedesktop.specifications.metainfo.version": "1.0", "org.freedesktop.specifications.metainfo.type": "AppStream" } } ], "annotations": { "com.example.index.revision": "r124356" } } ``` This illustrates an index that provides two named references and an auxiliary mediatype for this image layout. The first named reference (`stable-release`) points to another index that might contain multiple references with distinct platforms and annotations. Note that the [`org.opencontainers.image.ref.name` annotation](annotations.md) SHOULD only be considered valid when on descriptors on `index.json`. The second named reference (`v1.0`) points to a manifest that is specific to the linux/ppc64le platform. [descriptors]: ./descriptor.md crun-1.16.1/libocispec/image-spec/implementations.md0000644000000000000000000000450414614670026020626 0ustar0000000000000000# OCI Image Implementations Projects or Companies currently adopting the OCI Image Specification - [projectatomic/skopeo](https://github.com/projectatomic/skopeo) - [Amazon Elastic Container Registry (ECR)](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-manifest-formats.html) ([announcement](https://aws.amazon.com/about-aws/whats-new/2017/01/amazon-ecr-supports-docker-image-manifest-v2-schema-2/)) - [Azure Container Registry (ACR)](https://docs.microsoft.com/azure/container-registry/container-registry-image-formats#oci-images) - [openSUSE/umoci](https://github.com/openSUSE/umoci) - [cloudfoundry/grootfs](https://github.com/cloudfoundry/grootfs) ([source](https://github.com/cloudfoundry/grootfs/blob/c3da26e1e463b51be1add289032f3dca6698b335/fetcher/remote/docker_src.go)) - [Mesos plans](https://issues.apache.org/jira/browse/MESOS-5011) ([design doc](https://docs.google.com/document/d/1Pus7D-inIBoLSIPyu3rl_apxvUhtp3rp0_b0Ttr2Xww/edit#heading=h.hrvk2wboog4p)) - [Docker](https://github.com/docker) - [docker/docker (`docker save/load` WIP)](https://github.com/docker/docker/pull/26369) - [distribution/distribution (registry PR)](https://github.com/distribution/distribution/pull/2076) - [containerd/containerd](https://github.com/containerd/containerd) - [Containers](https://github.com/containers/) - [containers/build](https://github.com/containers/build) - [containers/image](https://github.com/containers/image) - [containers/oci-spec-rs](https://github.com/containers/oci-spec-rs) - [containers/libocispec](https://github.com/containers/libocispec) - [krustlet/oci-distribution](https://github.com/krustlet/oci-distribution) - [box-builder/box](https://github.com/box-builder/box) - [coolljt0725/docker2oci](https://github.com/coolljt0725/docker2oci) - [regclient/regclient](https://github.com/regclient/regclient) - [ORAS](https://oras.land/) - [oras-project/oras](https://github.com/oras-project/oras/) - [oras-project/oras-go](https://github.com/oras-project/oras-go) ## Former Projects OCI would like to recognize the following projects that are no longer actively maintained but have contributed to the adoption of OCI - [coreos/rkt](https://github.com/coreos/rkt) - Project ended and archived on Feb 25, 2020 _(to add your project please open a [pull-request](https://github.com/opencontainers/image-spec/pulls))_ crun-1.16.1/libocispec/image-spec/layer.md0000644000000000000000000003336014614670026016534 0ustar0000000000000000# Image Layer Filesystem Changeset This document describes how to serialize a filesystem and filesystem changes like removed files into a blob called a layer. One or more layers are applied on top of each other to create a complete filesystem. This document will use a concrete example to illustrate how to create and consume these filesystem layers. This section defines the `application/vnd.oci.image.layer.v1.tar`, `application/vnd.oci.image.layer.v1.tar+gzip`, `application/vnd.oci.image.layer.v1.tar+zstd`, `application/vnd.oci.image.layer.nondistributable.v1.tar`, `application/vnd.oci.image.layer.nondistributable.v1.tar+gzip`, and `application/vnd.oci.image.layer.nondistributable.v1.tar+zstd` [media types](media-types.md). ## `+gzip` Media Types - The media type `application/vnd.oci.image.layer.v1.tar+gzip` represents an `application/vnd.oci.image.layer.v1.tar` payload which has been compressed with [gzip][rfc1952_2]. - The media type `application/vnd.oci.image.layer.nondistributable.v1.tar+gzip` represents an `application/vnd.oci.image.layer.nondistributable.v1.tar` payload which has been compressed with [gzip][rfc1952_2]. ## `+zstd` Media Types - The media type `application/vnd.oci.image.layer.v1.tar+zstd` represents an `application/vnd.oci.image.layer.v1.tar` payload which has been compressed with [zstd][rfc8478]. - The media type `application/vnd.oci.image.layer.nondistributable.v1.tar+zstd` represents an `application/vnd.oci.image.layer.nondistributable.v1.tar` payload which has been compressed with [zstd][rfc8478]. ## Distributable Format - Layer Changesets for the [media type](media-types.md) `application/vnd.oci.image.layer.v1.tar` MUST be packaged in [tar archive][tar-archive]. - Layer Changesets for the [media type](media-types.md) `application/vnd.oci.image.layer.v1.tar` MUST NOT include duplicate entries for file paths in the resulting [tar archive][tar-archive]. ## Change Types Types of changes that can occur in a changeset are: - Additions - Modifications - Removals Additions and Modifications are represented the same in the changeset tar archive. Removals are represented using "[whiteout](#whiteouts)" file entries (See [Representing Changes](#representing-changes)). ### File Types Throughout this document section, the use of word "files" or "entries" includes the following, where supported: - regular files - directories - sockets - symbolic links - block devices - character devices - FIFOs ### File Attributes Where supported, MUST include file attributes for Additions and Modifications include: - Modification Time (`mtime`) - User ID (`uid`) - User Name (`uname`) *secondary to `uid`* - Group ID (`gid`) - Group Name (`gname`) *secondary to `gid`* - Mode (`mode`) - Extended Attributes (`xattrs`) - Symlink reference (`linkname` + symbolic link type) - [Hardlink](#hardlinks) reference (`linkname`) [Sparse files](https://en.wikipedia.org/wiki/Sparse_file) SHOULD NOT be used because they lack consistent support across tar implementations. #### Hardlinks - Hardlinks are a [POSIX concept](https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html) for having one or more directory entries for the same file on the same device. - Not all filesystems support hardlinks (e.g. [FAT](https://en.wikipedia.org/wiki/File_Allocation_Table)). - Hardlinks are possible with all [file types](#file-types) except `directories`. - Non-directory files are considered "hardlinked" when their link count is greater than 1. - Hardlinked files are on a same device (i.e. comparing Major:Minor pair) and have the same inode. - The corresponding files that share the link with the > 1 linkcount may be outside the directory that the changeset is being produced from, in which case the `linkname` is not recorded in the changeset. - Hardlinks are stored in a tar archive with type of a `1` char, per the [GNU Basic Tar Format][gnu-tar-standard] and [libarchive tar(5)][libarchive-tar]. - While approaches to deriving new or changed hardlinks may vary, a possible approach is: ```text SET LinkMap to map[< Major:Minor String >]map[< inode integer >]< path string > SET LinkNames to map[< src path string >]< dest path string > FOR each path in root path IF path type is directory CONTINUE ENDIF SET filestat to stat(path) IF filestat num of links == 1 CONTINUE ENDIF IF LinkMap[filestat device][filestat inode] is not empty SET LinkNames[path] to LinkMap[filestat device][filestat inode] ELSE SET LinkMap[filestat device][filestat inode] to path ENDIF END FOR ``` With this approach, the link map and links names of a directory could be compared against that of another directory to derive additions and changes to hardlinks. #### Platform-specific attributes Implementations on Windows MUST support these additional attributes, encoded in [PAX vendor extensions](https://github.com/libarchive/libarchive/wiki/ManPageTar5#pax-interchange-format) as follows: - [Windows file attributes](https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx) (`MSWINDOWS.fileattr`) - [Security descriptor](https://msdn.microsoft.com/en-us/library/cc230366.aspx) (`MSWINDOWS.rawsd`): base64-encoded self-relative binary security descriptor - Mount points (`MSWINDOWS.mountpoint`): if present on a directory symbolic link, then the link should be created as a [directory junction](https://en.wikipedia.org/wiki/NTFS_junction_point) - Creation time (`LIBARCHIVE.creationtime`) ## Creating ### Initial Root Filesystem The initial root filesystem is the base or parent layer. For this example, an image root filesystem has an initial state as an empty directory. The name of the directory is not relevant to the layer itself, only for the purpose of producing comparisons. Here is an initial empty directory structure for a changeset, with a unique directory name `rootfs-c9d-v1`. ```text rootfs-c9d-v1/ ``` ### Populate Initial Filesystem Files and directories are then created: ```text rootfs-c9d-v1/ etc/ my-app-config bin/ my-app-binary my-app-tools ``` The `rootfs-c9d-v1` directory is then created as a plain [tar archive][tar-archive] with relative path to `rootfs-c9d-v1`. Entries for the following files: ```text ./ ./etc/ ./etc/my-app-config ./bin/ ./bin/my-app-binary ./bin/my-app-tools ``` ### Populate a Comparison Filesystem Create a new directory and initialize it with a copy or snapshot of the prior root filesystem. Example commands that can preserve [file attributes](#file-attributes) to make this copy are: - [cp(1)](https://linux.die.net/man/1/cp): `cp -a rootfs-c9d-v1/ rootfs-c9d-v1.s1/` - [rsync(1)](https://linux.die.net/man/1/rsync): `rsync -aHAX rootfs-c9d-v1/ rootfs-c9d-v1.s1/` - [tar(1)](https://linux.die.net/man/1/tar): `mkdir rootfs-c9d-v1.s1 && tar --acls --xattrs -C rootfs-c9d-v1/ -c . | tar -C rootfs-c9d-v1.s1/ --acls --xattrs -x` (including `--selinux` where supported) Any [changes](#change-types) to the snapshot MUST NOT change or affect the directory it was copied from. For example `rootfs-c9d-v1.s1` is an identical snapshot of `rootfs-c9d-v1`. In this way `rootfs-c9d-v1.s1` is prepared for updates and alterations. **Implementor's Note**: *a copy-on-write or union filesystem can efficiently make directory snapshots* Initial layout of the snapshot: ```text rootfs-c9d-v1.s1/ etc/ my-app-config bin/ my-app-binary my-app-tools ``` See [Change Types](#change-types) for more details on changes. For example, add a directory at `/etc/my-app.d` containing a default config file, removing the existing config file. Also a change (in attribute or file content) to `./bin/my-app-tools` binary to handle the config layout change. Following these changes, the representation of the `rootfs-c9d-v1.s1` directory: ```text rootfs-c9d-v1.s1/ etc/ my-app.d/ default.cfg bin/ my-app-binary my-app-tools ``` ### Determining Changes When two directories are compared, the relative root is the top-level directory. The directories are compared, looking for files that have been [added, modified, or removed](#change-types). For this example, `rootfs-c9d-v1/` and `rootfs-c9d-v1.s1/` are recursively compared, each as relative root path. The following changeset is found: ```text Added: /etc/my-app.d/ Added: /etc/my-app.d/default.cfg Modified: /bin/my-app-tools Deleted: /etc/my-app-config ``` This reflects the removal of `/etc/my-app-config` and creation of a file and directory at `/etc/my-app.d/default.cfg`. `/bin/my-app-tools` has also been replaced with an updated version. ### Representing Changes A [tar archive][tar-archive] is then created which contains _only_ this changeset: - Added and modified files and directories in their entirety - Deleted files or directories marked with a [whiteout file](#whiteouts) The resulting tar archive for `rootfs-c9d-v1.s1` has the following entries: ```text ./etc/my-app.d/ ./etc/my-app.d/default.cfg ./bin/my-app-tools ./etc/.wh.my-app-config ``` To signify that the resource `./etc/my-app-config` MUST be removed when the changeset is applied, the basename of the entry is prefixed with `.wh.`. ## Applying Changesets - Layer Changesets of [media type](media-types.md) `application/vnd.oci.image.layer.v1.tar` are _applied_, rather than simply extracted as tar archives. - Applying a layer changeset requires special consideration for the [whiteout](#whiteouts) files. - In the absence of any [whiteout](#whiteouts) files in a layer changeset, the archive is extracted like a regular tar archive. ### Changeset over existing files This section specifies applying an entry from a layer changeset if the target path already exists. If the entry and the existing path are both directories, then the existing path's attributes MUST be replaced by those of the entry in the changeset. In all other cases, the implementation MUST do the semantic equivalent of the following: - removing the file path (e.g. [`unlink(2)`](https://linux.die.net/man/2/unlink) on Linux systems) - recreating the file path, based on the contents and attributes of the changeset entry ## Whiteouts - A whiteout file is an empty file with a special filename that signifies a path should be deleted. - A whiteout filename consists of the prefix `.wh.` plus the basename of the path to be deleted. - As files prefixed with `.wh.` are special whiteout markers, it is not possible to create a filesystem which has a file or directory with a name beginning with `.wh.`. - Once a whiteout is applied, the whiteout itself MUST also be hidden. - Whiteout files MUST only apply to resources in lower/parent layers. - Files that are present in the same layer as a whiteout file can only be hidden by whiteout files in subsequent layers. The following is a base layer with several resources: ```text a/ a/b/ a/b/c/ a/b/c/bar ``` When the next layer is created, the original `a/b` directory is deleted and recreated with `a/b/c/foo`: ```text a/ a/.wh..wh..opq a/b/ a/b/c/ a/b/c/foo ``` When processing the second layer, `a/.wh..wh..opq` is applied first, before creating the new version of `a/b`, regardless of the ordering in which the whiteout file was encountered. For example, the following layer is equivalent to the layer above: ```text a/ a/b/ a/b/c/ a/b/c/foo a/.wh..wh..opq ``` Implementations SHOULD generate layers such that the whiteout files appear before sibling directory entries. ### Opaque Whiteout - In addition to expressing that a single entry should be removed from a lower layer, layers may remove all of the children using an opaque whiteout entry. - An opaque whiteout entry is a file with the name `.wh..wh..opq` indicating that all siblings are hidden in the lower layer. Let's take the following base layer as an example: ```text etc/ my-app-config bin/ my-app-binary my-app-tools tools/ my-app-tool-one ``` If all children of `bin/` are removed, the next layer would have the following: ```text bin/ .wh..wh..opq ``` This is called _opaque whiteout_ format. An _opaque whiteout_ file hides _all_ children of the `bin/` including sub-directories and all descendants. Using _explicit whiteout_ files, this would be equivalent to the following: ```text bin/ .wh.my-app-binary .wh.my-app-tools .wh.tools ``` In this case, a unique whiteout file is generated for each entry. If there were more children of `bin/` in the base layer, there would be an entry for each. Note that this opaque file will apply to _all_ children, including sub-directories, other resources and all descendants. Implementations SHOULD generate layers using _explicit whiteout_ files, but MUST accept both. Any given image is likely to be composed of several of these Image Filesystem Changeset tar archives. ## Non-Distributable Layers > **NOTE**: Non-distributable layers are deprecated, and not recommended for future use. > Implementations SHOULD NOT produce new non-distributable layers. Due to legal requirements, certain layers may not be regularly distributable. Such "non-distributable" layers are typically downloaded directly from a distributor but never uploaded. Non-distributable layers SHOULD be tagged with an alternative mediatype of `application/vnd.oci.image.layer.nondistributable.v1.tar`. Implementations SHOULD NOT upload layers tagged with this media type; however, such a media type SHOULD NOT affect whether an implementation downloads the layer. [Descriptors](descriptor.md) referencing non-distributable layers MAY include `urls` for downloading these layers directly; however, the presence of the `urls` field SHOULD NOT be used to determine whether or not a layer is non-distributable. [libarchive-tar]: https://github.com/libarchive/libarchive/wiki/ManPageTar5#POSIX_ustar_Archives [gnu-tar-standard]: https://www.gnu.org/software/tar/manual/html_node/Standard.html [rfc1952_2]: https://tools.ietf.org/html/rfc1952 [tar-archive]: https://en.wikipedia.org/wiki/Tar_(computing) [rfc8478]: https://tools.ietf.org/html/rfc8478 crun-1.16.1/libocispec/image-spec/manifest.md0000644000000000000000000003220314614670026017221 0ustar0000000000000000# OCI Image Manifest Specification There are three main goals of the Image Manifest Specification. The first goal is content-addressable images, by supporting an image model where the image's configuration can be hashed to generate a unique ID for the image and its components. The second goal is to allow multi-architecture images, through a "fat manifest" which references image manifests for platform-specific versions of an image. In OCI, this is codified in an [image index](image-index.md). The third goal is to be [translatable](conversion.md) to the [OCI Runtime Specification](https://github.com/opencontainers/runtime-spec). This section defines the `application/vnd.oci.image.manifest.v1+json` [media type](media-types.md). For the media type(s) that this is compatible with see the [matrix](media-types.md#compatibility-matrix). ## Image Manifest Unlike the [image index](image-index.md), which contains information about a set of images that can span a variety of architectures and operating systems, an image manifest provides a configuration and set of layers for a single container image for a specific architecture and operating system. ## _Image Manifest_ Property Descriptions - **`schemaVersion`** *int* This REQUIRED property specifies the image manifest schema version. For this version of the specification, this MUST be `2` to ensure backward compatibility with older versions of Docker. The value of this field will not change. This field MAY be removed in a future version of the specification. - **`mediaType`** *string* This property SHOULD be used and [remain compatible](media-types.md#compatibility-matrix) with earlier versions of this specification and with other similar external formats. When used, this field MUST contain the media type `application/vnd.oci.image.manifest.v1+json`. This field usage differs from the [descriptor](descriptor.md#properties) use of `mediaType`. - **`artifactType`** *string* This OPTIONAL property contains the type of an artifact when the manifest is used for an artifact. This MUST be set when `config.mediaType` is set to the [empty value](#guidance-for-an-empty-descriptor). If defined, the value MUST comply with [RFC 6838][rfc6838], including the [naming requirements in its section 4.2][rfc6838-s4.2], and MAY be registered with [IANA][iana]. Implementations storing or copying image manifests MUST NOT error on encountering an `artifactType` that is unknown to the implementation. - **`config`** *[descriptor](descriptor.md)* This REQUIRED property references a configuration object for a container, by digest. Beyond the [descriptor requirements](descriptor.md#properties), the value has the following additional restrictions: - **`mediaType`** *string* This [descriptor property](descriptor.md#properties) has additional restrictions for `config`. Implementations MUST NOT attempt to parse the referenced content if this media type is unknown and instead consider the referenced content as arbitrary binary data (e.g.: as `application/octet-stream`). Implementations storing or copying image manifests MUST NOT error on encountering a value that is unknown to the implementation. Implementations MUST support at least the following media types: - [`application/vnd.oci.image.config.v1+json`](config.md) Manifests for container images concerned with portability SHOULD use one of the above media types. Manifests for artifacts concerned with portability SHOULD use `config.mediaType` as described in [Guidelines for Artifact Usage](#guidelines-for-artifact-usage). If the manifest uses a different media type than the above, it MUST comply with [RFC 6838][rfc6838], including the [naming requirements in its section 4.2][rfc6838-s4.2], and MAY be registered with [IANA][iana]. To set an effectively null or empty config and maintain portability see the [guidance for an empty descriptor](#guidance-for-an-empty-descriptor) below, and `DescriptorEmptyJSON` of the reference code. - **`layers`** *array of objects* Each item in the array MUST be a [descriptor](descriptor.md). For portability, `layers` SHOULD have at least one entry. See the [guidance for an empty descriptor](#guidance-for-an-empty-descriptor) below, and `DescriptorEmptyJSON` of the reference code. When the `config.mediaType` is set to `application/vnd.oci.image.config.v1+json`, the following additional restrictions apply: - The array MUST have the base layer at index 0. - Subsequent layers MUST then follow in stack order (i.e. from `layers[0]` to `layers[len(layers)-1]`). - The final filesystem layout MUST match the result of [applying](layer.md#applying-changesets) the layers to an empty directory. - The [ownership, mode, and other attributes](layer.md#file-attributes) of the initial empty directory are unspecified. Beyond the [descriptor requirements](descriptor.md#properties), the value has the following additional restrictions: - **`mediaType`** *string* This [descriptor property](descriptor.md#properties) has additional restrictions for `layers[]`. Implementations MUST support at least the following media types: - [`application/vnd.oci.image.layer.v1.tar`](layer.md) - [`application/vnd.oci.image.layer.v1.tar+gzip`](layer.md#gzip-media-types) - [`application/vnd.oci.image.layer.nondistributable.v1.tar`](layer.md#non-distributable-layers) - [`application/vnd.oci.image.layer.nondistributable.v1.tar+gzip`](layer.md#gzip-media-types) Manifests concerned with portability SHOULD use one of the above media types. Implementations storing or copying image manifests MUST NOT error on encountering a `mediaType` that is unknown to the implementation. Entries in this field will frequently use the `+gzip` types. If the manifest uses a different media type than the above, it MUST comply with [RFC 6838][rfc6838], including the [naming requirements in its section 4.2][rfc6838-s4.2], and MAY be registered with [IANA][iana]. See [Guidelines for Artifact Usage](#guidelines-for-artifact-usage) for other uses of the `layers`. - **`subject`** *[descriptor](descriptor.md)* This OPTIONAL property specifies a [descriptor](descriptor.md) of another manifest. This value defines a weak association to a separate [Merkle Directed Acyclic Graph (DAG)][dag] structure, and is used by the [`referrers` API][referrers-api] to include this manifest in the list of responses for the subject digest. - **`annotations`** *string-string map* This OPTIONAL property contains arbitrary metadata for the image manifest. This OPTIONAL property MUST use the [annotation rules](annotations.md#rules). See [Pre-Defined Annotation Keys](annotations.md#pre-defined-annotation-keys). ## Example Image Manifest *Example showing an image manifest:* ```json,title=Manifest&mediatype=application/vnd.oci.image.manifest.v1%2Bjson { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "digest": "sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7", "size": 7023 }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "digest": "sha256:9834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f0", "size": 32654 }, { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "digest": "sha256:3c3a4604a545cdc127456d94e421cd355bca5b528f4a9c1905b15da2eb4a4c6b", "size": 16724 }, { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "digest": "sha256:ec4b8955958665577945c89419d1af06b5f7636b4ac3da7f12184802ad867736", "size": 73109 } ], "subject": { "mediaType": "application/vnd.oci.image.manifest.v1+json", "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "size": 7682 }, "annotations": { "com.example.key1": "value1", "com.example.key2": "value2" } } ``` ## Guidance for an Empty Descriptor *Implementers note*: The following is considered GUIDANCE for portability. Parts of the spec necessitate including a descriptor to a blob where some implementations of artifacts do not have associated content. While an empty blob (`size` of 0) may be preferable, practice has shown that not to be ubiquitously supported. The media type `application/vnd.oci.empty.v1+json` (`MediaTypeEmptyJSON`) has been specified for a descriptor that has no content for the implementation. The blob payload is the most minimal content that is still a valid JSON object: `{}` (`size` of 2). The blob digest of `{}` is `sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a`. The data field is optional, and if included is the base64 encoding of `{}`: `e30=`. The resulting descriptor shown here is also defined in reference code as `DescriptorEmptyJSON`: ```json,title=empty%20config&mediatype=application/vnd.oci.descriptor.v1%2Bjson { "mediaType": "application/vnd.oci.empty.v1+json", "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", "size": 2, "data": "e30=" } ``` ## Guidelines for Artifact Usage Content other than OCI container images MAY be packaged using the image manifest. When this is done, the `config.mediaType` value MUST be set to a value specific to the artifact type or the [empty value](#guidance-for-an-empty-descriptor). If the `config.mediaType` is set to the empty value, the `artifactType` MUST be defined. If the artifact does not need layers, a single layer SHOULD be included with a non-zero size. The suggested content for an unused `layers` array is the [empty descriptor](#guidance-for-an-empty-descriptor). The design of the artifact depends on what content is being packaged with the artifact. The decision tree below and the associated examples MAY be used to design new artifacts: 1. Does the artifact consist of at least one file or blob? If yes, continue to 2. If no, specify the `artifactType`, and set the `config` and a single `layers` element to the empty descriptor value. Here is an example of this with annotations included: ```json,title=Minimal%20artifact&mediatype=application/vnd.oci.image.manifest.v1%2Bjson { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.manifest.v1+json", "artifactType": "application/vnd.example+type", "config": { "mediaType": "application/vnd.oci.empty.v1+json", "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", "size": 2 }, "layers": [ { "mediaType": "application/vnd.oci.empty.v1+json", "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", "size": 2 } ], "annotations": { "oci.opencontainers.image.created": "2023-01-02T03:04:05Z", "com.example.data": "payload" } } ``` 2. Does the artifact have additional JSON formatted metadata as configuration? If yes, continue to 3. If no, specify the `artifactType`, include the artifact in the `layers`, and set `config` to the empty descriptor value. Here is an example of this with a single layer: ```json,title=Artifact%20without%20config&mediatype=application/vnd.oci.image.manifest.v1%2Bjson { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.manifest.v1+json", "artifactType": "application/vnd.example+type", "config": { "mediaType": "application/vnd.oci.empty.v1+json", "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", "size": 2 }, "layers": [ { "mediaType": "application/vnd.example+type", "digest": "sha256:e258d248fda94c63753607f7c4494ee0fcbe92f1a76bfdac795c9d84101eb317", "size": 1234 } ] } ``` 3. For artifacts with a config blob, specify the `artifactType` to a common value for your artifact tooling, specify the `config` with the metadata for this artifact, and include the artifact in the `layers`. Here is an example of this: ```json,title=Artifact%20with%20config&mediatype=application/vnd.oci.image.manifest.v1%2Bjson { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.manifest.v1+json", "artifactType": "application/vnd.example+type", "config": { "mediaType": "application/vnd.example.config.v1+json", "digest": "sha256:5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03", "size": 123 }, "layers": [ { "mediaType": "application/vnd.example.data.v1.tar+gzip", "digest": "sha256:e258d248fda94c63753607f7c4494ee0fcbe92f1a76bfdac795c9d84101eb317", "size": 1234 } ] } ``` _Implementers note:_ artifacts have historically been created without an `artifactType` field, and tooling to work with artifacts should fallback to the `config.mediaType` value. [dag]: https://en.wikipedia.org/wiki/Merkle_tree [iana]: https://www.iana.org/assignments/media-types/media-types.xhtml [referrers-api]: https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers [rfc6838]: https://tools.ietf.org/html/rfc6838 [rfc6838-s4.2]: https://tools.ietf.org/html/rfc6838#section-4.2 crun-1.16.1/libocispec/image-spec/media-types.md0000644000000000000000000001247314614670026017643 0ustar0000000000000000# OCI Image Media Types The following media types identify the formats described here and their referenced resources: - `application/vnd.oci.descriptor.v1+json`: [Content Descriptor](descriptor.md) - `application/vnd.oci.layout.header.v1+json`: [OCI Layout](image-layout.md#oci-layout-file) - `application/vnd.oci.image.index.v1+json`: [Image Index](image-index.md) - `application/vnd.oci.image.manifest.v1+json`: [Image manifest](manifest.md#image-manifest) - `application/vnd.oci.image.config.v1+json`: [Image config](config.md) - `application/vnd.oci.image.layer.v1.tar`: ["Layer", as a tar archive](layer.md) - `application/vnd.oci.image.layer.v1.tar+gzip`: ["Layer", as a tar archive](layer.md#gzip-media-types) compressed with [gzip][rfc1952] - `application/vnd.oci.image.layer.v1.tar+zstd`: ["Layer", as a tar archive](layer.md#zstd-media-types) compressed with [zstd][rfc8478] - `application/vnd.oci.empty.v1+json`: [Empty for unused descriptors](manifest.md#guidance-for-an-empty-descriptor) The following media types identify a ["Layer" with distribution restrictions](layer.md#non-distributable-layers), but are **deprecated** and not recommended for future use: - `application/vnd.oci.image.layer.nondistributable.v1.tar`: "Layer", as a tar archive - `application/vnd.oci.image.layer.nondistributable.v1.tar+gzip`: ["Layer", as a tar archive with distribution restrictions](layer.md#gzip-media-types) compressed with [gzip][rfc1952] - `application/vnd.oci.image.layer.nondistributable.v1.tar+zstd`: ["Layer", as a tar archive with distribution restrictions](layer.md#zstd-media-types) compressed with [zstd][rfc8478] ## Media Type Conflicts [Blob](image-layout.md) retrieval methods MAY return media type metadata. For example, a HTTP response might return a manifest with the Content-Type header set to `application/vnd.oci.image.manifest.v1+json`. Implementations MAY also have expectations for the blob's media type and digest (e.g. from a [descriptor](descriptor.md) referencing the blob). - Implementations that do not have an expected media type for the blob SHOULD respect the returned media type. - Implementations that have an expected media type which matches the returned media type SHOULD respect the matched media type. - Implementations that have an expected media type which does not match the returned media type SHOULD: - Respect the expected media type if the blob matches the expected digest. Implementations MAY warn about the media type mismatch. - Return an error if the blob does not match the expected digest (as [recommended for descriptors](descriptor.md#properties)). - Return an error if they do not have an expected digest. ## Compatibility Matrix The OCI Image Specification strives to be backwards and forwards compatible when possible. Breaking compatibility with existing systems creates a burden on users whether they are build systems, distribution systems, container engines, etc. This section shows where the OCI Image Specification is compatible with formats external to the OCI Image and different versions of this specification. ### application/vnd.oci.image.index.v1+json Similar/related schema: - [application/vnd.docker.distribution.manifest.list.v2+json](https://github.com/distribution/distribution/blob/v2.8.3/docs/spec/manifest-v2-2.md#manifest-list) - `.annotations`: only present in OCI - `.[]manifests.annotations`: only present in OCI - `.[]manifests.urls`: only present in OCI ### application/vnd.oci.image.manifest.v1+json Similar/related schema: - [application/vnd.docker.distribution.manifest.v2+json](https://github.com/distribution/distribution/blob/v2.8.3/docs/spec/manifest-v2-2.md#image-manifest) - `.annotations`: only present in OCI - `.config.annotations`: only present in OCI - `.config.urls`: only present in OCI - `.[]layers.annotations`: only present in OCI ### application/vnd.oci.image.layer.v1.tar+gzip Interchangeable and fully compatible mime-types: - [application/vnd.docker.image.rootfs.diff.tar.gzip](https://github.com/moby/moby/blob/v20.10.8/image/spec/v1.2.md#creating-an-image-filesystem-changeset) ### application/vnd.oci.image.config.v1+json Similar/related schema: - [application/vnd.docker.container.image.v1+json](https://github.com/moby/moby/blob/v20.10.8/image/spec/v1.2.md#image-json-description) (Docker Image Spec v1.2) - `.config.Memory`: only present in Docker, and reserved in OCI - `.config.MemorySwap`: only present in Docker, and reserved in OCI - `.config.CpuShares`: only present in Docker, and reserved in OCI - `.config.Healthcheck`: only present in Docker, and reserved in OCI - [Moby/Docker](https://github.com/moby/moby) - `.config.ArgsEscaped`: Windows-specific Moby/Docker extension, deprecated in OCI, available for compatibility with older images. `.config.StopSignal` and `.config.Labels` are accidentally undocumented in Docker Image Spec v1.2, but these fields are not OCI-specific concepts. ## Relations The following figure shows how the above media types reference each other: ![media types](img/media-types.png) [Descriptors](descriptor.md) are used for all references. The image-index being a "fat manifest" references a list of image manifests per target platform. An image manifest references exactly one target configuration and possibly many layers. [rfc1952]: https://tools.ietf.org/html/rfc1952 [rfc8478]: https://tools.ietf.org/html/rfc8478 crun-1.16.1/libocispec/image-spec/project.md0000644000000000000000000000036614614670026017066 0ustar0000000000000000# Project docs ## Release Process - `git tag` the prior commit (preferably signed tag) - Make a release on [github.com/opencontainers/image-spec](https://github.com/opencontainers/image-spec/releases) for the version. Attach the produced docs. crun-1.16.1/libocispec/image-spec/spec.md0000644000000000000000000001023114614670026016342 0ustar0000000000000000# Open Container Initiative ## Image Format Specification This specification defines an OCI Image, consisting of an [image manifest](manifest.md), an [image index](image-index.md) (optional), a set of [filesystem layers](layer.md), and a [configuration](config.md). The goal of this specification is to enable the creation of interoperable tools for building, transporting, and preparing a container image to run. ### Table of Contents - [Notational Conventions](#notational-conventions) - [Overview](#overview) - [Understanding the Specification](#understanding-the-specification) - [Media Types](media-types.md) - [Content Descriptors](descriptor.md) - [Image Layout](image-layout.md) - [Image Manifest](manifest.md) - [Image Index](image-index.md) - [Filesystem Layers](layer.md) - [Image Configuration](config.md) - [Annotations](annotations.md) - [Conversion](conversion.md) - [Considerations](considerations.md) - [Extensibility](considerations.md#extensibility) - [Canonicalization](considerations.md#canonicalization) ## Notational Conventions The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119) (Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997). The key words "unspecified", "undefined", and "implementation-defined" are to be interpreted as described in the [rationale for the C99 standard][c99-unspecified]. An implementation is not compliant if it fails to satisfy one or more of the MUST, MUST NOT, REQUIRED, SHALL, or SHALL NOT requirements for the protocols it implements. An implementation is compliant if it satisfies all the MUST, MUST NOT, REQUIRED, SHALL, and SHALL NOT requirements for the protocols it implements. ## Overview At a high level the image manifest contains metadata about the contents and dependencies of the image including the content-addressable identity of one or more [filesystem layer changeset](layer.md) archives that will be unpacked to make up the final runnable filesystem. The image configuration includes information such as application arguments, environments, etc. The image index is a higher-level manifest which points to a list of manifests and descriptors. Typically, these manifests may provide different implementations of the image, possibly varying by platform or other attributes. ![build diagram](img/build-diagram.png) Once built the OCI Image can then be discovered by name, downloaded, verified by hash, trusted through a signature, and unpacked into an [OCI Runtime Bundle](https://github.com/opencontainers/runtime-spec/blob/master/bundle.md). ![runtime diagram](img/run-diagram.png) ### Understanding the Specification The [OCI Image Media Types](media-types.md) document is a starting point to understanding the overall structure of the specification. The high-level components of the spec include: - [Image Manifest](manifest.md) - a document describing the components that make up a container image - [Image Index](image-index.md) - an annotated list of manifests - [Image Layout](image-layout.md) - a filesystem layout representing the contents of an image - [Filesystem Layer](layer.md) - a changeset that describes a container's filesystem - [Image Configuration](config.md) - a document determining layer ordering and configuration of the image suitable for translation into a [runtime bundle][runtime-spec] - [Conversion](conversion.md) - a document describing how this translation should occur - [Artifacts Guidance](artifacts-guidance.md) - a document describing how to use the spec for packaging content other than OCI images - [Descriptor](descriptor.md) - a reference that describes the type, metadata and content address of referenced content Future versions of this specification may include the following OPTIONAL features: - Signatures that are based on signing image content address - Naming that is federated based on DNS and can be delegated [c99-unspecified]: https://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf#page=18 [runtime-spec]: https://github.com/opencontainers/runtime-spec crun-1.16.1/libocispec/image-spec/.golangci.yml0000644000000000000000000000073014614670026017455 0ustar0000000000000000run: timeout: 10m linters: disable-all: true enable: - dupl - errorlint - gofmt - goimports - gomodguard - gosimple - govet - ineffassign - misspell - nakedret - revive - unused - staticcheck linters-settings: gofmt: simplify: true gomodguard: blocked: modules: - github.com/pkg/errors: recommendations: - errors - fmt dupl: threshold: 400 crun-1.16.1/libocispec/image-spec/.git0000664000000000000000000000007113677106241015656 0ustar0000000000000000gitdir: ../../.git/modules/libocispec/modules/image-spec crun-1.16.1/libocispec/image-spec/.markdownlint.yml0000644000000000000000000000047514614670026020411 0ustar0000000000000000# all lists use a `-` MD004: style: dash # allow tabs in code blocks (for Go) MD010: code_blocks: false # disable line length, prefer one sentence per line for PRs MD013: false # emphasis with underscore (`_emphasis_`) MD049: style: "underscore" # bold with asterisk (`**bold**`) MD050: style: "asterisk" crun-1.16.1/libocispec/image-spec/EMERITUS.md0000644000000000000000000000052314614670026016650 0ustar0000000000000000# Emeritus We would like to acknowledge previous OCI image spec maintainers and their huge contributions to our collective success: - Brandon Philips (@philips) - Brendan Burns (@brendandburns) - Jason Bouzane (@jbouzane) - John Starks (@jstarks) - Keyang Xie (@xiekeyang) We thank these members for their service to the OCI community. crun-1.16.1/libocispec/image-spec/GOVERNANCE.md0000644000000000000000000000747614614670026017060 0ustar0000000000000000# Project governance The [OCI charter][charter] §5.b.viii tasks an OCI Project's maintainers (listed in the repository's MAINTAINERS file and sometimes referred to as "the TDC", [§5.e][charter]) with: > Creating, maintaining and enforcing governance guidelines for the TDC, approved by the maintainers, and which shall be posted visibly for the TDC. This section describes generic rules and procedures for fulfilling that mandate. ## Proposing a motion A maintainer SHOULD propose a motion on the mailing list (except [security issues](#security-issues)) with another maintainer as a co-sponsor. ## Voting Voting on a proposed motion SHOULD happen on the mailing list (except [security issues](#security-issues)) with maintainers posting LGTM or REJECT. Maintainers MAY also explicitly not vote by posting ABSTAIN (which is useful to revert a previous vote). Maintainers MAY post multiple times (e.g. as they revise their position based on feedback), but only their final post counts in the tally. A proposed motion is adopted if two-thirds of votes cast, a quorum having voted, are in favor of the release. Voting SHOULD remain open for a week to collect feedback from the wider community and allow the maintainers to digest the proposed motion. Under exceptional conditions (e.g. non-major security fix releases) proposals which reach quorum with unanimous support MAY be adopted earlier. A maintainer MAY choose to reply with REJECT. A maintainer posting a REJECT MUST include a list of concerns or links to written documentation for those concerns (e.g. GitHub issues or mailing-list threads). The maintainers SHOULD try to resolve the concerns and wait for the rejecting maintainer to change their opinion to LGTM. However, a motion MAY be adopted with REJECTs, as outlined in the previous paragraphs. ## Quorum A quorum is established when at least two-thirds of maintainers have voted. For projects that are not specifications, a [motion to release](#proposing-a-motion) MAY be adopted if the tally is at least three LGTMs and no REJECTs, even if three votes does not meet the usual two-thirds quorum. ## Security issues Motions with sensitive security implications MUST be proposed on the mailing list instead of , but should otherwise follow the standard [proposal](#proposing-a-motion) process. The mailing list includes all members of the TOB. The TOB will contact the project maintainers and provide a channel for discussing and voting on the motion, but voting will otherwise follow the standard [voting](#voting) and [quorum](#quorum) rules. The TOB and project maintainers will work together to notify affected parties before making an adopted motion public. ## Amendments The [project governance](#project-governance) rules and procedures MAY be amended or replaced using the procedures themselves. The MAINTAINERS of this project governance document is the total set of MAINTAINERS from all Open Containers projects (runC, runtime-spec, and image-spec). ## Subject templates Maintainers are busy and get lots of email. To make project proposals recognizable, proposed motions SHOULD use the following subject templates. ### Proposing a motion template > [{project} VOTE]: {motion description} (closes {end of voting window}) For example: > [image-spec VOTE]: Tag 0647920 as 1.0.0-rc (closes 2016-06-03 20:00 UTC) ### Tallying results template After voting closes, a maintainer SHOULD post a tally to the motion thread with a subject template like: > [{project} {status}]: {motion description} (+{LGTMs} -{REJECTs} #{ABSTAINs}) Where `{status}` is either `adopted` or `rejected`. For example: > [image-spec adopted]: Tag 0647920 as 1.0.0-rc (+6 -0 #3) [charter]: https://github.com/opencontainers/tob/blob/main/CHARTER.md crun-1.16.1/libocispec/image-spec/.gitignore0000664000000000000000000000005213677106243017063 0ustar0000000000000000/oci-validate-examples output header.html crun-1.16.1/libocispec/image-spec/.header0000664000000000000000000000112613677106243016327 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. crun-1.16.1/libocispec/image-spec/LICENSE0000664000000000000000000002501713677106243016110 0ustar0000000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS Copyright 2016 The Linux Foundation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. crun-1.16.1/libocispec/image-spec/identity/0000775000000000000000000000000013677106243016727 5ustar0000000000000000crun-1.16.1/libocispec/image-spec/identity/chainid.go0000664000000000000000000000461413677106243020662 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Package identity provides implementations of subtle calculations pertaining // to image and layer identity. The primary item present here is the ChainID // calculation used in identifying the result of subsequent layer applications. // // Helpers are also provided here to ease transition to the // github.com/opencontainers/go-digest package, but that package may be used // directly. package identity import "github.com/opencontainers/go-digest" // ChainID takes a slice of digests and returns the ChainID corresponding to // the last entry. Typically, these are a list of layer DiffIDs, with the // result providing the ChainID identifying the result of sequential // application of the preceding layers. func ChainID(dgsts []digest.Digest) digest.Digest { chainIDs := make([]digest.Digest, len(dgsts)) copy(chainIDs, dgsts) ChainIDs(chainIDs) if len(chainIDs) == 0 { return "" } return chainIDs[len(chainIDs)-1] } // ChainIDs calculates the recursively applied chain id for each identifier in // the slice. The result is written direcly back into the slice such that the // ChainID for each item will be in the respective position. // // By definition of ChainID, the zeroth element will always be the same before // and after the call. // // As an example, given the chain of ids `[A, B, C]`, the result `[A, // ChainID(A|B), ChainID(A|B|C)]` will be written back to the slice. // // The input is provided as a return value for convenience. // // Typically, these are a list of layer DiffIDs, with the // result providing the ChainID for each the result of each layer application // sequentially. func ChainIDs(dgsts []digest.Digest) []digest.Digest { if len(dgsts) < 2 { return dgsts } parent := digest.FromBytes([]byte(dgsts[0] + " " + dgsts[1])) next := dgsts[1:] next[0] = parent ChainIDs(next) return dgsts } crun-1.16.1/libocispec/image-spec/identity/chainid_test.go0000664000000000000000000000527713677106243021727 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package identity import ( _ "crypto/sha256" // required to install sha256 digest support "reflect" "testing" "github.com/opencontainers/go-digest" ) func TestChainID(t *testing.T) { // To provide a good testing base, we define the individual links in a // chain recursively, illustrating the calculations for each chain. // // Note that we use invalid digests for the unmodified identifiers here to // make the computation more readable. chainDigestAB := digest.FromString("sha256:a" + " " + "sha256:b") // chain for A|B chainDigestABC := digest.FromString(chainDigestAB.String() + " " + "sha256:c") // chain for A|B|C for _, testcase := range []struct { Name string Digests []digest.Digest Expected []digest.Digest }{ { Name: "nil", }, { Name: "empty", Digests: []digest.Digest{}, Expected: []digest.Digest{}, }, { Name: "identity", Digests: []digest.Digest{"sha256:a"}, Expected: []digest.Digest{"sha256:a"}, }, { Name: "two", Digests: []digest.Digest{"sha256:a", "sha256:b"}, Expected: []digest.Digest{"sha256:a", chainDigestAB}, }, { Name: "three", Digests: []digest.Digest{"sha256:a", "sha256:b", "sha256:c"}, Expected: []digest.Digest{"sha256:a", chainDigestAB, chainDigestABC}, }, } { t.Run(testcase.Name, func(t *testing.T) { t.Log("before", testcase.Digests) var ids []digest.Digest if testcase.Digests != nil { ids = make([]digest.Digest, len(testcase.Digests)) copy(ids, testcase.Digests) } ids = ChainIDs(ids) t.Log("after", ids) if !reflect.DeepEqual(ids, testcase.Expected) { t.Errorf("unexpected chain: %v != %v", ids, testcase.Expected) } if len(testcase.Digests) == 0 { return } // Make sure parent stays stable if ids[0] != testcase.Digests[0] { t.Errorf("parent changed: %v != %v", ids[0], testcase.Digests[0]) } // make sure that the ChainID function takes the last element id := ChainID(testcase.Digests) if id != ids[len(ids)-1] { t.Errorf("incorrect chain id returned from ChainID: %v != %v", id, ids[len(ids)-1]) } }) } } crun-1.16.1/libocispec/image-spec/identity/helpers.go0000664000000000000000000000235613677106243020726 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package identity import ( _ "crypto/sha256" // side-effect to install impls, sha256 _ "crypto/sha512" // side-effect to install impls, sha384/sh512 "io" digest "github.com/opencontainers/go-digest" ) // FromReader consumes the content of rd until io.EOF, returning canonical // digest. func FromReader(rd io.Reader) (digest.Digest, error) { return digest.Canonical.FromReader(rd) } // FromBytes digests the input and returns a Digest. func FromBytes(p []byte) digest.Digest { return digest.Canonical.FromBytes(p) } // FromString digests the input and returns a Digest. func FromString(s string) digest.Digest { return digest.Canonical.FromString(s) } crun-1.16.1/libocispec/image-spec/CODEOWNERS0000644000000000000000000000013114432210717016452 0ustar0000000000000000 * @jonjohnsonjr @jonboulle @stevvooe @sudo-bmitch @sajayantony @tianon @vbatts @cyphar crun-1.16.1/libocispec/image-spec/MAINTAINERS0000644000000000000000000000061114432210717016557 0ustar0000000000000000Brandon Mitchell (@sudo-bmitch) Jon Johnson (@jonjohnsonjr) Jonathan Boulle (@jonboulle) Sajay Antony (@sajayantony) Stephen Day (@stevvooe) Tianon Gravi (@tianon) Vincent Batts (@vbatts) Aleksa Sarai (@cyphar) crun-1.16.1/libocispec/image-spec/img/0000775000000000000000000000000014432210717015642 5ustar0000000000000000crun-1.16.1/libocispec/image-spec/img/build-diagram.png0000664000000000000000000012447614160576556021105 0ustar0000000000000000‰PNG  IHDR€€ÕýgAMA± üa cHRMz&€„ú€èu0ê`:˜pœºQ<bKGDÿÿÿ ½§“tIMEå%¾cµorNTÏ¢wš€IDATxÚìýTS÷¾/ü¾©Ó6]+ÝÍÞ+=;ëÙéîä4îÆÓx·xGáŽú@/öx…!âñJ‡x‹C:¤×pÅG¸Ð+ŽÂ‡øOáoáOñ ·xˆCfm³–±¹°ç\„ðýƒÌ93çgÎüšó3¿ßÏ7)‡ADDDDDDDDKÖs‰€ˆˆˆˆˆˆˆˆæ@DDDDDDDDK@DDDDDDDDK@DDDDDDDDK@DDDDDDDDK@DDDDDDDDK@DDDDDDDDK@DDDDDDDDK@DDDDDDDDK@DDDDDDDDKœèˆˆˆˆˆˆhñ …žàÑ£?$:Œ )˱|9/y‰$|7Q”'O~ÆÏ?ÿœè0&´lÙsxî96f'J¤¿ýÛ¸òÿ½•è0&ôoþÍ*W¿Ž¤¤¤D‡B´ 0DDDDDQü·ñÝwFlIÀ_ý•¿þõŸ%:¢gÚw#ÿ §ÿC¢Ã˜ÐË/ÿo½õ/‘´Œ "€ """"Š¡¿ÿ?£úîHt1-[öŽTþ{ü_¶¯Ot(DDD‹ÛÍ-qlDDD€ÇCøÃB‰cB/¼°‚°,Ña-JLà¿~ó=nÞ¼›è0bZöÜsHû7èWþe¢C™7^¯Á`à÷ûá÷û¿ÿýïáõzg´NµZ_þò—Ó4  EÄ4­V Aà)M_RRþüÏÿÊ—^œ·mþÓï‚xðà‡½ûD Ïð•ãoPÿÿêJt1-_¾ úgÊE—òx<ðù|øñÇáñxäDŽôãóùädÏØ¤ÏB¢T*¡V«¡Õj¡T*¡Ñh V«¡R© Õj¡R©ðòË/Ë«ÕêD‡Ls$)) Åó–ÏSk¼°4Ìôï½ëD'AX†Mÿã¼eü—ó¶Íááÿ­ç¾ÄãÇ ·%3ÑBÀÑ4¸Ýn|ÿý÷p»Ýðx<ðz½òoŸÏ7ãV:㉢ñ¿ ÐjµÓ¤ÍL¸Ýnùo)!D¶: ò>ÇK£Ñ@©TB«ÕB­VC©TBEèt:¼þúëÐétL-B/¾ø<Òÿ­ÉÉšyÙÞÏá0\ |˜i"Š´lÙsX“²™ï®·mªT¿DÛÿz'zï‰6&€ˆˆˆbðx<øæ›o022‚‘‘¸ÝnùGJŒÄC£Ñ@¥RÅl5£R©ðÚk¯É œXݱ‚@ ŸÏ''…~üñLj–K¡Pn·;*6222ázU*•œ’~¤äÐø$- ¿øÅ ÈzÏ„ûoó²½'O~Ƽz› ¢E*ã¿=x€Ð Zæ¨T/ãå—_üÍßxàÿ)1ÿ¹çžÃê¿ÖaÙ2ŽkD/&€ˆˆè™644„o¾ùÃÃÃòÏÈȈÜf"Z­z½:¢(.Ù®PJ¥J¥rZ …Br‹¨ßþö·ðù|ðx<‰4·Û §Ó §Óõx…BN‘ ÒëõX³f T*U¢ aôÂ. â矧Ws#) X¾|9–/_Žp8ŒÀÃGQÝ6’ž{ú§Ó{ÍÑÂóäÉϸyó7øÇüïÓ~ìš5«ñÖ¿^…¤¤$\üßñŸ#5~–?/àÌÙÿ~ñ‹½›D‹@DD4¡eËžƒZýò¼\…1ZÈñïÿÞ?ëëƒÂo~ó Ãn·cxxxÂD Q­S¤*¢(.È–: ‰tüÆwaOJ}ÿý÷rk+)744„¡¡¡¨Ç ¤¤¤ %%o¿ý6ŒF#‹V'À£`ÿñ?Ú¦L–Ž'V­2à¿Zßÿþ1þ—ÿ¥wÿëÿ1f‰$¼ôÒ‹¨þ%z‰è)…Æoÿþïñãÿ0íÇ®X¡“ÿv»~‹ÿò_þ6"ô‚b9ž<ù9Ñ»H´¨ðl‰ˆˆ&ô‹_(ñn VÎSñ域üŒo¾ùÿ[û|êu¹Ýnܸqƒƒƒ°Ûí1[™£-yRRR"Z›HÝhîM–$r»Ýr7¼ááa8N9)444„––£­…ŒF#L&“œâó7÷B¡Üßø‡Ÿ¦õ¸åË—Ë]üž<ù_;ÿÿéÆ7Ëüé¯^B8FRRR¢w“ˆˆhÉ`ˆˆˆ&¤xñy¬[÷¯>oõ>ž@ùÒ‹3J áêÕ«Äàà`Ì"Ì*• )))‰f~ŠÙÒôM”·ß~+'öìv;ìv»¼ŒJ¥Bjj*ŒF#RSS±~ýz¶Ú"""¢g@DD—'Ožà‡|…¦WÈ1é¹$¼ü'¥R‰'O~†ËåÅÇÿôÇùíò¦áµi­×ï÷£¯¯½½½èïï‡Ç㉘?¾UÈš5k ×ë}i  lݺUž6¶Å×àà †††ÐÓÓƒžž£¯³ÙŒÍ›7###ƒ-„ˆˆlª~cç?ÿ¼€_|>¢æØ Šå`A¢éaˆˆˆâò(Äàÿ„‡NëqÂòåøëÕF¼ù¯Vâ÷¿Œ 6 ý×H^~Y‰ÆSL¹®¿û»¿CKK zzzàp8"’QZ­7nDJJ Þyç Ö…y†H­…vìØ`4A(%„l6ìv;z{{ÑÛÛ Ðétؼy3¶nÝŠÔÔÔD‡ÿLÍ—””„çž{.bþsìúE´¤½ð нþ/']æõ¯ä$É´ög‚Ñj£a„å˽+D‹ ÏŒ‰ˆ(.OBOðÀëÅO?ù§õ¸çŸ+þ¹µÅ“'?cäÞßáöí1Cƒ'jõŸüs½É×UPP›Íà-:233‘‘‘ƒÁèCD ˆJ¥BVV²²²>ŸOn1ÖÛÛ‹‘‘Ô××£¾¾Z­ؾ};ŒFc¢C_ô–-[†_üâÅ ç/–ãùç—ž{. Z­õWÚˆe^~ùÅ)?ˆhñz饗“ýޤˌM çïø·3ÞVww7î ÝIô.Í9½^íÛ·Oº @DD´h¼üòË(**Bnn.kºÐ´¨ÕjìØ±Cn!äp8péÒ%ttt`ddÕÕÕ¨®®†N§Cqq1vïÞÍáægà¹çžÃÿðë_£`GÞ„ËŒmñóâ‹/ òhá„ËN5ÂOkk+Ünw¢w›hÎÅsa·˜$a4Y¯~Äï~÷{`Ì(`IÏ%!9Y‘(Š¥»»Ÿµ}–è]&š7“}V0DDD‹FWW×´N‰&" #ôèQ ¢«« AYY***`±X°oß>¶.›¦¤ç’°|ùò¸—ü‡žüüÇDO$%á…¦^GKK‹Ü*èY°”’@ÓÑóÅoðÍ;bøåË=fÁ‹/¾0écsrrðºîõDïÑœ²Ùl°Ùlžt9&€ˆˆè©MVÈ1))IîÊ‘”<¿\ˆ¸°KŠóB˜ÞÝB¢x¥¦¦"55'Nœ@__šššÐÓÓƒ¦¦&455aãÆ8|ø0Ìfs¢C]rþð‡.þïƒp»1ý¿xûJþ§)o±Xø¼Ð’ï…ÝRöŸ¿ºÛÀ×  Ëq¤òßOùØœœü»­ÿ.Ñ»@4çâ¹!ÂÍXRR ^Õj'\FX.àOÿ¹+ ,Ãÿém=þìW±ÌK/½øÏI¤0ˆ)##ðx|„Ösÿ?,[6…WyWŸˆˆhv0DDDqùå/‰·%û©Öñâ‹/àÃ²Ü ç?yò$Ñ»I—ÆÆF”——# 77çϟDZcÇÖœ ‡Ãÿè0ˆˆˆh˜""¢ …Ãaüþ÷ñ»ßçe{OBOðûàãDï6Ñ„Ün7víÚ›ÍAPVV†ãÇCxJEDDD ÏVˆˆhBÁGÀºñ þþïý󲽟þó­'Ñ»MÅëõ¢¦¦MMMƒEç΃ÙlNthDD ó ËñÊ¿P%:Œ ½øâ £Å‰@DD4‰@àþ?®%: ¢„ŸøQ((--Å‘#G R©QBýõšhüðÔëq»Ýp»ÝE¢(ÎZ|¿þþLˆ‚ˆ˜""""Šb³Ùpúôitww# BX,9rdV/N2Óºkå¿Ot1%%%aÍš‰ƒè™§R)¡R)Ÿz=»?ƒÕj…ÕjÅÿ”ýo½[DK@DDDD<.\¸€ææf  , > N—èç•^ÿ*ôúWŸz=•••ò…Ý‘#G½[DDDÏ,&€ˆˆhÑøöÛoñÆo$: ZB<ºººÐÙÙ‰ÁÁAyºN§Cqq1 ¡V«&ÑScˆˆˆÏ¿°/¿üËD‡“°|ž^@qq1FFF““ƒ7bÆ P*Ÿ¾é9=;B¡úúúÐÝÝ §Ó)ÏS*•ÈÉÉAAA222*ѬbˆˆˆÿcF Þ4ˆ³¶¾Ù,èøßÿñ¿Cñ"ð /Àãñ ¡¡ )))r2Èd2A¡P$ö@Ò‚3<<Œ«W¯¢¿¿ýýýò<)é“››‹ŒŒ ¾~ˆˆˆhÉbˆˆˆÿâ_¨ð/fq(×ÿðÚåº[¶lœ•uöööÊ­7úûûa·Û埪ª*( F˜L&¤¦¦bÍš5ÏLÁ^åñxðÕW_ÁápÀétÂn·ÃçóE,£×ë‘™™)'™ô!""¢g@DD´¨¤¤¤ %%‡F À7ä–Ò¿ÝnG}}=@­V#55)))0 xóÍ7Ÿ¹b¾KU<ÉÐh4ظq#6n܈ŒŒ h4šD‡NDDD4ï˜""¢EK©T"##C®×àt:#’CCCèîîFwwwÄã ŒF£œÒëõL ,P@n·ß~û-ìv;œN'ü~Ô²‚ È­ÀL&Þ~ûm&üˆˆˆˆÀ-!J¥©©©HMM•§ ã7¿ùœ8’[ ¼N§‹øyã7 Š"´Zm¢woIÁ÷ß·Û‘‘¹†ÔÈÈHÌV=Àèíz½^Næ½ýöÛHIIa—."""¢˜""¢%M©TÊÝÆ$Á`CCCøê«¯044‡Ã·Û ¯× §Ó12ÔXRAk­V+ÿˆ¢ˆ¿ø‹¿€J¥b½¡ ø|>x<üÝßý]T‚ÇívO¹N½^½^””¹Õ– ðT†ˆˆˆ(~ûÛßÊÇLš&%{Ün7‚Á ¼^oÜëEz½>¢Ö믿NÇDÑSâÙÑ?“ºéõú˜óý~?Ün·ÜUiì4OJ‚ŒŒŒLkÛ*• *•*êoA"ºŸ=MÂHJÒŒ%%uÆóx<…Bòÿ^¯Á`pFÛ•öA£ÑD´žÒjµxíµ×俉ˆˆˆhî0DDD'•J£Ñ£Ñ8á2R«¿ß¿ßÑJfü<ǃ`0Ç#O[褔”¤ÛŠI­VC«ÕB­Vãå—_†(ŠÉ,""""J&€ˆˆˆf‘B¡˜Q- ñ­s¤®Tcýþ÷¿Ù¥j|kéߢèµ×^“ÿ›¼YL]Õˆˆˆˆ(@DDD €R©ŒH°° 4ͦçÑtÙív´¶¶N»îÑ³Š """"""ZTjjj°nÝ:X,ܸq#Ñá- ìFDDDDDD‹J}}=L&>ûì3h4šD‡C´(°-Ò¨š™™™Ðét¤€(NLÑ¢kDL"š@DDDDDDDDK@DDDDDD´è¨TªD‡@´¨0DDDDDDD‹Æ×_ Ðëõ‰…hQaˆˆˆˆˆˆˆ…®®.”——Ã`0`Æ ‰‡hQá0ðDDDDDD´(äææB£ÑàÖ­[^ÎM[Ñ¢ÐÖÖعs'B¡P¢Ã!ZT˜2%"""""¢EaÇŽP(ÈÍÍÅàà Ìfs¢C"Z4؈ˆˆˆˆˆˆ5kÖøc1h"Š@DDDDDD´èøýþD‡@´¨0DDDDDDDD´Ä1DDDDDDD‹†F£ItD‹@DDDDDD´h( ¨T*Øl6D‡C´h0DDDDDDD‹Jii)l6^zé%´¶¶&:¢EÃÀÑ¢räȬ_¿ß|ó Þzë­D‡C´(0DDDDDDD‹ŽÙl†ÙlNtD‹»€-qL-qL-qLÑ‚ áv»  Ñ’À-(]]]xå•Wœœ »Ýžèpˆˆˆ–&€ˆˆˆˆhA)..†V«Ess3ôz}¢Ã!""Z8 <-n·>Ÿؽ{w¢Ã!""Z2؈ˆˆˆˆ•J•興ˆ–&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆhÁðx<‰ˆˆhIbˆˆˆˆˆŒü Õj Ñ’Â-^¯ÕÕÕÐjµxçwÑ’Â-¿þõ¯á÷ûñå—_B¡P$:""¢%… """"Zòòò022‚®®®D‡BDD´ä0DDDDD ÂùóçQ^^«ÕÊbÐD4+*++QYY5ýÒ¥K¨¬¬„Û페îv»QYY‰K—.%:t¢YÇ-6l@(ÂW_}•èPˆh °Z­°Z­QÓ»»»aµZc&€¬V+º»»:Ѭ‘D¥Rü~¢C!¢% Vòrrr Š"DQŒ˜.Š"¬V+ŒFc¢C'šuLÑ‚!%€ˆˆfÑ#GbNÏÎÎFvvvÔtQ'| ÑbÇ.`DDDDDDDDK@DDDD´`(•JÀÐÐP¢C!""ZR˜""""¢C­VÃl6£¾¾ëÖ­ƒÓéLtHDDDK@DDDD´ |þùç(++ƒZ­Nt(DDDK‹@Ñ‚¢V«qüøñD‡ADD´¤°ÑÇ@DDDDDD´hùý~øý~¹Û¨ÏçƒJ¥‚J¥Jthp8øæ›o P(°~ýzƒÁiÇ …àñx ´Z-Ün·ü÷LƒA\¾|@………‰>D4؈ˆˆˆˆ(|>Ün7‚Á`¢C™3~¿n·¡P(Ñ¡ÐvòäI$''£«« ]]]HNNÆÉ“'jjj°víZX,äååÍ86ǃääd¤¥¥@ÄßÓ ±zõjäææÂb±$úÑhµZ\½zÁ`ï¼óŽ|·ÛëõâÚµkF/âb]0ŒŒà«¯¾’ ¶¾óÎ;‰©è¬(Šðù|¸víÞ~û툤ŽT¼U©TB­VË-—€?Ö{~ìº^ýu¤¦¦Æ<CCCøê«¯ Þzë­ˆ‹]©®ÔúHÚ¶t|®^½*Ì]¿~}Ä… ^¯—/, €<_Úçx ØJû¸lٲľXè™ ×ëa±X ×ë¡T*a±XðÖ[oÉó<ˆºº:¨Õj ôôô ®®õõõØ¿?€Ñ®¥‹Á`)))hjjBuu5¾üòKùs¢ºº@¡P###P«Õðz½hjjBii)Nœ8k×®¡¾¾Àh2Èjµ"77YYY°X,°Z­r2çÒ¥KÈËˤ¤¤ ¿¿õõõÐétp:r‘æââb¹èsAAAÄûöìÙ³hiiÁÀÀ@Ü ¶Ê{F…‰ˆˆæ€Õj [­ÖD‡B4/øšm®Ž‹N§ ß½{7‡ÃF£1|ëÖ­p8·´´„„Â*•* ,B¸¹¹9ÜÒÒV(òt¥R¾~ýº¼Þ„Íf³<_úQ(á¶¶¶¨ýêìì +•ʈe äå\.W@Øb±„ÃápÔzÇžŽWUUEÄ l0äý ‡ÃáŸ~ú)l2™¢Ö‘™™~øðaÌmHÛnkk‹Z¿J¥ wvvÊ믮®—––†Ãáp¸©©)\TT4£çRzæâeõLy>[ær»»»Ã¹¹¹áG…ÃápøáÇa³Ù!ìr¹Â÷ïß+•ʰN§ »\.ù±aA©©©ò4éó!777üÓO?…Ãápø‡~ëõú° á~øA^vìû/‡"öó§Ÿ~ «Tª°N§ ß¿?‡Ã?—””D}>LµV«5"ö‰”••Ž^Z<â}±4-:÷îÝ“[Úܾ};ª+GYYªªªàr¹pýúu¨T*”––¢¢¢mmmp¹\èììD0ÄG}$?îý÷ßÇàà ÚÚÚððáCúè#8ôôôàñãÇxøð!ªªªÐÛÛ‹O>ùDÞ†Éd‚V«…ËåBmm-|>ŠŠŠ`6›åõß½{jµòú:„'NöìÙƒ3gÎȱ‹¢8í¶ñ¶F š+MMMP(8sæŒÜ•K©TâøñãÈË˃ßïÇÙ³gÐÐÐñúÞ¾};ŠŠŠ088‡Ã±Þ'NDt“ÌÍÍE(’kìÄ£½½~¿ÕÕÕrëApâĉi ñž#GŽÄõÞbíŸg@DDDD´äX,ìÛ·¢("55¹¹¹¨¨¨ÀÖ­[!Š"¶nÝ “É$_؃AƒAaÇŽP*•P(ذaƒ|¡8~4«’’ìÙ³¢(Âh4âøñãu±(EQ¾hÔjµE¡PV«z½Ÿþ¹|á·aÃ455É5D`xx*• r½žÃ‡ÃjµÊÝÀDQ„B¡€ EjµCCCƒÈÌ̔ׯ×ëÑÔÔ„ŠŠ 94™ÂÂB È]R&#Õ b7J4§Ó ƒÁÕmÑd2á³Ï>ƒÑh”߯ëׯz|ff&€?ÖµF›ã4:nÚ±Ùívˆª“%„Ý?gÊëõ¢²²½½½¨¨¨˜ÕuÓâÁ@DDDD´äŒ¿x’Z¢¼óÎ;ÓA@0( |ùå—óÝn7¾ùæ ǵéܵ— Áçó!'''*Á$Õ;êïïǾ}û`2™`³Ù°víZäåå!++ ƒGŽ™tƒJ¥åååBff&6lØ ÿ̦ááa´µµ!33“ J8¯×;e±u):¶Ø³äå—_–×#‰µÜLHï÷X5µfk’¾¾>X­V”””`÷îݳºnZ<؈ˆˆˆˆ–œ¿ø‹¿ˆ9}ª‘o|><ˆU«VaùòåHNNFNNœNgÌåg£È±T0¹¹¹ÉÉÉ?+W®ŒXæðáÃ(**Âðð0ÊË˱jÕ*¼úê«8xð`ÄPóã©ÕjtvvBE477#77¯¼ò 6mÚ4awµ™°ÙlX¹r%DQÄgŸ}6kë%š)µZ-'yÇ“’:R²%Ör?þø#€™%w§"µ›\’ÄÓ*o:222PVV†††´··Ïú¾ÐâÀF/þÒÒÒP__ƒÁ€úúz à‡~@IIÉœo¿¸¸1¤º :t_~ù¥Üå­»»{ÖöåÊ•+ظq£œœ"J¤¢¢"ƒA|üñÇðx<(//ŸõmJÉè«W¯r8øgkѬzíµ×¿ýío Ñ‚¥×ëQ]]þþ~üú׿FRR^yå477£´´4®®™Ó•‘‘½^¢¢"$%%%úÐi1DDDDDD³J¡P```'OžäÓDSÐjµØ¾}û¼mO¥RÍëöhá`ˆˆˆˆˆˆfN§Ã§Ÿ~šè0ˆˆèŸ±ÑÇ@DDDDDDôLp»ÝP(Ðh4p»Ý!f½P(‡Ão¿ýðæ›oÂh4ÎÛw^¯¡PZ­¡PGŽu²¸'ãóùäÿEQœ—}¡…ƒ """"¢.Æ4  E¢Ã™U~¿~¿Ÿ˜´à$''Ãl6c``ÉÉÉE.—+b™ÆÆFTUUÁëõFL×éthhh@FFƜǙŸŸ·Û —ËÇëDqOåàÁƒhii‘ÿ‡Ãs¾´°,È.`v»Á`0æ<›Í›Í§Ós¾ÃáˆÈjÎ…©bX¨ìv;l6ìv{Ät¿ß/ïS¢*ÁǃßïŸÖq÷ûýhmmÅ¥K—²_DDD”XÉÉÉHKK¤¥¥!99yÚë8xðàŒ' ñî»ïâ•W^Arr2vîÜ™èÃ4+ÇIràÀüéŸþéS­ƒ(Q¶mÛ†’’ˆ¢ˆ¶¶6ܽ{wîÜACCü~?6oތ˗/':̧200€D‡A ° @ùùùQÙVIkk+jjjpàÀ¨y>Ÿk×®ÅÙ³gç4¾Éb˜gÏž8‘DMMÍ”ëêêBcc#òóó#¦{½^´¶¶âÀhmm+†]»vEM;xð B¡ÐŒö)ÞœNç´Žû¦M›àt:ñ«_ýjFqÑâæv»áñxgF7»|>ߌo’íܹ¥¥¥ÓÚÛÛÑÛÛ‹ÌÌL´´´`ß¾}‰>L³rœ`hhõõõÈÉɉhi@´H-î”J%T*•<ýôéÓèììDNN®_¿Ž;v@¯×Ã`0`ß¾}€ (**š°ÁÂ\Ðh4AnQ§R©"âž.³Ù ³Ù¬]»«W¯ÆŠ+"ÞœĪU«°råʘ-k¦#`çÎXµjV¯^ýÔÍÒÒÒ°bÅ ¤¥¥ÉÏ‘B¡€Ïç‹XVÊ‚{½^lÙ²+V¬ˆ:iii¸zõ*Ö®]‹ääd\¸paÊFFF°eˬZµjZM¤ƒÁà¼i#""¢…iì…’^¯¸hr»Ýðûý…BèëëCkkkTWùÉøý~\¾|­­­¸páFFF"æ»ÝnƒA„B!y[Òo vË"ŸÏ‡®®® c p»ÝrÚööv¹X¬ÛíF ˆØ‡ÃñXiÝãcÕëõÐét1“÷tÊ,Ì4D4×ŠŠŠ°yófùoé´Óé„ÇãÁÆ¡V«'|ü‰'póæM9qtöìY”––âÝwßEQQúûûÑÜÜŒôôt´¶¶bíÚµ°Z­°Ùl¨¯¯ÇÚµk#’@]]]X¹r%êëë122‚úúz¬Zµ**™S\\,Çm±X——'Ï;{ö,,‹|­M4‘9¿:¶ÛíHIIËåBcc#8€+W®De5½^oD3ºþþ~ܺu _}õ ðàÁƒI·³uëVlݺéééQ_N»ví‚Z­ÆÝ»w jÛ±;v ƒƒƒ¸uëT*UÌ»7㉢ˆ¨T*Øív¼÷Þ{ÈÎΔ––âÔ©S0›ÍݤÑÛÛ‹Û·oC„¸›:N¹«Ôàà <ýàÁƒÐétøì³Ï0<<Œ´´4¸\®} ƒAlÙ²Ÿ}öÌf3ÚÛÛ±mÛ6¸\.ˆ¢ˆP(„ÊÊJø|>|úé§ò6òóó‘››‹‹/bhhëÖ­Ã;w Š"<ªªªpåÊ c×®]ؾ}û¤q¼÷Þ{¨®®Fvv6úúúP]]Wü@€'DDDÏ8³Ù,·úIMM8×JNNFqq1144¥R‰@ “É„‹/B£ÑL¸ÞÊÊJTWWG»àܹs!¢Nrr2¬V+¬V«}òäIX­V´´´LÙª'Qõ$‰âµÿ~ùï±=G¾ùæˆh/Ç­V‹@¥Rahh«W¯†ÅbAQQ>ýôS( \¾|›7oÆéÓ§ñé§ŸÂëõÂb±ÈבZ­Á`;wîDgggDõ±]EÇ÷xÉÉÉ(Š,ºNSšó@'Nœ€ ÈÊÊŠ¸ 1™'N@¥RaÆ ƒ3þ2ñûýèììDmm- …<äßT:::pôèQù„!ž!ö´Z­œ˜ùöÛo#¾`M&>þøc´··G´LE^¯Ààà`Ü#@HwbÜnwÄv:;;¡P(ÐÚÚŠßüæ7P(qóñ´Z­Ü,yÇŽ…B†B¡€ÇãA?zzzàv»¡Õjá÷ûa·Û±gÏ£wÝ6n܈7nÈë=uêÔj5ŒF#***&ahh@@N¤½ð qÅ~àÀ9qDDDDÏ®ÚÚZ>|pøða=z4b~SSDQăððáC´´´ÀápLÚ긵µV«yyyxðàÂá0îÞ½‹7¢­­Mnîr¹`2™ Õjár¹°ÿ~¸\.¹&Ðõë×åQ|*++QWW‡¼¼<Ü¿?Fgg'¼^/ÒÓÓ£Z^WUU¡¢¢MMMçSuuu0›Í¸{÷.îÞ½‹””Ô××cÛ¶m¨¨¨€ËåÂõëסÕjQVV&'zŽ?Ž#GŽÈÇéøñãò:EQ„ÙlŽëšh±’¯3íAP[[+_;ŽíZ&]‡@VVÈ-€ºººPWW'_oJ]Цs#;;;GŽaˆ¦4ç  ™¾Æ>N„¯GúR›îКÁ`pÚ}Ä<ˆÊÊʘóΜ9ƒ²²2ôôô 99Ynµ£ÕjqçÎhµZ|ðÁHOO«²ÙlÆ‘#GpäÈ‘ˆº9ã»=UUUE4áŽP(uÜ B¡4 ¾ûî;9‘sõêU‚€@ Õ×~üs7¶èÚTw‘|>ߌžûC‡¡¼¼uuu3Úw"""z6¨Õjœ?^Nn¢¤¤ýýýŽ<êñx’’‚S§NÉÓëõr‹éæ›(Šòy‘(ŠP©Tòo`ôŸ …"®›§D ÉÓ–ŽÍ¥T*#Þï±HŸ1ï¼óNÄt•J5£–HDS™×"З.]’[“(•J¹[Õààà„­T®^½ •J5ã/­V ­VQ÷'ž‹Ñhœöcº»»QQQÂÂB¼öÚkóA@vv6Ο?‚‚\½zUž§ÑhpèÐ!ܺuKî{:SF£QN¬H?3½[£Óéàp8äx‚Á ”J%êêê››‹‚‚´´´@EhµZ( ùΗ×ëÅàà`Ô‡Z¼ ¼^/ü~?‚Á`\£IÇ4##ƒÍ‰ˆˆhR™™™QwÚ333 â|m¬Ã‡ãÖ­[òM-¿ßÁÁAtwwÏ(†7n  "///ê"4;;J¥ýýýÓ'*=~à‹×_=æô±±Ï‡ÃŽŽäää°#-:o¼ñL™õù|1kíLV7h"Ò5f¬Ç²5Í…9ÿdv»ÝX»v­ÜŠçóÏ?0úeV]]ááa„B¡ˆ §(ŠØ´i´Z-|>Ο?àC€KÝŸÒÓÓa±XPXXˆššôööÂét¢ºº---òÝœóçÏ#?? …B(((À‡~8iܵµµÈÏÏÇÊ•+¡R©`2™pâĉIc°X,°X,ÐjµP«Õ'¯¾ú*t:B¡ü~?.^¼¸p᪫«¡R©àóùäþ›3õé§ŸbÛ¶mhii‘ 5ß¹sžžŽ`0(7%ÎÌÌÄ¡C‡ÐÚÚŠ––9Yb³ÙpâÄ FTWWcݺuÐétðx<8þ<A€Z­†ÛíFvv6A€Åb‘³ÞÍÍÍòÿn·SîÓd1”””`õêÕP((**BOOÏ\¿l‰ˆˆè!>KJšLVôX:wq:re&€äb¯±nÚIç]ã ÂŽ¿Ù(™¨µÁ\'dZ[[a±X““ƒ3gÎÌ鶈æ‚Ñh„Z­F?B¡Ð„ï™ööv”––¢ººú©G†–¶áóù¢>?8¢Í…9O‰¢ˆ+W®È݆$:.— >Ÿ/*9000¿ß@ ÑòÇh4b`` æv:4á055÷ï߇ÇãR©Œ«k—N§Ã­[·¢¾'‹áðáÃrA®ñ_à÷î݃×ë… û´}ûvlذ@*•*®ØÎ;ñ¿ÔÒGŠïÞ½{r"eì±(î±oß¾}(,,„Ïç“›#»ŸI>|(ÿ••—˯ו“ú¹O'†ÚÚZ|øá‡P*•P*•S&ï$J¥2î¢ÚDDDôlŠu®0¾ÞÎx•••°Z­0™L(++ƒÁ`À[o½%ßœ.©5ÎD-ÎC¡Ð¼_?]o½õRSSÑßßßüæ7ذaC¢C"šAPTT„êêjÔÔÔÈµÃÆ ¨¯¯—»h>­””477ãÚµkë ƒp:ІfݼtS«Õ1ïhHý"cyšn_ÑjµÓþòÔh4ÓêB5Ñò …Bî"ëøLÕ?tºf³ ¼ôÁêÕ«qùòå9}çΓ³•;v k×®åç%=sÆÇ,ùú믌vE¥ººz½ׯ_ÇáÇ‘ Qñ»ßýnF1H]Ob•Dðx<ðx<1[*-$F£ׯ_‡Ñh”‹\-6‡‚(Ѝ¨¨ÀÁƒ#’Á‡ééép»Ý(++›•÷äöíÛ¡R©PVVQdü¶§réÒ%TVV²üMiÎ@ü DúòË/a4ñã?&:"Z¤Ün7¢án·6›mFM´ËËËát:ç¼P½ÝnG[[Û”ƒTTTÀápàØ±csÑBÓÛÛ »Ý.ÿ/ÝáW«Õòˆ=ãƒÁ¨A/‚Áà„ïé©jIFF´µµEÕùøãŒ/Ÿ(Óù¼3›ÍšÕÚBDóE¥RÉ×uuuxå•WœœŒW^yk×®…Ãá@iiiÔh‚O³½ÎÎNø|>¬X±éééX±b:;;§•`êîî†Õjeˆ¦4ç]Àöïߟè}¤g˜J¥šr¤1"¢É466" aß¾}³¶Î¢¢"´´´ //oÎcW(r÷ä‰(•JX,ttt$ô"“( 6mÚ‹Å•J…¶¶6x<tvvN8Šlnn.:;;±mÛ6dffÂçó¡­­MN½“¯V«a³Ù°víZäååMØ•ýÌ™3HOOǺuëPPPµZ-'§òòòf¥»ÉLIÃÞ·´´Ly^%¿ß¿à»­Å"•¹|ù2l6›œÌE[·nj8Q W‹Å3jµZ#–ß°aîܹƒ³gÏÂãñÀd2aÏž=¸víZ܉T)ަ©°wî\T9¢gAnn.L&`0pþüy˜L&y½^1ê–4T{oo/4 ŠŠŠ°oß>ìÚµ+¢xôñãÇŒŽ,$µ Ef³9"Á”’’‚;wîàØ±cèííE(‚(ŠQIF³Ù•\Q(0›ÍQ€*• f³9ês@Š!ž$´l<Ÿ%¬YBK4‚svvö”ËN´ÜDÉÒ±uT%¢(Fµ*šN2'ÞX‰˜"""š@{{;ü~?JJJ&\F§±±N§»wxF»P´¶¶FL3ž°UVVÊóÛÛÛÑÓÓƒP(³ÙŒ={öLY—­µµÁ`0fK\§Ó‰K—.Å|\vvvÄÈœÀh"ìÚµk„Ûí†×ë…N§CfffTüÇŽC(¡C‡¢ZO„B!ÔÔÔ@„ˆFFFÐ×ׇ¡¡!yÀ£ÑˆÂÂÂiÕá#š©={ö`Ïž=Î?؈R©Ä‰'pâĉ¨e?û쳈ÿu:< ®d¢Á/DQœr­ŒŒ dddDM×h41ü˜h“Éàxšeg:ÍŸXѳ ""¢ 444@«ÕNXM¦È#Wöôô ¥¥===in·V«5ⱋeÂÕjEAAš››ÑÓÓQáóùÐÙÙ §Ó9éEb(BCCRRR¢QÀhÛñ±HDQŒJÙívdffFŒd988ˆ¦¦&äååáüùóÇ£³³ƒ!ªËÊÕ«WQQQÕõíý÷߇Íf“GŽ èèè@uu5nÞ¼9«­¯ˆhnI-€¾ýö[^\-PÉÉÉ€p8œèPhžÍË(`DDD‹Ýn‡ÓéDIIɤ­m¬V+RSSqÿþ}¸\.¹¥NYYYÄrf³ápáp8æÝøX:::àp8póæM¸\.Ü»wÍÍÍ“ŽréÒ%x<ž [.ʱH?---®OEôôôàáÇp¹\r,:NŽQRTT1××ÖÖQ--ÊÊÊàr¹ðÃ?È¿«ªªà÷ûQYY9Ï.Í•õë×C¥R!77éé鉇ˆÆ8tèäzö,™Óéœpd»Ý›Í›ÍsþðððŒFqI4ǃ‘‘‘ÃDÇ=ÑÇ! ±±qNcFï’ƒÁYY×É“'QYYuA$ ý¸‡ …BQÝ^â ÑÕÕ…öööDï=ƒNž<We³ÙŒ‹/Ê]•²²²äQpžöý¨P(ðÅ_È­x4 rssĺZÒÐеZíÛ·ÏʱEYYY]º´Z­œ`úæ›oäé6lk£Œýn èìì”k‰Œ•••ÕR@ênkXl¢ÙbµZ‘“““è0–µZLÙU•ˆæ—TÏLú¡gÏ’I8p}}}1çuuu¡±±q»[¶l™—;Œ{÷îöcŽ;6arjï޽ضmÛœÇ=™÷ßÊæúîO<1IJsçΈ"¡P§OŸÆ–-[ðî»ïF½&*++§(ôz½HKK›°ÖÆtÕ××C©TF](ýêW¿‚(ŠèèèXp èé鑇±Ž;w¢³³“õhÞI”óòò¦|ýźÈIII0Úâi¤¤¤Èë’LÏÐÐl6ŠŠŠ&Áh¦ü~ÄM•XŸ‰‚  ¨¨¡P("y{áƒAO»ÍfÃàà €©‡Ï&zGŽaáÔ9`4qêÔ)|ùå—‰…ˆˆÆx&Òòµµµp»ÝèììŒ9ÿâÅ‹órÙÔÔ4íQ_š››±cÇŽ˜óN:5k-KfêÌ™3 ?9ŸI RqÔ±?ùäô÷÷ãðáÃP*•øñÇ#ÏЧãi4ܼy3êîilݺ5*”ššŠÔÔÔI»p$Š 8wîV­Z…¬¬¬˜õH&âp8pçÎŽ(BóîôéÓO5ô»ôšMDëÒÆÆF‚0iAÛéòù|Ø»w/º»»ãú¼Ý½{7¬V+ÚÚÚä!¯¥!²c}޶¶¶¢¼¼|Q¶Æ%"""Z,d  ´´4\¸p+V¬À«¯¾ŠË—/íÊ•ŸŸ//wðàAœú+V¬@rr2Ž;6åúòóó±råJ¬ZµJnñpðàA¹ÐVrr2’““qðàA£'ÕiiiX¹r%V¬X!oçäÉ“HNN†ÇãAZZ’““‘––&oKú?V«ŠÖÖV¬Zµ ÉÉÉØ²eË”q¯[·v»]þÿرcr‡iiiX±bÒÒÒ"–“bøè£¢ŽÃûï¿U«VaåÊ•q=çùùùØ»w/V¬X³gÏbÅŠòóÞØØ(¯kݺup:F»~MC~~>NŸ>µk×â׿þ5NŸ>1¿ºº:j¨E›Í†Í›7Ãl6#%%E.Þë¹^‡Ò´³gÏÊÏ»Ô]Az\~~~Dǃüü|TVVâÕW_źuëäV;ÒkhõêÕX¹reÄke¶IÏQrr2Þ{ï=¹žHWW8€>ú¯¾ú*ÒÒÒäyƒƒƒHKKÃêÕ«åײôšøä“Oä¸7mÚ±-¥R‰òòr|òÉ'ÓŽ“Éšo¡PMMM0™L3NÞJ­ _{íµyÝï÷£­­ ›7ožÕâ«ùùùèììDii)îܹ#ת««‹¹¼V«Eff&œN'œN'Ün·ü;~T¯¾¾>X,¨T*ôööÊëv¹\óz숈ˆ¦â÷ûáv»"þ;/Ñ7ǽ^/Ün7‚Á |>Ÿü÷\¯c¶÷? É#J{<ž„×¥bA&€<ÚÚÚpëÖ-´´´È%ƒÁ`ÄÝAŸÏ¿ß/ÿßÙÙ‰óçÏãÎ;°Z­S¾@L&\.,KÄz€Ñ$Èàà nݺ—ËWË)Ép÷î]ܹsGn]R[[+ŸÈJ'µµµµF/nÏŸ?»wïâúõ먫«ƒ×ëÅþýûár¹ Õjqýúu¸\.\¿~]Þ–Ëå¹sç¢î–^¾|V«/^„ËåŠ9<éx©©©réÂ'++ Á`[¶lÁÑ£GqïÞ=cÛ¶mò›ÚårÁjµFÅðÁ@£ÑàÎ;¸uëV\ϹÃá»:ôöö¢¢¢ÝÝÝFëIܺu wïÞEnn®œôÒjµÆàõzÑÒÒ‚+W®àâÅ‹(//—ç #D]Ø•”” ¢¢üqÄk'Ös!x …`·Ûáp8pûömäååÉIéq¢(F|`†B!tvvB©Tâþýû0 8{ö¬üR*•¸}û6>ÿüsùµ2ÛöíÛ‡;wîàÞ½{P(òk ÈõCîß¿µZ-'HóóóQ[[‹Û·o#330™Lðz½¨ªªÂõë×q÷î]|ñÅQÛËÎΖ‹ãÆ# FtÑ#š/]]]ðz½“ý>•ÁÁA‚5šÖ\kmmE xªØÇóù|èïï‡^¯Gmm- DQ„(Š“¶ž•¾»[[[åÏiÚXÒg}uu5222äusô ""Zh¤¼]]]—è$E~~¾|“Vjˆ0ö&þ\­c¶÷_ºÙŸŸŸq㟞΂LÀ‰' R©°aÃÁ¸ê𔕕AEh4Füæ7¿™ñö;::pôèQ¨T*‡½Ìš5kÐÛÛ‹ÊÊJ ÇÕrA¡PÀï÷£µµ}}}᩺uµ´´ ¬¬ :â:Þ½{7:;; qíÚ5ùø9hµZ¹@ØŽ; …0<<<éú:;;å&ÿñ¶Þ…B(,,„B¡/¤D(Џzõ*Z[[áóùâN TUUA­VÃd2E$ø¼^¯||ÆÊÊÊÂíÛ·á÷û±jÕ*|ðÁqmG­VãÓO?•‹ÅZ,–)£Õjåc¤ÕjåJ¿ß/3•J5§]üDQÄ… ÐÞÞŽP(q\M&“ß‘#G°~ýz£É!é‚ol|*• {÷îÅÕ«Wc}Ôh4P*•q})H­ØÆ¢D4 Ñh¢†0×… `·ÛQPP ‡Ìgìz½6l˜õu‡B¡ˆîàà`Dr}¼ììl¨Õjtww£³³Z­VnY9~½">ïü~?víÚ5¯ÇŽhìEŽô·ta7›ºººä¾Rkôé¶ölÒ<ébMºpЧuü\šý&ZȤAf»þÞbñ¬ïÿb±`@c/ A˜Ñ(O3ò@0œö‰»ÙlÆÍ›7 …°iÓ¦¸.\À¶mÛfíB?LûM§×ëa0pùòåˆW¡P(j] …bÊ@@NbL§  ô|½ð Óß}÷]ùñt,[¶lÚÑétøôÓOq÷î]twwËÝÐ&£P(äØ5MÌ œx¥¤¤ ¹¹ï½÷ÒÓÓ'ì^ñ´¼^/V­Z5áèicß;F£QnÅššŠ÷Þ{Û¶mCOO\E¡PàæÍ›HMM…ÕjÅêÕ«£ZÕ±_S±dgg£¡¡ s²ÿDq:œVåòòräççã£>»ヒ¼¼<¹µÌX555HOOGzz:8èíí•§ÕÔÔŸ|“Sêj=ëæIç–R׉XßËói6ö›(ѤsF#wi–¦b`` ª«ó|“ˆ¢(_ÏN·¤‚ôý>vS]ÏöþÝ®V«… q5Ê É-ø"ÐW¯^•Ÿô±_^^¯6›-fk ¯×‹¡¡!¼óÎ;3Þ®ÑhD{{»|á …âJ(éõz=z;vìÀºuëðé§ŸÊóA€×ëxSôöö¢¸¸{öì‰ÙgR¥Rá›o¾‰»)¼ÉdBGG !BÜq[,477ÃétÊ…ªu:<´Z-‚Á äëEƒƒƒ0›ÍO}gÇçóÁf³áË/¿„ qÕbšŠ(Šp:QÇ& Êà*•*êƒR©TÂívÏi·„––Ô××#++ *•jÎ2è_}õ´Z->ŒP(W‚ÍëõÂn·ãÞ½{QÀ*• {öìÁž={°jÕ*8Έá%=AˆëKA¥R!##ƒÃÇÒ¼›NåÂÂB„B! Ân·Ãn·C£Ñ ººûöí›ôdK¥RM9üªÙlŽÙ…LºÃ6þD¬¡¡J¥rÚÅêãñùçŸãÀèïïGuu5ŒF#ÚÚÚðæ›oâÀ¾¯wïÞ-×@Û½{wÌe²²²ÐÔÔ„††ÔÕÕA«Õ"77Gt$L¢Ù&}ç*ŠˆÖ®³m캥ωé~ßIëP«ÕS®CE„Ãá¹?€SŽ¥Z­–5¿çi±‘®ƒÞxã ¼üòËòßÀèM¤¯¿þ[·n8¸zõ*z{{áóùäîá;vìßíííP©TÈÊÊŠÚÞåË—°}ûv£×+.\€Ãáoº§¦¦bëÖ­òûÉh4Ê£KçS]¿g4ÑÝÝ Q¡×ë@þ=‘‰ößf³áêÕ«r/€””lݺ5âÜ¡µµo½õü~?ÚÛÛ!Š"öìÙ­V ½^A`0æ½kýR´`?u7mÚ­V ŸÏ'×[IIIA(ÂÚµk b4!N‡ŠŠ ´´´Àëõ¢©©IþrLOO—§§Ãh4âĉèëëCuuµÜ½Ìf³áĉ0¨­­• :«T*˜L¦)ëé|ðÁp8P(rM”±ÊË˱zõjèõz˜L&?~›7oFqq±<²Êø‹ê²²2X, ‚€/¿üN§ m¥§§Ãb± °°~ø!’““!Š"B¡nÞ¼9åñÞ¾};JKK‘““#¿aµZ-ª««±nÝ:èt:x<œ?‚ È1x½^x½Þˆ¬V+òóóå" OC­VcãÆX½zuT=Éb˜Œ(ŠÐét¸|ùrÄЯëÖ­0z‚2<<ŒœœœˆâÒÒRäççC¯×CEœ;wnÒíÔÔÔ ··WŽS¥Ra```ÒǘÍf””” ªª @:çΛòwºÞ~ûmx<¬[·NÞÎT4 ´Z-V®\ …B`0ˆœœœ:u ƒƒƒØ»w/Ôj5ü~?´ZmÔh_.\@nnî¬îÑl’ (çääÄu‡IŨbò“9tèPÄȃS™èó¢°°0êsndd===())™qátéN|¬Ä³F£‘¿‹ã=Yœês€œ</ž:vD³eìEŽT'ðÍ7ߌXÆçóáÆðûýxíµ×šš3‰144„¯¿þ¡Po½õVÄùËš5käíĺ°òx<…B“Þpzë­·ŒžÿNuq …àñx R©ä N·Û-ÿo³Ùðý÷ßC£Ñ`ýúõŸ^¯Á`0*–@ ŸÏF…B!ŸK_Îï÷Ãï÷C¥RÉ1 ùbtº¥D‰¶fÍX,¹žt—.]‚ÕjÅúõë¡T* …ðî»ï¢¿¿_®mçv»ÑÜÜŒªª*ܾ}èïï—koJ|>rrr——‡íÛ·cddéééðz½r’Çét¢¡¡›7o–kp®_¿^n üöÛo£¬¬lÚ7•ׯ_ÒÒRùïxÖkÿwîÜ‰ŽŽyÿ=ZZZPUU…›7oÊŸ‹¹¹¹èé鑯۷oߎ’’¹QGQQ[φð$ŠbøöíÛáû÷ïGÍ{üøqØår…?~5ïáÇΛ©„Ë\.WÔñ.)) ›L¦ˆ8µZmÄçˆÙlŽËømäææ†„›ššäe>|Öéta•J%ÿ †ðíÛ·£b¦É-–÷г¾Ò>H¯÷†††0€puuuÌåêêêÂáp8ÜÙÙnnnŽXNz¼ôù°yóæ° á›7oÊË}ýýýr} IWW—ÖÖVTVVBEùu&½¶Ç?ïÁ`Û¶mCuuõ´»Ï™L&¼ÿþûèë뛓ãM4Ö‡~ˆp8ŸÜqª’B¡ÀÑ£GgôA~îÜ9\¾|yÁ}¡-vF£òɦÔåWýˆ"Y­VhµZ|þùçò÷Þ† pñâE¬[·5558sæŒ,·ö;€Âðð0>øàƒˆŠÁ`€F£™ñûvºnܸ5“ÙlŽ™ …Bøè£ÐÔÔ$ß¼Öh4rËÅñ=zÚ³bÁv#"Z*Š‹‹ñë_ÿ;wî”/ˆFÃäѤé%ñ¥»õÀhkŸ²²2x½^X­V¬[·¯¼ò öîÝ+w÷X(fZ0~2LJJ¥B @yyùœlƒh±8pàš››‘——‡ëׯã‡~Àýû÷#F‰–F¤¤¤ ­­ Àh÷/³Ù,·ìƒØ´iìv;êêêpûömB]]rssåýðàAÌý§ù³ [-5Á`mmmhkkƒ(Š(**Baa!ë­-rc»w ‚€ÚÚZ=zW¯^E?zzzÐÔÔ„ÞÞ^ܽ{wÚ£ñ,&ðûýUUUÈÎÎfˆžYòˆ¾c}óÍ71—·X,())ÁéÓ§áv»aµZåy‡¥¥¥Q- Nç¼í“N§‹{$®ÎÎNh4š¨ý_hÉðg [Í3·ÛŠŠ $''ãÝwßEWW—Ü4˜ˆˆiˆg‡Ã5/ bxxX¾ êëëÃ…  P(••…'NàÞ½{ÈË˃Ûíž× µÙ0Q«'©ÅÓXN§0›ÍèèèÀðð0>úè£DïQÂ(•Jx½ÞˆZ–eee1—ß¾}; …Üznl)q<þ½wõêU¹žßï~÷»)cr»Ý¨¬¬Ä¥K—æeÿý~Äþ{½ÞšE”f|1iš@DD  …ÐÛÛ‹ÜÜ\¼úê«8pàÀ¼õá&"¢ø¨Õjlܸ½½½Q’;†@ €¼¼<@]],KÔn©L<].ívû‚é.,µR½zõª<ÍëõÊÝT$Á`;wî„ 8wî¶nÝŠÜÜ\444àòåËqmk!í7Ñl°Z­X½z5òóóñÞ{ïaÅŠHMM…J¥ŠäD­V#''~¿yyy­çRRR°qãFôôô`ÕªUصkÖ­[‡Í›7Ë5yâI„H-‹º»»ç|ÿËÊÊ åýß²e V¬XN­VûÔç¼---°Z­LM»€Ñ”B¡ìv;RSSŸz]v»Á` …"bÃx566b÷îÝrÜétÊw§|>ß„EÅâá÷ûå;s¢(FŒ¦5<<,H›L¦EÓ|ÛívËŠF£qÂ;yÒ2Ò>Ûl6F¸Ýn( yhi¯×‹¾¾¾I UÓÌø|>Ô××£¾¾)))òÈ),MD”x§NBZZ6mÚ„‚‚hµZØívôööÂl6cß¾}FGÒÚ´i“\Z©Tbhh(((ˆ«ëD~~>Ün7Âáp¢wÛ·oGSSrrr`±X :::¢Šµ~ôÑGBCCƒ|.qêÔ)Øl6áÎ;S&¿Ò~͆={öà7Þ@WW4 :„ÔÔT˜Íf¸Ýn„B¡ˆb쇂^¯9zÞ•+WÐÚÚ*'¢srrpñâE¨Õê¸kú‰¢(?× ñÚk¯Eìÿ•+WššŠ .`xxX¾.´Z­ÓhÆb±È#'Sü–L( âäÉ“ò"33Sþ2ž©cÇŽ!++kAIçv»qáÂ:thηuùòeäääàÖ­[q'X.\¸€?ÿó?ý©«« n·‡.—kZqTVVbhh{öì‘§oÙ²/^Dkk+4 Ž?`ôf}}}T³ÔŪ²²2¢õBáp8àp8PZZŠÜÜ\ìÞ½{Æ#©ÑÓÓét¸uëjjjÐßß`0FƒúúzìÛ·O¾€3›ÍÀÉ“'ÑÙÙ ËÅCYl¦4 Ìf³|A¡PD“•âŒuN4þœ755½½½¨ªªBOO”J%***ðöÛoãàÁƒP©Tr×6‹Å±jµ hjjBkkë”#¡™L&ÞÉŸg]]]Ý‘¦{nN‘¤›Åc:f³9æ9ÜŽ;b®c²wAÀîÝ»#F“Œ½n™Œ(Š0 Q#Ε‰ö|‚+ÞøÇ¯£¬¬,îšD4jÉ$€Þÿ}£w^€øú@N¥¹¹ï¼óN¢w-&·ÛÞÞÞyIeeeáúõëÓj]#ݯ¶¶n·éééÓŠahhmmm¸}ûvÄ–V«…Z­†R©Œ˜ÞÒÒ‘êííÅÛo¿=iH¯×ãܹs¨¬¬Œš'}ØJ}lç‚ hkk‹xN@Tsó醇ŸîñV©Tr+§±­”J%Ο?ôôtlذ­SæØØÂу/^ä—Ü4]½zUUU(//9DéBÖÕÕ…††ÔÖÖ>UëÆ…Ìf³áÀÈÍÍ•¿¿iv âìÙ³F/ÄkkkÒ¢§Õjã½&55õ©ZMŸ?þ©âÌÈȈø¼Óh4ò 2Éøÿ%±†mß°a6lØ5}ì:&ZßöíÛc¶dˆåÔ©Sèíí}ª}§é LºÍ‚@ Aàt:¡P(ô###èîîžð=;ÓýF¿ÓA˜·ÑE?þøcózdš–L »Ý޼¼<˜L&˜L&ù‹ª±±{÷î•—óxø+W®ÄŠ+PSS#ÏKKK“ûÛív9†´´4äççÃn·#99ÉÉÉèêêšt;ï¾û.*++ñꫯbõêÕr1»ÝŽƒ¢²²RÞWiÈÓƒbÅŠعsgDö®®.ìÝ»ùùùxõÕWñÞ{ï! Ê1uvv¢¬¬LŽo*'OžÄÉ“'±iÓ&¼úê«øàƒ"æ×ÔÔ ¬¬,ª‰_NNÞyç¬Y³%%%q½V±nÝ:¬Zµ Û¶m“÷u¦jjj°råJ$''˯‡™P(ò¨ÄëõÊûl·Û±nÝ:¬\¹iiirw5ǃ´´4œ={+W®ÄªU«â*2i³Ù––†U«V¡¡¡!b^ii)ôz= £.šõz=rrrÐØØµÎmÛ¶aÛ¶mOu<)Rjj*ZZZpóæM&f ¾¾N§3!Éü®®.äççGõñWuu5FFFd+ÔÙrìØ1¹p,Í®ï¾ûN¢Wj‰B´íÝ»¥¥¥‰ƒhÚjjjðâ‹/Ân·Ëõx*©5ãl&iNŸ>—^z 6›-ªvÑ\:~üøŒ{I<Ë–L¨¤¤‹Ÿ|òIÄ}vv6ÚÚÚà÷ûŒ&o¤.v»===¸}û6îÞ½‹S§Nöïß—Ë­V‹óçÏÃåráúõëFkÎTUUa``wîÜÁÈÈNŸ>P($·Þ+yyy¸víÚ¤qüñǸsçnÞ¼‰––¹*»Çã‘“ Á`PNÀ\¿~çÏŸ‡Éd‚Ëå‚Ëåš²;ŽTlÖï÷Ãår!//O™! ¢©© …BîÞ$Ý5¬­­•›ƒŽMl477#77.— >Ÿ—/_–cÊÍÍE]]ßTü~?êêêpâÄ Ü½{mmmUî»»»‘õ¸ììlF †¨ù­­­òtæóùŸŸóçÏãÎ;EüñŒ_w­­­èííÅ­[·p÷î] G$ñ¦C£ÑȯÓM›6¡½½Á`jµ@ï½÷Ž?Ž»wïÂb±È‰©F“ÃáÀíÛ·‘——‡O>ùdÒmy½^ìܹ§NÂ;wPTT1ÿþýP©T0›Í1k5åää §§'jºZ­ž·¬ÿl8räÂáðœÿL—F£Ayy9îÞ½‹ëׯ£°°ý›g`dd===rŽùÖÐÐ€ŽŽŽð&½§KJJæ­™v"X,(ŠÂLDsïСC3êB”hYYYhjjBwww\­m¶k™¾óÎ;hhh@wwwÔïsi)ŸÍ¥%“Ú¿?®\¹‡Ã+VÈÀZ­f³íí퀎޹€­(Š8pàãz3\¾|¢(âÒ¥Khoo‡V«•‡Õjµ0™LÐh4رcA˜²uIww7öïß/7—ËËË›³æ¯Z­'Nœ€ ÈÊÊŠÎÔh4Ê]>üðøºJ¤¦¦bëÖ­z½>ªõÊtÁ`0@©TB¥RÉ /¯× A¢ NE*€ìv»å °k×®A¥RáÚµkhmm… OÕŪ»»EEEP*•P(())yê,|>Ÿ\0òÿñåxõz½Ü­n÷îÝðûýr³]µZO?ý …………(((˜t—/_Fjjª<´ít¿Þxã¨N€ÑæÛR"•¦G9±vÿþ}?~|Ò.‹4µÓ§OÀS׃K„“'OB¡PÄìç¿”ìØ±=š×F"Z˜–rkGZÚL&öìÙƒìììg2)a2™°oß¾gvÿ›%õ ¥¤¤àüùóÂÚµk‘ N‡ââbX­V¬_¿~¿_¾ˆÖh4¸uëÚÛÛñÁ@¥RáË/¿œô… …".–SSSñúë¯GØ8_üRåsÉ\Þ¥ÓøøÆþ¿¿€gr}ì]$))"Ž·^¯ªÚ@ â9{Ú=•J…ööv”——£¾¾###P©TQÛ¿-…B!ÿ¯Õj§ì{ìóùž:ûÏøÙ¡×ëQTT„;vL;ÉI ƒhnnFff愉4¿ßÖÖVØívèt:F}:N\ºt ………P©T8}ú4ìv;”J% "æ—.]’»`J Ú“'OFôOEqÒ‘ô¼^/:;;‘——³EÔâÒétÊÛF ™(ö={ö@œ>}‡jµ………QuJZ[[á÷û±ÿ~8Nœ={###0 Ø¿ÿSÕ5ðûý8yòdÌy§Ó‰k×®ahhn·&“ ;vìˆêó?öyÒjµhooGOOA@nnî’(\ODDDô4–ÌÜØDŠF£‰¸8ÍÈÈ@qq1*++£ººh4|øá‡Ø¿?^yåx<y”FƒüÇŒX^¯×£··Wná#‰§€ÚÙ³gÑÓÓƒóçÏ˱F\¾|z½¡PÝÝÝr-Aä.Aãkü(•J¹‹Øø q·Û÷ßååå1‹ö£)7nœ³çC„˜-DfB£Ñ@©Tbxxø©[D¬Y³YYY³ÒU)%%r÷³ŽŽŽˆâ×###ضmΜ9W¢I­V£¹¹W®\ÛíFww7òòò°fÍÃëõB£ÑÀn·C¡P@Åï3 èîî0z±ÙÒÒ2­._ýuÌçbïÞ½aQ4M$¥R‰¼¼<ìÞ½;f;zzR"c¢Ú`v»[¶l×ë…V«… èééA}}=êëë±ÿ~yÙ¯¿þV«‚  ¹¹n·¢(Âãñ ­­ ÍÍÍrKîîî¨bñõõõÿ›ÍæI@gÏžE(Šˆa¬ƒ¢¥¥*• *•Jþ«CGGGD¢CŠ]£ÑÀjµÂçóA«ÕÂív£¥¥ÝÝÝÈÊÊ’—oiiÁàà ”J%Š‹‹¡P( T*ÑÛÛ‹¶¶6ܺukÆI ¿ß?á¨{“Õ«W€ü9´µµ¡®®.ª†´¯)))عs'!Š"¼^/:::"ž'"""¢gÑ’éöꫯbíÚµrQÛŠŠ ¹`ª (**BwwwÄ æ… °zõj¤§§cÕªUÈÉɉ"³¤¤EEEHOOǦM›[·n…^¯Grr2ÒÓÓ±nÝ:¹fÏTl6zzz"ºJÕÖÖ¢©©I.J,ÝÅFk#¼÷Þ{X»vmT’Çh4B§ÓaÕªUHKK‹H}÷Ýwèïï*ìv»±víZ¬[·½½½qÍÊÏÏGzz:¼^/òó󑟟׾îÙ³õõõHKK“Oà ==].Ššžžw½œÜÜ\¹ßÓ0 (**ªU«žžŽ´´4¹›Hkk+ÒÓÓ墙éééò1”Žƒô·t>üðC¸Ýn¬^½«W¯†Ï狸hS(ÁåË—ãŠOêþ¦Õj±}ûvùBL§Ó¡¬¬ k×®•ágŸ}6åújjjäý8pà€¼«W¯Æ¦M›——7­ãØÑÑœœœ¨é¡PMMMOý<-URAçàÌ™3LþÌ¡††ˆ¢³;k0ĶmÛÐÛÛ‹û÷ïÃåráîÝ»E¥¥¥1»†Z­V¨ÕjÜ»w.— 7oÞ„B¡@YY™ÜJñܹsrí')ìr¹"jBM6òF(BCCRRR&LçååáÖ­[øé§Ÿàr¹pÿþ}yP-))N§“÷µ¿¿ÂåC¡Š‹‹QVV†~ø<@yy9¼^/Ž;6ãçDŨúXSÕˆkjjƒä¸øáÃívOØšÈb±ÀçóáöíÛp¹\¸}û6 Å„É'"¢¥llI„ñ?ãKUL¶ìL4Xj¤ @ âï…( Îz|G¾ùìõzáv»g<%Hx q¹\a—Ë~üøqÔ¼²²²p^^^Ôô~ø!ìr¹Â?ýôSÌu>zô(ìr¹Â=šÖãbyüøqø‡~˜0öXóõº\.WX£Ñ„].׬Äöðáà ùLÜ¿?æóðøñã°Á`wttÌÊv~úé§ _ã31“uݼy3l0¢Þáp8ÜÒÒ6™L³ÛRR^^¾{÷n¢Ã˜wV«5 lµZçu»×¯_×ÕÕÅœßÜÜ®¨¨ˆš×ÝÝ.((§µ´´„„ CÔçYQQQ@¸¿¿?j]f³9 `ZŸ[aá¶¶¶iï·Éd ˆø\“bOMMzÏfff†„oß¾óøcóèÑ£°R© k4šYx†þÈår…„Ífsܹwï^@8333bº´¯Z­6êó8555 `ZßÙ3‘¨×|,ÒñE1¡±,¤ãB´=Í{HúxÚŸé|NÏ÷>Î')Ζ––ˆ¿¢YOŰ”B˜ÉyÍxßCK¦ €ˆÖ;’«W¯¢§§¸uëVÔü©F-’ºÙL÷q±H…žãÀ”5A&š?ÝésA„ ÷kºDQDuu5¶mÛ†ëׯ?uý¥R9«õ–bu‰p:ÈÏÏG^^žÜªëiI]>fËtŸ¯×‹]»vá³Ï>‹z¶lÙŸÏÇb®1?~<Ñ! A&ÝëõÊ5éš››#ZåççÃn·Ç½=©Ï~¼ÉéDw¾NôQ^^“É„ÚÚZ¹¥¥ÇãAZZÚ¼Ä@D´ØMVk­«« eeeq-»P“óÍ`0Þxã ¼üòËòß’P(„Ë—/Ãf³Áï÷C¡P %%;vìa @WWÞyçø|>´··# %%………7¨úúúŒdsúôiŒŒŒ@£Ñ`ÇŽr,ñz½èëëÃ;ï¼#ׯF©¹t醆†ŒödغukDk`i»o¼ñ>ùä¹eµÑh”o´èõzx<¾6™%Ÿ""¢gƒ4ô»ÉdŠêÒ4–4šã7¢=v»Á`0îD§T,úwÞ‰š7îF~¿---ÈÉÉ™t”­«W¯" ¼¼§Ó ƒÁ0ávººº¢FÉœ)i¤Â3gÎLy’û,ÒëõQ#Î588ˆææf£ÝÖëêê&\–wo‰–®ÉnhŒo)ËÖ€S[³f , DQ„Z­†Åb‘¿£ü~¿<øŠÁ`€Z­Æðð0šššP__[·nA¡PÀçóÁb± 33ýýýHMM… ò(—ׯ_—Ϫ««áóùäNF£½½½¨««Css󤣊Ãb± ¥¥EN566¢´´J¥F£@mmm¨®®Ž´ººÁ`~¿ÃÃÃF¿wrssåAL6oÞÌ×Ì"Ä- —.]‚×ëv}¼íÛ·£¾¾UUUÈÈÈO€<q >88ˆÎÎN¤¤¤ÄLPèõzô÷÷£¯¯{öì™t]gÏžE0Dqqñ¤ËI­vÆvÛ …BhllŒ9rÙD.\¸€þþ~äææÆ5¬ûG}4i|()) ¡¶¶6îX¦2¶–×ëÅÞ½{gmÝ‹™F£™ôÄ€œR*•S.KDDSÓh4r½K¥RQûòرcp:èèèë †B!¼ÿþûhiiA___Dï”ÞÞ^tvvÊuÿl66mÚ„½{÷â‹/¾—BNN>ÿüs‚¿ßM›6¡¸¸ëׯ; ãñxPZZŠÔÔT\¹rE¾¡ãp8°nÝ:TUUÉ `ôFQff&.^¼ŸÏ£ÑÑ:iÆ ³Rÿæ@DD´$Ä[@Ùd2¡¬¬ uuuXµj6oÞ …Bžž¸Ýn”••ÅìnZ__¡¡!èt: £§§jµŸ}öYÌíìÞ½MMM())‘— P©T8sæLIJ 0 SžH­_¿ … òºº»»áv»¡×ëåæÜã•••¡··:‡½½½ÐëõøôÓOc.ÿî»ïÂl6C¡PÀf³Áét"77wÂDÖØí>mm"INNúûûåbú^¯ÐjµÓ„ˆˆh®FTTTD 2! ÐÒÒUÏnóæÍç,f³yyyhkkƒÇã‘oЂ€S§NÉ­kU*ª««±qãF´··ãðáÃqÅ QVV†ìììˆÖ¼Ò,¯×õ˜ÚÚZèõúDZšELÑ¢çp8`·ÛQQQW÷£ÚÚZ 455¡££Àè‰[]]Ý„ $•J§Ó ‡Ã!Ö?tèЄÉ£Ñˆ/¿ü555r‚DäææF,wùòe¸Ýn455M·(Џrå >þøc´µµA¡PÀl6ãóÏ?Ç×_–––˜]´Ôjµ|ŒT*ªªª°oß¾ ëÿ( y´4N‡–––I[|øá‡°Ùl8räȬ<§{öì‘»ÆUWWC§Ó¡¤¤‡Æûï¿ÕmI£Ñp´""J˜;vm¹:<<Œï¿ÿCCCèïï¹|fffÔ´ÔÔT´µµá7¿ùœ2QßmR×óéÔþÓétòÈ´n·ß}÷†‡‡áp8àv»cž° öÒ³ @6› ß}÷²²²x"GDDSjllœ²€òx………Óêc±X¦Ü0›ÍS¯ohh€J¥’OãYçõë×£¦Æ ÷§¼¼|ZûzñâÅiõë×ét3õPêÊ+‰&>óÎf¬!Ë322–äh_DD´8x½^|ðÁèîî–»lëtº ¿O'ˆìþïrñhmmEEE<¼îÔÔÔ˜ÉÖ÷YšžKt±¨T*x<¬]»6îái‰ˆèÙäóùÐÑÑÜÜÜEwÓ`dd½½½°X,1Oð–édx¬ÖÖV±ï‚-&Û¶mCgg'ÊËËqëÖ-<|ø÷îÝ›°‹V¬ïEéÚwlB&Þå¦rùòeX,hµZtwwÃårááǸråÊ´ÖC‹Û‚ld4a4ÑÓÓƒáááIGs!"¢g›Z­Æ£GÆŒèt:„ÃáD‡1/jjj`³Ù`2™ Õj188ˆ¶¶6èõú¸[?-D^¯ƒƒƒØ¼y3Ž=1﫯¾ÝZÇn·G :a³Ù Þ~ûmyšÓéD0Œèâ}íÚ5£]Æâ%®yêÔ©ˆëë`0ˆ‘‘Ö×{F,È@¥RU,‹ˆˆˆN‡¡¡!TUU¡¸¸ÝÝݰX,˜ööDDôô ‡åš9…BA022ÑbghhuuuF[,ÕÒÒ›Í&ÿßÕÕ…ÎÎNäääD´h8pà€¼^¯×+å>öJee%*++'¾ûî;yZ(Â|€@ ³¥-= ²D¡Pàw¿û]¢Ã "¢gØtk-$Ó}```ÎbÙ¾};¶oß¿ß@ ×ðó4sòó¹”l6› …&“)bºÓé„ßï‡ÑhŒèÚàõz1<< QYß‚ˆf48D]]V¬X³Ù ·Û »ÝŽ¢¢"444D%€t:ÒÓÓa2™ …àp8`4qêÔ©¨uwww£··¢(ÂápÚÚÚ"EV«&¬W¸oß>´´´   @Hbppjµf³YÌa©wIÖ-èСC‡°sçN¤¦¦Æ,øHDDD‹‹J¥b­y Ñh]M¬™HOO‡(Šp¹\Ó8›Í†ˆBì}}}°X,°Z­³6b0:ÂhJJ l6‚Á Ìf3>ýôS ètº¨åóòò°~ýz\¸pÁ`ÅÅÅ(,,ŒÍT¥RáæÍ›hll„ÇãAjj*vïÞ•Ä–@Ñëõ¸sçΞ= Ç…B!~êp8Ð××ǽ^‹Åž8KÔ‚Nµ¶¶¢´´Û·oOt(DDDD´À˜Í昉.©¾Åød£F£Ùlfë"šRk×ñöïßsùxF F?»Æ×/ž¤¶(Š1×c2™"ZR.Ö–Ï4µr»Ý(,,d3q""""Š2Q·Å'NÄœž‘‘ŒŒŒD‡MD4gB¡‚Á ®^½ ,îLtˆˆˆˆˆˆˆˆâãt:±víZ€V«Å† - : Y'€ˆˆˆˆˆˆ–Fƒ¸º¢ž8qÁ`pZëW«Õhjj‚B¡@VVÖ’€¦oA&€œN'ºººä"TDDDDDDD‹B¡ˆ«îðÇzfÓ!Š"öìÙ“èݤê¹D‹ßï‡(Џuë3–DD”pÀ{gP(1====â'???®õ}òÉ'X½z5._¾<á2ééé8pàÀSǾsçNìܹ3bš×ëŠ=Þm}üñÇX·nìv{ÌùÒºkjjž:v""""š= 2d6›±{÷îgbøR""ZØÜn7 ŠbÔЬcÙl¶ “"ã•——Ãét¢®®nÒõ9ΧŠÝn·£­­mÊÖ´ñnËç󡪪 v»Ÿ|òIÌe‚Á l6†‡‡Ÿ*v""""š] ² ÑBÑØØˆP(„}ûöEÍ;QRRRÜë,**BKK òòòæŸOþ_£Ñ° -YLM  ¢¹¹7nœÕšt§N©S§æ4v¯×‹ÎÎNäääÌj‹Ú/¾øbNã¦g›Ûí†Z­†R©Lt(DôŒèêê‚Åb‘ÿˆ»FÑbÃÑÚÛÛá÷ûQRRòÔër»Ýhmm˜f4‘=åc/\¸€ÞÞ^øý~˜ÍfìÛ·oÒîhÐÚÚŠ`0ˆýû÷?uìN§—.]Š˜¶~ýú)OC¡.\¸€žžƒAlÞ¼9ª5ÒøíHƒ@£…,³³³gT“§ääd( Ô×׳ˆ)Í‹ŒŒ  ¯¯ÕÕÕ‰‡hN1DDD4††hµZdee=õºÜn7¬VkÄ4‹Å2i( aÛ¶mèìì„F£A @ww7l6.^¼8éã’’“ÉôÔ±ýõ×Q±[­ÖI@@›6m‚ÍfƒV«…ÏçCww7ìv;Μ9µü|€††€V«x<¸Ýnœ;wî©÷‡––444 ´´;vì`K "šsßÿ}¢C!šss^úÒ¥K¸pá‚Á`¢÷•ˆˆ(nv»N§%%%S¶¶‰‡ÙlF8F8ލ¿3™ÁÁAôöö¢§§<Àýû÷‘’’‚îîîIG»té<Ϭ´\€ÂÂB9ö–––¸ÓÝÝááaô÷÷ãþýûp¹\ÐéthnnÆÐÐPIJǎCCCL&îÝ»‡û÷ïãþýûøá‡PXX8+û@‹Caa!JJJ YHœˆˆh–ÍyèW¿úz{{±mÛ¶Dï+QÜNž<³€ò|W®\‘[ ©T*¹%Nooï„khh€Z­ÆöíÛ»B¡ÀÀÀ6lØ`ôkyy9Dt' ¨®®†J¥Â_|N'ÏS«Õ¬Ãð R«ÕF_DDD4{æ¼ Xjj*L&–/_žè}%""Š‹T@¹  @¾M„ÔÔT¤¦¦FL{ë­· ªdhh6› ååå Å$777ªpöš5k###ò´k×®! ¨¨(¡ÇšŽ_þò—‰ˆˆhIšó@f¥é<Ñ|9}úô„C¿'šTg"aAÐU©T¿ß/O“†Þj¿èÙóäÉ“D‡@DD´¤ÌK”JeÄ ÑB …ÐÔÔ“É„”””D‡E!+Vë¿ß¶¶6lÞ¼¢(&:Ô˜ñˆÙÒ‡µI¢ÑhD¶#""¢§7o  úúz¬^½555‰Þg""¢ uuuÁëõÎZåÙvãÆ ˆ9ºWkk+À‚ýÚµkQ±¿ù曛͖èðhÐëõHIIA]]Ünw¢Ã!""Z2æ-ÔÐЀ¦¦¦„Ó$""šJCC4 ¶nÝšèP¢øý~X­V(Š˜£c544@¯×Ë…—¯×‹ºº:¨Tªˆc›’’N»ÝŽO>ù$êqR1z¶|ñÅP*•HNNfrˆ”ÙÇ[()IDATˆh–Ì[q§Ó‰ŒŒŒDï/Ñ„œN'QQQ1eå¾¾>TWWGLóz½HOO0Úåüùóò¼ššyä.©+Too¯¼|ff&:±¾ÁÁA¤§§Ãh4" §§>ŸÍÍÍQ]¼úúú022‚†††)÷3VìN§sÂØ8§Ó)ï#´´´Èæ‹%*!ÕÑÑ¯× ƒÁ¯×‹žžƒAtvvʵ€$Ÿ}ö6mÚ„²²2477Ãd2! Áét"%%çΛÃg¢K—.ahh¹¹¹ ²;#ÑbÄêÌDDDÿìi (Og¸r•J5åòmmmèééÁÐк»»!6n܈?üF£1jù††(•ʘ-ƒf3vF#×h™h~ss3zzz0<<Œááa( äææâÃ?Œ ívçÎ|òÉ'°ÙlrbI§Ó!''gÚûC‹[ @ii)ŠŠŠpêÔ©D‡CDϰ“'OÂï÷ãÈ‘#‰…hVÌK( q$0""ZФÊ999qH•‘‘1­–­‡Šjá3™;v`ÇŽq-;22‚žž”””@©TÎzì'Nœˆ{Y…BÝ»wO»Ë·(ŠøôÓO§õZš††† §•˜$"š õõõp»ÝLÑ’1ç5€±k×.dff&z_‰ˆˆ&töìYƒÁ9ôûTNŸ> ‹2v¢ñ¤áþüÏÿ<Ñ¡Ñ3®´´4Ñ!ͪ9Oýøãؼy3>ÿüóDï+Ñ„>üðC„ÃáEÙê ¶¶áp8f÷*"""š™ŒŒ ~·Ò’2çý²²³³½DDDD´Hüîw¿KtDô ðù|1GÜ»woÔ  D‹ óÑ‚144P«Õ‰…ˆž]]]°X,1ç]¹reÊQA‰&€ˆˆˆˆhAX·nôz= C¢Ã!¢g@FFäÿÇŽ´Éä-5LÑ‚ R©PRR‚?ü0Ñ¡Ñ3B£Ñ@£Ñ$: ¢yÁ-W®\ItDDDKÖœFDDDDDDDD‰ÅÑÇÑÇÑÇÑÇÑÇÑÇÑÇÑÇÑÇÑÇÑÇÑÇ-96› •••°Ùlò4·ÛÊÊJ\ºtIžæ÷ûQYY‰“'O&:d¢9Å-9×®]ƒÕjŵk×äin·V«ÝÝÝò4¿ß«ÕŠúúúD‡L4§„D@DDDDDD4ÛÖ¯_«ÕŠõë×ËÓDQ„Õj…Ñh”§©T*X­V¨TªD‡L4§˜""""""¢%Çl6Ãl6GLEGމ˜¦R©¢¦-EìFDDDDDDD´Ä1DDDDDDDD´Ä1DDDDDDDD´Ä1DDDDDDDD´Ä1DDDDDDDD´Ä1DDDDDDDD´Ä1DDDDDDD‹Bkk+._¾ŒP(”èPˆ!ÑÅÃb±6n܈/¿ü2Ñá-*lDDDDDDD‹‚ËåBYYúûûát:Ñ¢Â- ¢("++ ðw÷w‰‡hQaˆˆˆˆˆˆˆŸÏ—èˆ&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆhÑÐh4‰hQbˆˆˆˆˆˆˆ Q¡P(Xšhš˜""""""¢EC¡P ´´MMMhll„ßïOtHD‹@DDDDDD´¨?~f³%%%l D'&€ˆˆˆˆˆˆhQ©¬¬D?ª««a4Ñ¢ $:""""""¢xƒATWW£¸¸‡Jt8D‹[Ñ¢áõz ‘’’’èPˆ&€ˆˆˆˆˆˆhÑp»Ý‰hQbˆˆˆˆˆˆˆˆh‰cˆˆˆˆˆˆˆ…B‘èˆ&€ˆˆˆˆˆˆhQ…Bèëë¼þú뉇hQá(`DDDDDD´(,_¾`6›Yšhš˜""""""¢E¡®®¢("+++Ñ¡-:LÑ¢ðá‡&:¢E‹5€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆˆˆ–8&€ˆˆˆˆˆˆˆˆ¡P(ŸÏײB¢ƒ%"""""¢hÓ¹°#¢gC(‚ÃáÀµk×`³Ù088ˆ@ EqÒÇ2DDDDDD´<Í…-M“}.Œ¥×ë±uëÖI×ÅQÌæ…- ñ|.üÕ_ýDQÄÕ«WñäÉèõz @©TNºn&€ˆˆˆˆˆˆæÁ\^ØÑâïçBJJ Ö¬Yƒ¿þë¿ÆþðìÙ³'â3B£ÑL¹-&€ˆˆˆˆˆˆæÀ|^ØÑâ0“Ï…—^zIž÷ÿoïþc›º÷?mÝÊÝÜ}ÜÍHF5­£†ÎiÓÎi“6]pK¶‘•H¤k©T¦Jµ°fjXƒH%Ð@ hD "©4ÐTP‚j¦¦ÂLdÂOXÂU]á WõZk÷û_߯ùHüƒ÷KB¢÷^_Ÿ{ësðy|ι_}õ•Þzë-…B¡I·@pd²c ;Ýn»0Òí¶@p ²©c {$“ImÛ¶MÇŽ»­va¤;ÑFÀMÊÖŽ€ì±aõ´´˜ÿ}+íÂHwª €›”­;Ù£»»[’ô‡?üAóçÏŸt»0Òl#€à&ekÇ@vˆÅb úÁ~ E‹é¾ûî»åsÝé6‚nB6wìd‡'NH’¼^oÖµ÷fúæ@.ÈæŽ€ìÐßß/Izî¹çnùSÕFÀMÈæŽ€ìj'ž}öÙ[zýT¶@p²¹c óFN}òÉ''ýú©n#€à²½c óngšèt´@pÙÞ±y·:MtºÚ €; K’l6[¦‹` d{Ç@æÝÊ4Ñél#€SÂårI’‚Á`¦‹L‹ÁÁAI×FÈ?ÙÞ±Y·2MtºÛ À”HýB:44”é¢S.™L*Hº½§ÈN¹Ð±Y“&š‰6‚0%Š‹‹UXX¨ááaíÙ³'ÓŦÔÖ­[Çåóùd·Û3]wX.tìdÖd¦‰fª L ‹Å¢ÖÖVIRCCƒ¢Ñh¦‹L‰P(¤ææfIÒ‡~˜é☹бY7;M4“m`Ê,X°@UUUŠF£úÕ¯~¥H$’é"wT$Ñüùó•H$´jÕ*•––fºH¦@.tìdÎÍNÍtA˜RÏçÓàà ^~ùeB äH$¢—_~YÃÃÃòù|ŒþòT®tìdÎÍL͆6‚0¥l6›Ž9"ŸÏ§ááa•••©§§'ÓÅnKOOJJJÌðçÈ‘#²Z­™.€)+;™s£i¢ÙÒF¦\*ª­­U8VUU•–-[¦X,–颓ǵråJUUU)‰¨®®NGŽ‘ÍfËtÑL‘\éØÈœëMͦ6‚0-l6›8 }ûöÉn·«££CEEEÚµk—’Éd¦‹\W2™Ôž={ôôÓO«½½]6›MûöíÓÞ½{ €<—+;™q½i¢ÙÖF¦Õ’%KtúôisÅŠ+TTT¤={ö!+>|XEEEª¯¯W(’ßï×™3g´dÉ’L ÀË¥Ž€Ì˜hšh6¶@€içv»õ÷¿ÿ]}}}*//W0T}}½ŠŠŠ´uëVŒK$jkkSII‰ª«« åõzuìØ1õõõÉívgºˆ¦A.uìdÆxÓD³µ dŒßï×§Ÿ~ªC‡Éëõ* ª¡¡A³fÍÒ²eË488˜é"â.3<<¬wÞyG3gÎÔªU«TXX¨ŽŽ>}ZóæÍËtL£\êØÈŒÑÓD³¹ dÜÂ… uúôiŸ|>Ÿ"‘ˆvìØ¡ŽŽƒAµ´´¨¥¥E^¯W555Z´h‘<O¦‹‹FuøðauvvêØ±cæv›Í¦úúzýîw¿ã3Üår­c`úœ&‹Å²¾ d§Ó©7jãÆÐǬÎÎN555Éív«¢¢B•••š7ožìv{¦‹,–L&588¨£Gª··WCCCæ>«ÕªêêjÕÖÖêÕW_•ÕjÍtqd\ëØ˜~©Q‚n·;'Ú @VK úðÃuâÄ uvvª»»[¡PHíííjoo—ÅbQyy¹***äóùô /ðhî»\2™ÔÙ³guêÔ) ¨··W±XÌÜo³ÙTQQ¡šš-\¸Ï €1r­c`ú¥Ú‰®®.}ûí·YßFr‚ÅbѼyóÌExÏž=«žžõööjppP0-..–ßïWyy¹^zé%¹\®L_¦P0Ô矮ÁÁA *(‘H¤ãñxTUU¥ÊÊJ½ôÒKŒôp]¹Ö±0½RÓD%åLAÈIÅÅÅ*..ֻᆱx<®'NèØ±c2§Š¥þQ–$—Ë%¯×+¯×«ÒÒR=õÔS*,,ÌôeàÄb1:uJCCCÒàà ¢Ñè˜ãÜn·ÊËËå÷ûõꫯòèv7-;vù º¹  ™Ï•6‚ól6›,X  ˜Û€>ÿüs3 8{ö¬º»»ÕÝÝmc·ÛÍPÈãñè§?ý©<OÖÿã}·ˆÅb ƒºpá‚‚Á êƒÁq÷z½æ”Á^xÀ'ËбC.ÉÅŽ].KÝÛþþ~Ú äœ\j#î1 ÃÈt!˜j‰DB@@ÿøÇ?ÌPh¢ Án·«°°PÅÅÅòx<*,,Ôc=&·Û-‡Ã‘éKÉ+ÑhÔ y†‡‡  … ÇÕ#}?Å/Þ=÷Üsòz½¬ã“¥ÚÚÚ´jÕªL¸%¹Ô±ËummmŠD"™.0)V«UË—/Ï™ï‡@€»V,3G ¥B‡ááa…Ãá _cµZåv»Óþ¸\.=òÈ#r:r:<‘ìÿ‹ÇãŠF£ŠD"úÏþ£p8œðƒÁ´…™ÇSXXh†pÅÅÅúÙÏ~¦ââbÖïÉ1tì‹r­c7BÀ(ÉdÒ•22¬H…£Íb±ÈårÉårÉápÈápÈårÉf³ÉápÈn·ëÿþïÿäp8d³Ùät:s"ЈD"ŠÅbŠD"úꫯ‹Å‡FÇ …‹ÅÌíÉdò¦Îër¹Ì0ÍãñÈãñèñÇ—Çãɉû €˜¤ÔH–ÔÚ4¡PH‘HDÑhÔ ?nÅÈ (Iצ¤¥F¥Â¥[‰DÆ„W#×¹®…_£ËŸÉs+‡œN§GÚˆ)·ÛmN«³XX’`ª0FŽ„ùú믉D‰DLJÓöÇb±[X¦S*ˆJý=‚ÉívËétê'?ù‰ø ;%FÐI$cÖMùúë¯Ç„E©0éV¸\.sŽÃáÐøCI风RS×»€òܽ™.¦@ž#Ès@yŽ Ïä9 €¬eË–i×®]™. €qlÞ¼YË–-ÓÀÀ@¦‹’•¦ëþD£Q-[¶LË–-Ëô%˜¤Í›7«³³S’TZZ*¿ß¯ÒÒRE£Q…B!Åb±Lñ®Äø+¦Y PGG‡$iùòå™.€Qz{{Õßß/¿ß/ŸÏ—éâdéº?ñxÜl+wïÞéË0 ©€¸¥¥Eï½÷ž¹=™LÊívkîܹ™.â]‰ÁëõJ’œNg¦‹’•¸?n$K’ÊËËÓ¶/\¸P .ÌtñîZ@À~øa¦‹Õ¸?@vI&“Ð?ÿùOIRaa¡æÎ+«Õ:îñ‰DB'NœP0¼áñ©EœN§¬V«€>ÿüsÅãqy<ž1¯‹D"J$J$æëC¡¬V«œN§y>»Ý.»Ý>æý†‡‡uêÔ)Åb1kÞ¼y’®J‹E.—+Ó·;§…b±˜ù%ÊétNÙ/í¡PHÑhTn·[‡ã¦^FFåñx2}›€Œ ‡ÃŠF£*,,”ÍfKÛ‹Å …nºþ†ÃaE"Ùív9Žq;F£E"E"¹\®›®¿Ò­Õû[1Ùò¥Žw»Ý7uý#¯'‹Mú>ùààÁƒZ½zµ"‘HÚv§Ó©ŽŽ½úê«iÛ÷ï߯†††1ÇÛívmß¾]K–,IÛ¾nÝ:utt¨»»[ííí:tèPÚ~—Ë¥˜ÓA/^¬þþ~smm­$Éï÷«¯¯Ï<_ss³Þÿ}ó¸X,¦7ß|SÝÝÝiç÷xþøcÕÔÔ(‰¨¶¶V]]]:t誫«‰DT]]­@ `ßÖÖ¦ºº:E"ÕÕÕ©³³S]]]ª««S,S]]vìØ1î{­^½Z½½½Z±b…ÚÛÛÕÒÒ"—Ë¥p8¬×_ÝñS__¯ææf3ÄMýw}}ý„בL&5þ|uwwËåriË–-:tèššš‡USS“é[? 0­š›› IF}}}ÚöÆÆFC’a±XŒªª*cíڵƊ+ŒÂÂBC’!ÉØ¹s§yü¦M› I†Ïç÷}Nžó{ÀÈv§¾¾ÞÜ~òäÉ´×\ºtÉ·ÛmH2úúúÒ¶§Î7²¾¥Ú—Ë5¦8sæŒa³ÙÆ|ŸÁ­!`š;wnÂ/Xß}÷ù…©´´ÔÜ~éÒ%³ã4º“h†±jÕª1_²V¬XaH2<qéÒ¥´ã;;; ‹ÅbX­Ö´ó¥Ê›êü~ùå—ÆÕ«WO?ý4Ó·˜× €$+V¬H sšššÌ}………iuëܹsfidG(àz<ãÊ•+iïùòe³ó4²cwùòe³#4º×××gî˜444LXﻺº ‹Å2¦Ó7Ùû“êÀ¥Ú‰«W¯šû.]ºdvT[ZZÌíW®\1«Ñؾ¾>󾾞TXîv»‹/¦í;vì˜y=§OŸ6·÷Ýwf¹ý~¿¹½ªªÊÜF \ÒÕÕuÝcΜ9cTVVMMM†a|ßæ”——OxÎT°šza|ؤ‚¤‰^3²=0ŒÉ@©sLD¬ó¸=L \¸pA¥¥¥ª««óXe‹Å¢ºº:IJ›ár¹TQQ!éÚ0𑉄ººº$IK—.5_›z¤òÆ,¤øÆo¨¶¶V‰DB»víSF›Í¦½{÷ÊápÈf³y²p7°ÙlúË_þ"‹åû¥4G®™±iÓ¦´ºåñx̧fýûßÿ6·Çãq«©©iÌz7N§Óœò0rêØ®]»ÇUYY©·ß~;í5~¿_---cÊǵ}ûvI×¥>ºÞ/Z´HuuuJ&“Ný˜ «Õª>ú(mM$—Ëe¶a©Eg¥kk‘Äb1y½^½ûî»c®§¡¡aÌù‰„y=ííír»ÝiûçÍ›§U«V¹‹Å¢½{÷Ên·«¿¿_;vìÐŽ;ÔÝÝ-‡Ã¡½{÷¦ý?²Ýàà $©¢¢bÜÏnqq±Ž9¢7Júþ±ì©ï ãIµ;©s”jÇF+,,”¤[žžL&Í÷›èÑð£×1­# ,X°@Ÿ}ö™vïÞ=f_"‘wýIZ±b…$™ÁNJOO¢Ñ¨ü~¿ÙA:qℒɤ 'ü"WYY)Iêíí³ÏëõNøDàn1^=B¼ð c^3^½Ù¸q£Îœ93fÁUéûÅGKÕˉÖÃxã7Æl;~ü¸¹˜üD¡muuµ$騱c·}JKKÇ]À9ÕIy]©5Ç&s=§N2Ÿ ”z:ÐhUUUi÷+ÅåriçÎ’¤¦¦&566JºÖ~òd!äšÔB£CЉÄãqIß×Åñ¤¬/Ì™ª:‡•L&%i‡KÜì5âÆˆ¹È"ápXGÕÙ³g … 5<]õ~2·ë=åk¢2§ÂÛ¹ž‘S,»#× L·Ô4ˉcI r:f8|£ãSû¦ó{€Ëå’ÕjU"‘P0Tqqñ˜cþõ¯M[yòSÀÈmmmjnn–tmjÂÉ“'uåÊ]¾|YûÛß´hÑ¢ _›Zãgß¾}J&“Ú¿¿’ɤjjjÒÖáHuÌÊËËuñâÅþ0uV®\©ÞÞ^sZÒ™3gôÍ7ßèÌ™3úè£Æ¦™ªÏ_}õÕ¸çL$c:w‡CÒµ©kÙVïSÌ‘£‚F_Ïh©vÌãñÜÒõô÷÷kË–-²Z­²ÛíêèèH{œ=+R#~SS)G‹F£*))ÑÌ™3‹ÅÌã¯7Õ3µo¢iâSÁb±˜k=ztÜcº»»§­<ùŽ€,Zç¡¡A7n”ÏçK[Gã‹/¾˜ðµ¥¥¥*..V4Õ‰'ÌÅŸëëëÓŽK}¡œ°Ã´gÏžq€pgŒÝsàÀ½õÖ[*..N=söìÙ1¯K­á3Q‡ïÔ©Sc¶=õÔSæù&ª÷ÃÃé÷©_ú‡††ÆÝ®{=ÞÖ®]»ÌEoSb±˜Þ|óMIRKK‹Z[[%I«V­wºÍ,X «Õªááá1‚¤­[·Jº¶è³Ýn×’%Kd±XtìØ1õôôŒ9þøñãfÐ2ÞÚdSiõêÕ’®ÕËÑmßÀÀ€ÚÛÛ§µ<ùŒ€,š 1ÑZ©…K'º {:::488(—Ë5fÔ¹sçÊn·+Oø´Ÿ5kÖ¨¾¾^Û¶mËô-òÖÈ)Z©EWG ‡Ãã.Äží×ÑÑ1f½žd29îSÀ|>ŸœN§âñ¸Ù!íwÞQ}}½6oÞ<­÷!5Eµ««kÜf¼vª´´T.—KÉdrÂò®_¿^+V¬Ð|¶}åÊ• ‡Ã*//×Ûo¿­¥K—ª¢¢BÑhT+W®œÖkn—ÃáЦM›$][ïoýúõÒÐÐÖ¬Y£M›6Éb±˜O+,,4>¯®®N;~ýúõæâé Ó:H’.\¨ÚÚZÅb1•••iåʕڰaƒ/^¬—_~™'ôÝA@dÔ/û­­­i¡p8¬×_ÝüÅ¢_ð—.]*‹ÅbN=úGº6u"5ͬ±±Q›7o6;¢©ÐÀÀ€¬V«Þ{ï½Lß o9Ns„ßæÍ›ÓêõñãÇõòË/›usdXäóùT[[«x<®9s樭­Mýýý:xð æÌ™3îÈ ‹ÅbCÍÍÍúàƒÒêýoû[õööÊb±L{½÷ù|ªªªR,Ó/~ñ sÄO<×úõëÍÅìGÛ²e‹$iÓ¦MúãÿhŽŠÅbZ³fºººÆ\ÏþýûÕÕÕ%«ÕªÝ»w›ÊÔ#ë{{{' ÆlõöÛo«µµÕ¬çeee*++ÓöíÛe·ÛuèС´§ÿmܸQ---cŽOµ---úóŸÿœ‘kÙ»w¯$IíííjnnVgg§jjjÌ ‹¢ïL«ææfC’Q__on;þ¼át: I†Åb1Ün·ár¹ I†Ýn7::: ›ÍfH2Î;7îy««« I†$ãüùó¾cc£yœ$ó}$6›Íèêêºay|æ÷û IFGG‡¹íFõ U‡nö|íííiõÎív‡Ãdx½^£µµÕd¦ëêÕ«iu}ä9¶lÙ2a9ššš ‹Å2n½·Z­cêýdïOGGÇuïOj¿ßïOÛ~åÊ£¼¼Ü,‹Ãá0ËÙÐÐ0áõ´¶¶¦]Ûí6ÿn±XŒ;wšÇ^¼xѰÛí†$cË–-cε}ûvó>œ9sæ|‚€éuùòecçÎFcc£ÑØØhtttW®\¹áñMMMFcc£±sçNãòåËã{îÜ9£¯¯ï†û/^¼˜¶ýÓO?5úúúÆ”c¢ãS®^½jœŸù+Úx***T]]­|PV«Uß~û­¼^¯~ó›ßè£>ÒÏþó–Èg÷Üs¼^¯æÎ›6Eëzõàž{î‘ßï—ßï¿©ó=û쳪¨¨aº÷Þ{e±XôÌ3Ϩ©©IÛ¶mÓ³Ï>«ûï¿_Ï<óŒ¼^¯ùË÷< ÚÚZUVVjöìÙòù|ª©©Ñ_ÿúW=ñÄæôÍÑ_ñ_yå½öÚkz衇ôÀ¤Õû¶¶6sÖÛ¹?3gμn;‘Ú?rz‰ÕjU}}½{ì1ýïÿS2™Tii©þô§?é÷¿ÿý„÷µ¼¼\¿þõ¯õàƒêP"‘Pqq±jjj´{÷nýò—¿4=uê”}ôQUVVêwÞѽ÷¦O‚xþùçõÐCéùçŸ×}÷ݧ'Ÿ|rª?bÀe³ÙTZZªŠŠ UTT¤µ×;þ•W^QEE…JKKÓ1’ÃáÛí¾áþ‘ëJצ´»Ýî1åïø­[·ê“O>‘Ëå’ÓéÔ£>*·Û­ýèG’¤Ã‡«¿¿_zíµ×2}»sÚ=†a™.¸}+W®T{{»ÚÛÛµ|ùòLÀôÅ_è¹çž3Ÿî5ÒÀÀ€æÌ™£ÂÂB?>ÓÅ€›²fÍmß¾]µµµ:pà@Ú¾p8¬’’E£Quuu]÷©¨¸1 ò@$QAA¬V«.]º4á/ur×¶mÛ´víZUTTè“O>³ñâÅêììT]]öîÝ›éâÀM9{ö¬JJJ”L&åóùT]]-»Ý®@  }ûö)‹MØîar€ÈQÑhT[·n•ÅbQgg§‚Á š››õþûïgºh¦@(RQQ‘‰„V­Z¥%K–ÈåréÂ… jooWgg§l6›>ûì3¦kÈ)ýýýZ³f͘ÇÀ[­V­^½Z7ndè;€€vÏ=÷˜÷ù|:r䣀norNTÏ¢wš#EIDATxÚíÝ÷òÊ‚ðAÁ 2Ŧw0Å%’ͦoHYìæîÞ»åÜméÿÿO™‘(¢WaÄy¾Ÿsx±31*¨?ÅÁ9yÊ%,¸ÙŸçùé øUùÍ»^ëðú^D@ †äý”°¤¾Š‘h Y°ÜIŽ¿EÞá¤)¦)EIK’”Q²ô¯œ¢äM¯)¤ýEäÀJÇ/•³‹ä¦rŠX­ññr1^¨‹j#Üœ¿«õYÿÒΟ†Ÿž1vp À_l„æÉýl×¾:g«–]=ÇÍ\¯æ8o~zÆØÁ®¬ü3:¬_ûÔ¼ùïËqIÁK±ˆ¿ËJ¦ë{–Ü0À…ô¬üóò/þèþH°ŸF®Ûó9oS‹ç­a‹â\{W´º¹8‰à?^ ÿŠýÉü¯³/ÜmkòDõez#¶kŽ€öøßXQ™öæÏËr–ßž†å$û›ßü;à4ûlU}vA–¥õiàBË›†Y`Bú/-¹àݘ†íÇÄ;¨ýôì¸ÎF€-_3ž„œ,­OYÿ ¡Cþ½|H0ØÛO˜âpø¶6 «ÿ‡?ù“ÿx¯%°$‹?=ÿ®ò3&#¹±6 «ßsXD€Áæ~(Àdsux p¡ 0 ÈUó4 À—Xø?1w p?eÊ p¡{ÿ<‘·|ÿß`°»Ÿ p-‰ÜÀOX+ËÃ. p½}§ZX¥+-'KâF€·¦êG€ÁîX€ÿó†ÿba~4_X–[^‚ÜÀ9µ»ž³Ý¢ñ4²àŸ9¡»Ûàÿêwõo\Õ× (ËrØ8 ¸}þSYn~×Ç· ±ÓWa—×*ø‡@#À·%HÂêÿVLë² ¿F>®+¶óÖþN±²B½ñjèŽì¬Õ0<‘Íî<*á!K^rø¼ç_ÚÎé~é}kD7Šë—ÒÙ‘ûÇ †'²«;÷ÇõDk~îl~x/ nï‘û§t8¾$ˆ½Fph¼­™îEã§T†\aowvŒ#ƒÀÔtÓ…¡2•¤OUU+ËSkýô¯€$…ÓÙò¡leTúÐN­ ¸Â±îìøªµËj6§4^ä"¯Hßê€&·fe0ÀNïÎ÷Å¿±{¾,—ÀUö'Ïœz-Zà¶îÚ`€ÛB€l °1ÀÆ`C€l °1ÀÆ`C€lì‘?]‹¬õH.<_‹¬õHVž¯ÅÖz Ç»Ï×bk=P€ÕÑóµÀZàtéùZ `­ ðlú|-°ÖXÃN,€3=P€±à\àðçÓµÀZàÿt-°Ö#ø [ `-ÀÆ.ÀJ4½ó½Þ2RªiÀ‡×ø·\OÏŸõ”³!`x"à¡{÷•ɸ×Þ9¿­¡¿üš:élžÈÃXíTH¢§|ºÃÓ/RÍuØ  øµXQȇݱLØï!ƒéTˆ)Awi:íi¾âq÷ô÷žô; OäáÌÈ%mú©½|κ-Qç›ýt”W‰Ä÷ž´UoZ›d5ºÎ;4¿¾úìÔ—ÍŽàõÀZà!] „—ˆÃUŸŠ<Ý(~ôC¢ØKMRŸB‡­BgÓ#çê]µøp-°ÖCX™ø#T®UDdšV=À|ÝN8"G¬¹^Sµå»:ÒIgC ÀðD:Àí Ñ$s€© qø !¹±Xõä†_›ðy¦§œ ÃyªŸt6 Oä©üx-° `c`%0žxçÿ’·“æÒÞÅ®+-\y¸XëAÜ,e'ì7$Ä“o÷ŽW†ÇòüYl÷iL?Úbk=h€?¹Á¤ò™«xh€½™inì·{ù°Û+±“‰´ÐNwK¯Ê+é9T"è'&ñ™Çk1€µ4À'ó¤2 ÎyI4Ë–Àï)|‘v‚Ⱦ™î¸eo?c/éo*9 Oä&ä#L¬y#~ɰ‹.dûM’¤ï §è+Ö ÎŒ›œ†'òÀÎ2ëò’–¼øæ.5ÑdvÄÕv€¿r_ä0<‘p3NF¯¼Ä¥y ’ìMk¼0!ÑÜV€;öè:i'4 Ïä@wîû5Yœ¡çúÔÖÇõåÝø³]eœ—rY]…þÎ}—SÚ(ÿFÓ*ÓáÙV€E½ >{m‹ìæ@w®&QcÅ‚gmä$¥'7’wÓ`…tŒgówÇþú¼Òµ-°›Ý9'„+rÀ¯ÍþîÙÎ!ΰªÅe¶[û6^¤¦bÃ>IÐ…òTÐÿ4N­ ÇB\aow66rÙ6°~¹‹y€9ã’v¯Ò÷]‚@‡º ÚG’n)O|‚_:µ2à {»³¨oäî p¬5¬åU`r•éÂú#_¾Q€½éÅ) ºøò ‡z¹\¯×ã;Ž}D•ckÞ0<‘}ÝYßÈ5üÉ¢¼àÊhþ26˜“5ú?*~†¾èc‚¶tje‡âô¡ø¦?ãùÅŠ{]U_D±¿cC;MN.l1€ íëÎó¬¨ÝA ë 35!«åe€;ùÅ^g`OA} 7阸Ì. éJ¾»Ò©•Œ“_nú®y>§é1ùœµI€í¨òV«^QœH¯ÚºIoB&G&Nz®öìèUu`x"ûºó|#×ã\t[xÂ.Ç¥kÓýÿÑò˜'g“°±µ~”ýL\2îÞ&îS+;'¯ïê¯d¬ïý&ÑÅV9…Hªæ ‰c¿9¾´FŽC€á‰ìé΃‡%¶gú?NœvôÓþÊŽÅ©= ä-Ë*®C¾Œ¿±KQ&R褞`x"×tçH~˜å®¬ìXýì(I^"\]êj#X€ùU€µthfu‹ÌãžÌ`på4RîÕëD3ÚŒ/Ħg]¤ª¢êšêï>º†'òè&ånî»ÃuÓaãuÊâüAS€£¡\OùR:$ð®9|b? OäáLúúoÇ¡ýSÚÚ‰òÁò`x"à³}a~56»sßèßÑñ‹^tÞ½ãp(%ÀmmvçHbû5Åvç$å9Z 3)œ\A€®²ÙÃzXãó_T'úÚèòÂSíž>r~†pÇxÑÆ Æ>7/¡?PA€®²Ñ½ì$àÉ´«L'„OgZÉ)+Í‚¢Ÿ"`=?ÝW…RBT¿¢Ÿ0<§(ÊÆÝ•Ê…r}Â)/­‚oe{Ý·Åv¶Ñõ“€³¢ü„—}4‰dµŽêWN§ åö7 pBó¤x¢*I¼š‹`?ôt4¢k„&´‰ìØWÙžA÷m1€­wg}#·/Ó­»E—Àì9· °q|ôüt_}D¨ºÝ,™KÔ©ý„  Ÿ§¤?½³²}ƒîÚb[[ïÎúF®ƒe“WôÛir|àý"U‹Ó}õ¿UØ`±U7|¨²}ƒîÚb[[ëÎZH? 8T#dÐìÑ¿¥¨>Ö8 ˜­>³Ó}i€=©˜àÏîë͵`nùˆÖE€¬¶Ö\âË—+4Ê|¾W.°µæbáýu²8 Ø|o°Ó}儨-¢N.”?ŒBX€ÓA·…Xm­;Kó+]}5šI>,øŒ³oß„ZŸÔ结ç§ûÊ/;ªC}\ú¢7¶¸< p?*pc'ñ*Û3¨O×Ù´öø)çö^Ýb{3wç“€—·æ5´?Öþ”ߎԵŒN8Â'÷ÉxJ€éÆ·~!å¬/l1€ÍèÎÞÀ¡7Î/WŽš~(rËuVeX…¸ÂžÌðH-° `c0€!À6väþÀc•+I÷VW{˜ÙýUÕ¸zM¼Á‰Œ/¨l5(ÖŠüt‹ìæÈý'ü<£Æýååo;ú­“øšq¤ÆWólþ¢tbe¦A3é§[ `7Gî¼q‰8™ë¬ÝxíP+UXœÌí¹½ÉásÒO·ÀnŽÜxàÅýËúIÀË['èç/O ·ZJåÔÊLƒÝn1€í¹?ðr <¿¹Y¢ïI±Õåù­“K`ýBµÅ±{{RtUºsjeæAß/?ÛbÛ9ràÍÓl¦N–·NZp„n7K¤Ô:§2ó ŸÜ OäÈýwø»¾º?ðz€Sƒ…é9•™yö'ÿ.-°Ÿ#÷Þ°'å]Ýx+ÀŸòÑŒŸQvb\áÈý#j¸¥–V÷NˆÝW²85x1´¬&3ªcyj°Z轊§V†\áÈýÇìÆÀ±åýã5ý$àùýC£ì_ñ¸æ§{wje«A³ìá[¢XÝbºæþÀ·¨l5¨3¶êþ“Z `G8ÀÆ`C€l °1ÀÆ`C€l °1ÀÆ`C€l °1ÀÆ`C€l °1ÀÆ`C€l °1ÀÆ`C€l °1ÀÆ`C€l °1ÀÆ~uÖ^`x¿®Ï^IYîX#€¥~=žøÔÌ=÷k1€µ~ö¸{]–Ý?ûsšßÉý `±_A€µöÒðþö/zù;ù…§ò+pY–ÿWý7ûË/È/<›_A€ƒòø_äžÎó˜“ûwÈ/<©ç° KÈ/<«çp@þõù­v/ºO*&îØäp^Þ0þÈTõyž÷~‰—»¼úÝÒ:¯x{ü¼_øÜþ×ô/œ†þÇÑ—L޶±Ã÷O™ÿGË?ÔBÃó¸ G¯]þÊÍσ™zÒ¡!dhkXx¿¸aò‘nW”¼rø%Ê­g~Z)È—¿ÛÑ<çûŒëJêxßH¯Ü¸p">åÒ±—GÛÈËÜ)óÿhù5ØÐ¾öé“ÿþêõgö²ÒÞ5Ϩ•´ã¥hß•­aåìåG• 0%Þ;À¬ë^þÞºtΫۇ"ÏÕÏ)ËÝ[>äŽ.‚O 09>ÿ7e&[åk©ÃKñ§ðHþ‡«·õ¸äa&ºkµL O_Š]ÕÚV윪§ pø¬ƒ\ÅÎóªtΫ- °ñ®õò•Ãs[Ün6Ó“·¾-pFþÇ«÷_É ©Þö·sLžÑ¯oÞzŠÙL]O»öÒTú¦™J×ßÉé°ü•h8Ä,Û’¿J™ýÕL–ަëˆýb&Û^_PwÞ¥Ï=À1U ðÆÄC›èj“’ÏQ–_ÆÜU6§gU~=ûí³™¿,ß¡’™_J¬U5y—2Uºzg å}p²’H_TŠRiœéid\Œ÷¤Ï˜þ†e€ù€¤~­7¸SÌHïqÓôÌŠ¥l›kŒ¹KêU/Ê'*'dô‰5—¿²p¼,}ûÖʳ»±"<É8 ½Rd#fì½êdœÞiM \ ïˆÐ‘ìlj"ük&&HU²kþ òbzôuøRYŸw¾LVŸ³œ_ªD7ìû–zkûª§M?s{c¢_Nè=Bhj£ì·Ëx¥²17|É­s»óÅú©í->«ÜOÊ¿»zÿ³l2ÝÜ£Õi–7Ìžà´Z ¦é`ON ½‚‡p¢(†¥¶‹bCïîJ«–tY(ˆB1É‚Þk¹Þ‚ ÁI<Ót­”Í™×Ñ;Ánõ%Ìì¾ ƒa•¼É2(Ð ¸ ÓA12Mé=nÞVÓ³*?SEÒI:óWås²«ðy7O¢³pÕ¬·WÂ}ò¢Ð¶¥^…—]}Cêk*Sºˆlµ…lR߀]¸ž/¾‰Íµ¥Ç¬« ŸSÓôðÉÌHÎVSÆB¤§'R/_a«Ç² k“µòWu>‰ßÂ(¥šËÑ9»¹rÁ+õ J ’¸˜J9‘«“ô«O%…¾¥Äž‰=={j¡ý­¨e9¾kþ Ãà|zôcØ\æäÏïHOö±¯¡¬Ð.¬8ÐÜ•‚¹ósrðU¨È.S{c´ê ö)I!14¾±”#;»Ç·Ùo%"g·†Y`^nš_Q>Íæ-w(Õ[ï[šX2ÉÓÞÒ+°šç_ߪ¤Ï}Á«ÎôAÆÊ’R$õŒÞ©<ì» H“Hšôcq¥è“÷.í;šR£_Úê|1þ^ AòÐk¶íVo:<²›HÒŒ#DLÑ¢ã²þå>ï@«éY–Õ»GH4•O;•2Û˜'Ù}ˆióúÝ2—×÷±/0·ì bPëÓn³%+¢lÌpýÎá«í—Òš13–ÓÃÓb”1ÖC´”1_òé|Ó»F1©­•¿R6v)dÒ„í³›Ê×+ÓûUY]¬æðÍ\g5Â0Û?$ê 0QZËn>¥itï˜ÿ«é1xĦ¥Á¦GcÓop4ϲÛx7M§@‰´¹½óªYùt¤V0VØZG¶”^äü\KÊÑ­Vx ÿÓ©ËßSLu׫դá‹y@Xß%ÈÐhš7PŒyw…"°Å‰ÑõÇ£J˜=iºX§£Oèb˜šŠÄc¼Ñ½(Ÿv®/™­Øzè| ·µð@èп¾hœ39ï@«éY–_É鋦òiÿñmÌ’ŽÜc#SlÍù#œ7æãå5C+gÉz ŒVøõŠçåÙß“¦ÂË9=ìÅtÏpi±¾9/ßhCŒ6É\þB;œÓ?m¨Ot°l*Ÿ15æYn•®˜ †úŒZ•=0ý<}¿·æÿjzLæŒOXšj›ÏÿÏ0{cC2MñújÓÜ^S€W- nE:Т,¿Ÿ°õZZY^ï嫜“êúóÉN [»ŽGCóF°±úV–h «¦ÁF€×lø«•­¿ùØÀ^p<ž²eŒ2U77éŒòég>ï'´U_’ú–'»¼šžeùjb1bU>·µ[Œ“3úH¶äõ(²¾N7‘º¢ëmG€{zÅó‹IýþµÂøµé§Ó³à†Ñ–åmpÊÞµò⥠>o'2[ÔIݘ|isZ60X~ ÀJxkþ¯¦g;Àq}zÖœm©›»@Œ×³‚VíÝàïÀ±üKIyZ²:®´œÜõEbq€;Ã[œ?hNoá}c5“cÝúK6W¢¯x’,ÍÈôÓ4ø„‡Ùj¢Þ»Þïö©¤·|Jëž~æNýswÒ>ã+ÔëŽÖ(»3À«éY–ÿÚÕ+ÍåoXK®¾€ÔÆ{—}qù3šñÒ͵̃"$M;Þô­¿þòÛl9=æ;†Fï]–o´!:쬕¿1¶ólÝU£ýµoËýf³àm3À¹Õç¹àó5=zs€Ió…løuºU„ñú÷ ¹½ô1f*Þ‚cÛÀÔWX–[/—¹rÍÇjØù{–(K¢…Ô›œÿ»Lï°áÚú¦‹4£¶²ö“†oHY%¶!SÖØeã+ô„·Ú´'ë{¶†‹ýݵ&ûJ_Û9JÎØïcô3Ïæ©žŸVÜÑç}DNé…UR´zêóéqÑé1x4ß^^–OdU#p‚¬•oš ê|é×C;91•Ïì p ¬®»`!¹ì%›Þ1ÿõ鉲éiÑ/h¾°à@°Cú~#Àóùÿ1d_2NsÂ8™~ÛÌòEs{é÷åÈÔ+>åà– Xê}|Â+/àl·h|÷êP=}Ãó2·8þyQÔhgY´}Ù•‹A3—Ó¿‰‰8ìJ¡©ñœà—a¦Ñ±•¤$I ¶L)6§ŸÝ–y]Ë6¥ ?D?óÉ´ )-°T^#~–Js€;!E yLÓ³*¿<ÌMÓiÑ\þŽkþa6ТÏÎ$Ý&§ª,õÓ„R̯¸™›æ¿GJy‰}WÏZ¡D&Ï6žI]Îëc<ŸÃœ”JôWÓcpw¾¾,ŸÈSEJ…'d½ü¥ùÏHÚgSêæ]kå“7•t«´à~·Ðô}[Þ1ÿ…àbz¹››úÖ<é¦$e`x1ÿK©àg:eþàälKj4s{iUÃtCùØðiǦ¾IlõÐïºõrøk¤‡÷o†W­\‹bÑqÆÄîÃÒ›ôï?"fûPʸ¯6»#*,Þ8‹m½Ó8êÕ;!“é°ç3ÁÕïÓ'Ž©¯$íaÉ(b¼ñõÇ 1òÕ1ž¹õq1Ú=8¾?_¥'¼Q}'ês®M+_ãgodÆSùý][\M`ëN½÷9YS&¾¨ƒx;zE´¤Ç:Ü›°XPh.£Á/D™¯ÕkNŸ19‹éaM¦%Íè7Ð×r{Q> ç{c¶VþÒò@Ž¡äÙ(_Ÿ¬5e8_ÔÃ&ܘGóãŽûnÁe´¾Ïf"›¤Žw~¼ùÖüŸÄèlwÎëvkì…ów±yßw áûkóŸï^‹ |LøZo¯þ¡Ôf‹iš·àÄ/¢Öü®ob§¯Ò¿ÞnTàOÙ¹ßÊä´c¡ÏRÔÔôý¿ïø‘Iǽú·-¯>¸»|ŸÂ=Ôÿa-öWáà|Í3Ž–wÓú–^ø5rü”Œƒ:oíï++Ô³hÅüž6÷[Ý7Yÿà\’dញ۹E€Û 0‰¾ª¶í\'8¢–¿NyÝÊD¨„‡ú*ã40ðyÏ_uº_zßAc‡m£;ûý`û%é³v‡ß÷n fÍ/ â¢÷XTþOêˆë Ù§?®'Zó7ùià½(¸½GVV:_Ä^#8œ­”îE/?Q®äGi~µ;w¨Lé2AUÕÊr‘Ÿþ¤°bÚëÊVF¥{,9žã«Ö.«ÙœÒ<øcM^‘¾ÕM®-¶Ù~}4î‹cr¾,—ÀUö'ÏÜúÂ,ÖøÍN?=UpÀÆ`Û‘VÀ.XZÿÇþ§‘]À.`C€llàÿEýïå ÿcí]lq±s€¶ðú ?µúFGsH0ÀUÖ¼X…¾ÏX²ø–ÂOow€ïS·Õ÷xz0€!À6†ØØOþŒ\ °1ÀÆ~òl$àJ4­ÿw `?yB? p%ÀÆ`€gðiB€n°1ÀÆ`C€l °1ÀÆ`C€l °1ÀÆ`C€lÌ”¦NñîUÀULiz¯Þ½J¸Š)M*w÷*à*¦4&w¯®²JST½{•pUšRÿÞUÀu° `c¦4Uœw¯®bJSiz÷*à*8 ÀÆ`C€l °1ÀÆ`C€l °±Í4Õ£óÿîW%\j3MÏü¿ûU —Â*4€!À6†ØØZšÜÎñæøñhllÇbîù !vÃ*à ki’ÿæøà¸Ô1^X”Œ!Þk¯…ÜÊZšÊURSÛšç]’±Ï?Њ…HÄáy¯ŒfB¬LÊú"Wä–UÀ6Ó4þÔŠ%ÕÕÏŒ…@ÿ5J$¢r~—'̳‘Q¶6ñݸJ¸ÔfšÚ}˜Ò ݶ ú p‹¾Œ_¼`&9n\%\j3M//$æžvȨº 0¬àþëøìJW —ÚL“CH¥Ì ÝYxœþìêNÇéƒO¸q•p©­4õctC·ÓˆÇÃþ›‡ut36.®ÑþÚø!À·rJš\R¢·úk’s}ÇÕUÀ)p$€!À6¶¦1;fòc$¬Q8žŒ‡RF¯=W¸•í4UŠyùvW§æ{©|eq(eÎ{ó*à2Ûi>Êž–FHÍ9Žø‹.µF<åJ†×¥dã¥ÛW —Ù™&oBÿGÈö3¢G!~WÇøX_y–,©.°3MßôÁ£ "]u¦ ò¾< x»Óœp-œî˜¥D€Çî4»åŒJv}—[Æ¡”ìA²¦J8ßž4õctìéGŸÐ'YGß%Í…F€ÇùiÊ–ï^%ì†#±l °±ýirÇb“ÍëO:cóã(£N6j5ÞãŸ|©;àVö§Ij‹¿1Lã‰"´éãj|\Ryr"àVö§©÷!ÌJ¤ªö&oo$^ÕŠê»çË7?1ø•wÑG}üë„Ô_ùr»¾J8ÏÁ4ñâÇ;ÚñoR¯•ªDôm/ß;ÉÇιÐ p+G¬Uý‘dRßSTÓkWÃ*ªE}|V=ó§aàVŽø¥çq‰¤Ö«^]­xÂMx±Úó¸`€Ÿr$À®ì(ñIúù/2J´³E6°ì5wK£F`àhýUÀ¦‰.|ã3v,%û‰Èïë[º‘åø7‘L>èHã¤8 pg‡Ò4 ﺆ»sõ¬»öÓQÜCN‚Ü ŽÄ°1ÀÆJ¹=гZ©ŽÆœä"0À­<”r{`§´|Ú/¼I p+¥ÔFjÏãh÷zRTØí‘Ué³ö{´Wºð6…0À­L“·MÚ#®0ùJVlÂ.¨Ã©U7ˆÂŸ|òÑyUÀ¦©_ÿL‹œÊ.£“ ¤g&¾JC2®ŽeE•p†ƒijûU‘û&ý;Ø*ça~KtfÒUÆB€nå`šj™bæ õ¾k¤«ú¤åÔÙt¤¦`€‡p8MœS›p*G·w%GHÇãTÙÍ¿ãäò-`àvާ)®_…2 ?÷„}Ç ¼E•p‰`c0€íJÓDˆ]PÒUUÀ%v¥©S·4a0À­ìLØ `c0€!À6¶/Àל­pI•p}ܹJ¸À®4Íu2»o•p ‰`c0€!À6†Ø `c0€!À6†ØØfšñx€”£÷¬.µ™¦‰¦MˆãÄ;ýÞ¦J¸V¡l °1ÀÆViâù»W ×Y¥‰Ëi÷®®cJ“ÊݽJ¸Š)M~çÝ«€«˜Òä•î^%\Å”¦â î imageIndex [label="1..*"] imageIndex -> manifest [label="1..*"] manifest -> config [label="1..1"] manifest -> layer [label="1..*"] manifest -> manifest [label="0..1"]; } crun-1.16.1/libocispec/image-spec/img/media-types.png0000644000000000000000000013173014432210717020574 0ustar0000000000000000‰PNG  IHDR8{ß.ibKGDÿÿÿ ½§“ IDATxœìÝyXUÕþ?ð÷”Iá  2HŽ]Í J¼š@æŠZ~ïM¤Âég^I¯C^Ä!­,ÍôZ8\µÌ®¦XVÄõf(8ƒ‰¤¥†\A‘A!F™dúüþðaçQ†8z|¿žç<gíuÖú¬½Ïóa¯½¶JDDDDDDDÀHßé """""2LpˆˆˆˆˆÈ`˜è;"CwòäI¤¥¥é; "¢fáææ†Ç\ßa)T\d€¨y7áááúƒˆ¨YXZZâØ±cpww×w(DD˜à5»qãÆÂÂÂô ‘nýõ¯ÅñãÇQ^^Žüú‰ˆˆ×àQÓÃÓÓxá…púôi}‡DDćˆˆˆšÎØØß}÷“"z`0Á!""¢ûbnnÎ$‡ˆLpˆˆˆè¾1É!¢"""Ò &9Dô à}pˆˆˆ¨ÉÒÒÒîY%rÒ¤I¸qãžþyÄÄÄpu5"jQ\&š¨™q™h2tÉÉÉØ¶m¶oߎ'N S§Nú‰ZHll,ž}öÙzëøúúò÷µ(NQ#"ÒÂÂ… ¡R©4ݺuÓwXM¢ë±Ìš5 kÖ¬Aff¦£¤‡Aÿþý!"u>|}}õ"=‚˜àiaÕªUÈÈÈ@=GÅ¥K—ôUÓèz,‘‘‘ÖUxDDD÷… ‘–áìì pww‡‘ÑÃû+T×c±··×EXDDD÷íáýëLDô¸|ù2-Z'''¤¤¤`ݺupuu…­­-6lØ ««+Ú¶m‹ h¼>55¾¾¾°³³ƒ¥¥%<==‘ Qgß¾}èÓ§Ú¶m‹¾}û"..îž8ÂÂÂàææSSS<þøãøê«¯=–ÄÄDÂÁÁ™™™X²d lmmáää„ððpº'Nœ€——,,,ðôÓO#99Y똞þyéq111X¾|¹òüóÏ?otìDDD !¢fåëë+¾¾¾úƒtdÈ!@nÞ¼)""Ç—V­Z Y¸p¡ÄÆÆJ^^žŒ9RŒŒŒ$88Xöïß/ÅÅŲlÙ2 ÑÑÑJ{2tèPÉÌÌ”K—.‰‹‹‹ôïß_Ù!*•J¶mÛ&EEE²uëV ÄÈÈHÒÒÒä³Ï>oooIJJ’ììl3fŒI|||£Æâåå%ÆÆÆ@fÏž-gΜ‘üü|ñööµZ-""+fff²zõjÉËË“°°0177’’’""RoL999(døðáR]]-………boo/aaaR^^®Ã#FúÄßD¤LpˆšÿÀ–»“Q—ÄÄD¥,""BÈ÷߯”%&& Ù¼y³RöÌ3ÏÈÆ•ç“&M;;;åùرcÅÁÁA#5j”ˆˆTTTˆ½½½\¼xQÙ~õêU ¯¼òJ£Ç2oÞ< ×®]SÊÖ®]+$--MDDÜÜÜdĈm( ޶1ùûû‹J¥’èèh™7ožDDDÔ/=|øûˆô÷Á!"ºO5ן´nÝZ)kÓ¦ ÀØØX)«Ù^QQ¡”ÅÇÇâââ°~ýz|õÕW033S¶[XX   åååÊë;tè Ü@ñܹsÈÊÊBÏž=ï‰ëüùóMËÝ1ÔÄ}öìYœ={“&MÒx»»»ò³¶1mݺ¿üò þò—¿ 88£Gnt¼DDDwã58DD÷é~.ÐOOO‡àãã???È·' †••æÏŸ›7oâÔ©S8räFŒÈÎÎpûf‹r×½çÎÓùX.^¼°³³«³Ž¶1YXX`É’%ÈÏÏDZcÇ4ÆMDDÔTLpˆˆô¤¨¨ÞÞÞ°¶¶F||<üýý5Μ@=0þ|œ;w:t€¯¯/¦NŠ7¬­­´ÜdkÎ"¥¦¦ÖYGÛ˜ÒÒÒðÅ_`Û¶mˆˆˆÀªU«t(=²8Eˆè>ÕL9«ªªRʪ««ë,«¬¬pûþ3)))ؼy³ÆT¶;ÏdÄÅÅ!22Ô¨SÃÝÝÖÖÖFEEÆKKKœ={ß}÷Ö¬YÓ¨±”••Õw¿~ý`dd„Ý»wcáÂ…÷œñÉÎÎÖ*¦¢¢"L›6 [·n…‹‹ Nž<‰¥K—¢oß¾:th£b&""ºÏài)''×®]$$$ ªª åå刎ŽDGG£ºº•••øá‡‡Fee%DQQQ€˜˜ܺu NNN€]»v¡  ááá8~ü8JJJpáÂÄÄÄ`÷îÝ8|ø0LLL4–V~ì±Çðã?ÂÌÌ Ë—/Ç­[·ggg¨Õj 2/½ôR£ÆrëÖ-;vL‹ˆ ¢¢111€C‡ÁÉÉ o¼ñΟ?‰'âÚµkHNNƾ}ûÆ ÃÇ\oLÙÙÙ3f ^xḸ¸€²Lô¸qãpèÐ!%©"""j4½,m@ôá*B†!((HYž¹æÑµkW5j”FÙ²eËÄßß_£ÌÏÏOYi­æQ³ Z`` XYYÉ“O>)_ýµìܹS,--eîܹRUU%±±±Ò¦M›{ú ŽŽŽJ|[·n•®]»Š¹¹¹ôíÛW¢¢¢=–j”}øá‡Ò¯_?²õë×Kee¥,Z´Hììì¤M›62aÂY¹r¥¸»»ËÆ%??¿Þ˜ÆŒ£´—™™)"¬èVóøñÇ›ëPR âï?"Ò•¯ê$jNãÆÐr×Ha Caa!¦Nª”•”” 99“'OÆ©S§îk‘¢æÄßD¤¼‡ˆè•˜˜ˆéÓ§+«’Õ°°°@¯^½àëëË䆈ˆè.üËHDô€ºtérss1cÆ $$$ °°ÅÅÅ8{ö,Þzë-Lœ8Qß!=p˜à= ^|ñEDFFâÊ•+ðññÜÜܰ{÷nüãÿ€£££¾C$jP~~>’““¹pµNQ#"z€9#GŽÔwDMvæÌtíÚèÙ³'žxâ ôêÕ }ûö…‡‡¬¬¬ô"&8DDDÔl¼½½„óçÏãâÅ‹øõ×_qèÐ!¤§§ÃÈÈ=zô@ß¾}áéé‰^x:uÒwÈDôc‚CDDDͦU«Vèß¿?ú÷ï¯Qž‘‘S§N)¹s碸¸Ý»wǰaÃ0räH 6 &&üªBDÃkpˆˆ Dnn.\\\°råÊí·´´;v쀷·7–.]Ú¢}ÓÃËÉÉ ÿ÷ÿ‡÷ßQQQÈÉÉÁ¡C‡ðòË/ãäÉ“=z4œœœ0{ölœ:uJ/1öïßáááz雈šŽ ÑCjÆ ÈÏÏ×(¨Tªã›o¾ÁܹsqìØ1ðÖjÔT¦¦¦4hV®\‰øøx\½z‹/ÆÑ£Gѯ_?xzz"""¢Î×_¿~›6mÂàÁƒ1sæLÄ”˜˜ˆË—/ë¤-"j9LpˆˆAD…qãÆá»ï¾ÓYÝÆ*..ƺuë4ÊÚµk‡ôôt,\¸P§}5äÕW_ÅÏ?ÿ¬Q6gÎiõå°1uéÑѱcGÌ™3 8v쬬¬ðÒK/ÁÛÛ»Ö÷Jpp06oÞŒèèhTVV6¹ßeË–¡W¯^øí·ßðì³Ï¢oß¾X¼x1››{?C"¢Â‡ˆH YYYøàƒн{w¼õÖ[=z4† vßu›jÆŒHNNÖi›÷ÃÖÖVãy`` ,,,0xð` :ááᨨ¨¨õµ©K&OOOìß¿qqq(--Å3Ï<ƒ/¿üR£ÎöíÛ‘SSÓûêkÚ´iðóóÃÛo¿ SSSDGG#33›6mB»víî«m"jLpˆˆê "8xð üüüЫW/\½zûöíÉ'0qâD˜™™5©îáÇ1pà@XZZ¢C‡˜>}º2ÕìÌ™3˜9s&\]]‘žžŽÑ£GÃÒÒîîî8|ø0€Û_ÀvìØ°±±J¥Bvv6vî܉"88Xcõõ—˜˜ˆÀÀ@888 33K–,­­-œœœ4®=HMM…¯¯/ììì`ii OOO$$$(ÛïžçììŒeË–!99sæÌÁ¿ÿýotêÔ .¼ç¿ï©K¶?ÿùÏ8qâ¦L™‚×^{MùÔ066Öø¬5…‰‰ nݺJ²TUU##~e"zh5+___ñõõÕwÔYYYòÁH·nݤOŸ>²uëV)**ºïº""¶mÛJDD„ܼySBCCÅÒÒR<<<¤¢¢B€˜ššÊÒ¥KåÚµkráÂyâ‰'ÄÔÔT.^¼(""+W®’——'"";vìµZ-$((Hëþ¼¼¼ÄØØXÈìÙ³åÌ™3’ŸŸ/ÞÞÞ¢V«¥¢¢BDD<<5&8DDw±··GPP.]º„·ß~‘‘‘èÔ©æÌ™ƒ .4¹îÕ«W%%%åNNN°°°@FFÔ9×ßÅÅåååuÆ}÷ëî·¿;¥§§ÃÇÇðññŸŸŸVKBWUUáÛo¿… €ªª*;v QQQðõõE«V­šT—®\¹''§fk?!!/¾øb³µOD̓ QT*†а°0œ;wŽŽŽÊ2µ_|ñÊÊÊU×ÙÙjý³‰‰ ºté¢<¯-yÈÍÍÅc=¦uüé¯>EEEðöö†µµ5âããáïïßà…Üéééxûí·Ñ¹sg„„„àÿý¿ÿ‡ÔÔT|ðÁèÚµk“ë’áKMMÕªÞ7ß|ƒóçÏãå—_n戈èaLjH X¸p!’’’ðÖ[oáÛo¿ÅU÷é§ŸFÇŽñå—_¢¨¨H©Ÿ––†ÂÂBøùù)eeeeSÝ.^¼ˆ7n(Ó´jV-»3ª™2Vsmû«IÔªªª”:ÕÕÕJ[GEJJ ¦L™¢1m®¾¾?øàãСC8xð ÆWç˜ÆÔ%ÕŸŸY³f¡W¯^ ÞÇæèÑ£˜4iþö·¿ÁÃã…"$¢‡"¢FP©Txá…Ž—^z©QuMMM±fÍäççÃßßÈÌÌÄôéÓ1|øpŒ;Vy­ˆàÍ7ßDnn.RRRð·¿ý }ûöÅ„ Ü^¸}m̧Ÿ~Šôôt:tpòäI”––jÕß­[·pìØ1@tt4Dˆ‰‰:tŽŽŽ€]»v¡  ááá8~ü8JJJpáÂÄÄÄ ::Àí/žÅÅÅ ÁêÕ«Ñ­[·÷icê’áìØ±ݺuÿþõ/á×_­µnEEV®\‰¡C‡bذaذaƒF;(--EFF†ÆVàöûL­V#..®Þ2"zø1Á!"jAãÆÃÞ½{qõêUtéÒýû÷ÇSO=…o¿ýVã^2pssC÷îÝáîîŽ.]º`ÿþýÊ™±cÇbÀ€xíµ×`ii‰Ÿ~ú £Gœ8qÏ>û¬Vý >?üðàÕW_ÅÚµkáíí­Ü' ÇŽC`` ¾ùæxyyÁÄÄAAA055ŧŸ~Š’’åÌÒ‰'ð§?ý©Åö'=Ü1xð`Lž<¹¹¹¨ªª‚‰‰ N:¥Q¯²²;wîDïÞ½±bÅ ¼ûî» CëÖ­•: ,€³³3ÊËËsssüüóÏÊöš3Žw~Îj+#¢‡ŸJ´¹J”ˆšlܸq€°°0=GB‹7Þx_|ñ…Æ´2¢‡Q]¿ÿŠ‹‹±zõj¼ÿþû 1%ÍÄÄ“'OÆ'Ÿ|‚sçÎaÇŽسg²²²àïïåË—£S§N-6"zø˜è;""ÒTUU¥q= ‘!‰ˆˆÀ´iÓðûï¿×z­Mee%8777œ;w]»vÅßþö7Lš4 ;wÖCÄDô°a‚CDô)((@||<ÊÊÊpôèQxyyqú „¤¤$LŸ>„J¥ªw™ñ´´4 6 ›6m€ø ¢Fá58DDˆüü|¨Õj$$$ž{î9lÛ¶MÏQÝŸªª*,_¾½zõ‘#GÔ¾ úª««1iÒ$xzz2¹!¢Fã"¢„Z­Öêæ™D‹´´4$$$à믿nÔëZµj…S§NÁËË«™"#"CÆ38DDD¤s øý÷ßaccƒîÝ»ÃÔÔTÙfddSSS˜˜ÔþÖêêê{VR#"ÒÏà‘Î=ýôÓpwwðÇ*jׯ_Grr2RRR’’‚ääd\ºt —/_FVV–rƒÙêêjœû ÇŽCff&JKK‘””„~øÿú׿ðꫯ¢¼¼\ß!ÑCˆgpˆQß|ó æÎ‹ÜÜ\ 8Pc›ˆèüÂÞ 6`üøñP«ÕÍÚÏ***påÊ<þøãÍÖǬY³Õb_Ä´Ýgͽo[Š.ÆÑÒÇHׯ_Ç×_½{÷â‰'žÀ† ê¬[VV†±cÇâû￯u»ˆ(‡YëÖ­Ñ­[7tëÖMß¡ÑCŽ Ñ#êÕW_…——\]]5ÊÛµk‡ôôtöU\\ŒuëÖaüøñÍÚÏÝ~øá 6¬YûˆŒŒÄòåËñöÛo7k?€öû¬%ömKÐÕ8Zòi+88ñññøå—_î;·µµEFF†Ž"#"zø1Á!z„ÙÚÚ¶H?3fÌ@rrr‹ôu§ÐÐP¬ZµªÙû±··oö>èþŒÂÒÒ:tÀôéÓ‘ŸŸHLLD`` ™™‰%K–ÀÖÖNNN×h§¤¤ùùùpvvF= R©”Ço¿ýX³fRöÞ{ïiÝö‰'àåå <ýôÓZ'oõ­¡ý\ß±¹Smõ._¾ŒE‹ÁÉÉ )))X·n\]]akk«L ««+Ú¶m‹ h´Yßñ­±oß>ôéÓmÛ¶Eß¾}wOlaaapssƒ©©)üq|õÕWGcŽ¿6Ǩ®xžþy÷KLL –/_®<ÿüóÏkY›÷ÙÞ½{•úÆÆÆ033«sh£¬¬ _|ñ „ÀÀ@¥<)) Ï=÷Ôj5‚‚‚°}ûv\¿~]Ù®«ÏÑIˆ¨YùúúН¯o£^ãáá!C‡•ÌÌL¹té’¸¸¸HÿþýEDÄÑÑQˆ©©©,]ºT®]»&.\'žxBLMMåâÅ‹ZÕ)--²xñbÙ±c‡¨Õj AAAJ<{öìGGG9r䈔””Èßÿþw {öìi0^‘•+W ÉËË«·ŸHÛ¶m%""BnÞ¼)¡¡¡bii)RQQ!^^^bll,döìÙræÌÉÏÏoooQ«ÕRQQ¡´µ{÷nÙºu«ˆˆdeeÉóÏ?/$""B©S]]-3gΔO>ùD<==µj;66VÌÌÌdõêÕ’——'aaabnn.$%%¥ÎcÚÐØÚÏuí³»ÕVoøðáÒªU+ .”ØØXÉËË“‘#GŠ‘‘‘Ëþýû¥¸¸X–-[&$::Z«÷£ˆHDD„¨T*Ù¶m›ÉÖ­[€###IKK“Ï>ûL¼½½%))I²³³e̘1bdd$ñññZCÛã¯Í1ª/žœœ 2|øp©®®–ÂÂB±··—°°0)//¯5fmÞgÕÕÕ¯±¶¶–€€€:§ÈíÏé¨Q£jݶk×.±±±2oÞýôS­â½;Á©­ŸêêjéÞ½»Ìœ9Sc_Ô|áÞ´i“ˆˆÌ›7Oȵk×”:k×®’––¦”½üòË’››«3ùä“O4ÚŸ}Zë:µ±³³Óx~êÔ)dgg£OŸ>JÙ“O>‰œœ¼þúëZÅ«M?ñññHJJ‚›››Fù´iÓܾPøãZŠ;§öXXX€Òg^^T*lll4b2d6oÞ¬”9sýû÷Wž7ÔöÙ³gqöìÙ{.¨¹×G]´›6ûùî}V—ÚêÕŒ­uëÖJY›6m@ã=R³ýÎã×Ðñµ°°@AAÆ*e:t@||<àܹsÈÊÊBÏž=•©Z=öàüùóMÇý#mãÙºu+z÷î¿üå/°··Çèѣ댵†6ﳆ|ùå—+£•––bÔ¨Qe"‚W^yÀíkéîœnjnnGGG 4ÁÁÁHOOǬY³”c¢«ÏÑƒŠ Ñ(==>>>€üüü4–€52ªý£ëââ¢|ÉÔ¦Nmî~]VV ;;»ÉñjÓÏÕ«WܾvæNNNN°°°PV‰ªk\wÚ»w/^~ùå{Êß|óMÄÇÇ+7ܳgÆÊn µ}ñâEÚ'5´›6ûY›±×UOÛ×Ö¦¡ã +++ÌŸ?7oÞÄ©S§päÈŒ1ÀcJKK»çKú¹sçt:mŽ‘¶ñXXX`É’%ÈÏÏDZcÇ´^†¹¡÷Ys¸{¿„……A­VcÕªUèܹ3/^Œêêj~ΈˆTü Fô€)**‚··7¬­­ÿZ/D®íËVnn®òŸhmë4¤]»v€;wÞW¼ qvvðÇÔ;™˜˜ K—.Z·—^zéžòQ£F¡{÷îØ°a `nnÞ¨U¬jÎn¤¦¦jý@»±5´ŸõE›ãÛ£GÌŸ?çÎC‡àëë‹©S§bãÆkkkÜ;9isŒ´'-- _|ñ¶mÛ†ˆˆ­Wä»ß÷™.xyy!)) ëÖ­Cûöíñþûïã£>Òé猈èAŇèsôèQ¤¤¤`Ê”)S‡îNVÊÊÊPZZª<¿xñ"nܸ1cÆh]§fªIee¥Rçî²¾}ûÂÒÒ{öìÁ²eËpãÆ Ü¼y‘‘‘xçw´Š·fúÌew÷óôÓO£cÇŽøòË/QTT¤ÔKKKCaa!üüü”1@UU•R§ººZi+##666Êtš;©T*Ìž={÷îÅÚµk1yòä{öi}m÷ë×FFFؽ{·R~§ºÎ¾h3¶†ösmû¬.õ×ÚÆV×xíÞqqqˆŒŒÄÁƒQ\\Œ«W¯bíÚµÊ1pww‡µµ5‚ƒƒ±zõjddd   GŽÁüùó5]#mâ)**´iÓ°qãFL™2S§NÅÒ¥KUg¼5zŸ5·²²2¬X±fffxóÍ7‘˜˜ˆž={âäÉ“:ûœ=ÐZìj¢GTc/²ýù矀Lœ8Qòóó%,%JH IDAT,Lž|òI111‘óçÏKtt´ˆJ¥’iÓ¦INNŽ$''‹§§§üùÏVVxҦηß~+dÀ€RTT$""ßÿ½RVRR"""«V­ºçg+++9þ¼VñnÙ²EÈ?þ(Ÿ|ò‰¤¥¥ÕÚOhh¨—^zIÒÓÓ%##CF­¬dUVV&ÇW.°®®®–òòrñõõ²eËY³fDFFÖ¹oÞ¼)jµZ^|ñErmÚ®®®–3fñ÷÷—ÔÔT¹|ù² 6LˆZ­–U«VÉÇ,ÖÖÖ«´ßÐØÚÏu›Úúº»Þ­[·ä/ù‹rñ{UU•TTT(+…-X°@***¤ººZ9VcÆŒ‘²²2­ŽïìÙ³k½ÞÕÕU8 ""ëÖ­»g»‰‰‰>|XëqèòÕOVV– Ôj5Ï=÷¶mÛÖè:Dºòâ‹/"22W®\ìììàææ†Ý»wãÿøõ¢Artt„¥¥%^ýu¬^½и‰+Ñ£ŒSÔˆ"jµºÁ³1ÚÔ!Ò¥‘#GbäÈ‘úã‘âææ†+W®è; "¢Ïà‘Á`‚CDDDDDƒ  &8DDDDDd0¸ÈQ 8yò¤rÃ;"¢GÅÉ“'ñì³Ïê; "zÄ0Á!jfýû÷×wôKNNtéÒEϑУèÙgŸåï@"jq*áz²DD«æÌaXX˜ž#!""j¼‡ˆˆˆˆˆ """""2LpˆˆˆˆˆÈ`0Á!"""""ƒÁ‡ˆˆˆˆˆ """""2LpˆˆˆˆˆÈ`0Á!"""""ƒÁ‡ˆˆˆˆˆ """""2LpˆˆˆˆˆÈ`0Á!"""""ƒÁ‡ˆˆˆˆˆ """""2LpˆˆˆˆˆÈ`0Á!"""""ƒÁ‡ˆˆˆˆˆ """""2LpˆˆˆˆˆÈ`0Á!"""""ƒÁ‡ˆˆˆˆˆ """""2LpˆˆˆˆˆÈ`0Á!"""""ƒÁ‡ˆˆš¬ÿþ×wDDD &8DDˆëׯcÓ¦M‹¾}ûbñâÅppp@nn®#&""j<}@DD-cûöí¨ªª‚¥¥å}µ3mÚ4ãí·ß†©©)¢££‘™™‰M›6¡]»v:Š–ˆˆ¨ix‡ˆèbll 33³ûjÃÄÄ·nÝ˜ššªªª`dÄ?)DD¤ükDDD²uëVìÛ·+V¬Àï¿ÿŽ!C†ÀÅÅo¼ñnÞ¼©ïðˆˆèLJˆˆeéÒ¥¸páºvíŠøøxœ>}ï½÷nܸ¶mÛê;<""zÄ1Á!"¢&ëÔ©zôè¡ï0ˆˆˆ\d€ˆˆš,!!Aß!ià"""""2LpˆˆˆˆˆÈ`0Á!"zDˆ222PZZŠŒŒ ”••il Z­F\\\½eDDD2&8DDˆ ÀÙÙåå刈ˆ€¹¹9~þùge»ˆT*U½eDDD2•Ôüõ"""ƒ3nÜ8@XX˜ž#!""j<ƒCDDDDDƒ  &8DDDDDd0˜à‘Á`‚CDDDDDƒ  &8DDDDDd0˜à‘Á`‚CDDDDDƒ  &8DDDDDd0˜à‘Á`‚CDDDDDƒ  &8DDbýúõP©Tððp„‡‡ßS¾~ýz}‡KDDÔ,T""ú‚ˆˆîß7àì쌪ªªzë#==-QËá""áàà€ÂØØ¸Î:ÆÆÆxþùç™Ü‘Áb‚CDd@&L˜€úNÌ‹&L˜Ð‚µ,NQ#"2 ………°³³Cyyy­Û[µj…ììlX[[·pdDDD-ƒgpˆˆ ˆ••F“{¶™˜˜`ôèÑLnˆˆÈ 1Á!"20þþþµ.4PUU…ñãÇë!"""¢–Ã)jDD¦¬¬ ¶¶¶(..Ö(·°°Àï¿ÿsss=EFDDÔüx‡ˆÈÀ˜™™aìØ±hݺµRÖªU+Œ7ŽÉ <&8DDèµ×^ÓXh ¢¢¯½öš#"""jœ¢FDd€ªªª`ooÜÜ\€ ²²²j]|€ˆˆÈð ‘266†¿¿?Z·nÖ­[cüøñLnˆˆè‘À‡ˆÈ@½úê«(//Gyy9§§Ñ#ƒÿÎ#j‚qãÆé;"­Ô,*ðÏþSÏ‘íÛ·ÇÚµkaaa¡ïPˆÈ€ñ Q„‡‡ãÚµkúƒ¨A=ö:uê¤ï0ˆpíÚ5lÞ¼/¾ø"JJJô0.2@Ô*• ¡¡¡<“C¼_~ùлwo=GBº°°0øùùÁÖÖ={öÄþó´iÓFßa‘â""Ö»wo&7ô@‰ŠŠÂÅ‹1räHé;"2@Lpˆˆˆ¨Å¸¹¹1É!¢fŇˆˆˆZ“"jNLpˆˆˆ¨Å1É!¢æÂ‡ˆˆˆô‚I5Þ‡ˆˆt&77O=õþþ÷¿#88XcÛ¯¿þŠÀÀ@=z˜4iÞÿ}˜˜ðOÑ£Ä××÷ž2www9rƒ ÂO?ý¤‡¨ˆÈð =Ò.\•J¥ñèÖ­›¾Ãz¨‰T*•FYzz:¼½½1{öl\»v “&MÂgŸ}†ôôô&÷³aÃäççßo¸ÔBƇµk×ÖºM­VÃÍÍ §OŸnᨈÈñ>8DMÀûà–ÌÌL <¿ýöŽ=ŠÀȈÿÿÑ¥U«Váý÷ßGaa¡NÚ+..ÆSO=…øøx¨Õj´IúUsŸ~-!¢ûÅ¿àDôÈstt„³³3€ÛSe˜ÜèÞ•+Wкukµ7cÆ $''ë¬=""2ü+NDT‹Ë—/cÑ¢EprrBJJ Ö­[WWWØÚÚbÆ €¸ºº¢mÛ¶X°`ÆëSSSáëë ;;;XZZÂÓÓ uöíÛ‡>}ú mÛ¶èÛ·/âââî‰#,, nnn055Åã?ޝ¾úJ/1'&&"00ÈÌÌÄ’%K`kk '''„‡‡JKK±sçN 8P¹þ&** *• [¶lANNŽ2 0--­Áñ%%%á¹çžƒZ­FPP¶oߎëׯcÚ´iرcÀÆÆ*•Š§Ñ„ˆ €„††ê; Ò¡!C†¹y󦈈 >\Zµj%dáÂ…+yyy2räH122’àà`Ù¿¿˲eË€DGG+íyxxÈСC%33S.]º$...Ò¿e{DD„¨T*Ù¶m›ÉÖ­[€###IKK“Ï>ûL¼½½%))I²³³e̘1bdd$ñññµŽ¡9cöòòccc ³gÏ–3gÎH~~¾x{{‹Z­–ŠŠ Ù±c‡¨Õj AAA±½þúëÒ¾}{²†Æçáá!áááRZZ*111Ò¾}{ÉÌÌ‘•+W ÉËËkÚ§Nhh¨ðk é“5Ãsw‚#"J˜˜¨”EDDùþûÄÄD ›7oVÊžyæÙ¸q£ò|Ò¤Ibgg§<;v¬888hÄàáá!£F‘ŠŠ ±··—‹/*Û¯^½*ä•W^©sÍó¼yó€\»vM)[»v­´´4IKKÓ*Áih|%%%@~úé'e{HHƇˆt…ksÕÁÞÞ4®iÓ¦ ÀØØX)«Ù^QQ¡”ÅÇÇâââ°~ýz|õÕW033S¶[XX   åååÊë;tè ¬"uîÜ9dee¡gÏž÷Äuþüy½Ä\ÓöÝ㸳;;»:c»SCã377‡££# „™3gbæÌ™˜5k–VmÑ£×àÕá~HOO‡àããsÏêPÁÁÁ°²²ÂüùóqóæMœ:u GŽÁˆ#ÙÙÙ€´´4Èí³íÊãܹsz‰Y›¶µí_›ñ………A­VcÕªUèܹ3/^Œêêê&ŒŒˆˆ%Lpˆˆt¬¨¨ÞÞÞ°¶¶F||<üýý5Îz@=0þ|œ;w:t€¯¯/¦NŠ7¬­­Üþ’ÿ Ä¬KÚŒÏËË IIIX·nÚ·o÷ß}ôQ³ÅDOOOLœ8ï¼óvíÚ…¸¸8-/NDNQ#"ªCÍ´«ªª*¥¬æ Bme•••€£G"%%›7oÖ˜vçÙ¸¸8DFFâàÁƒuj¸»»ÃÚÚÁÁÁ¨¨¨Àøñãaii‰³gÏâ»ï¾Ãš5kZ<æ²²²Û©é¿æyòòrܺuKëñ­X±kÖ¬Á’%Kðæ›obÊ”)èß¿?Nž< ÊD…÷L18}úôÁÿþ÷?ÄÅÅáÊ•+(//tîܽ{÷FïÞ½áææ†gŸ}...zŽ–ˆD<ƒCD¼œœ\»v €ªª*”——#::êêjTVVâ‡~>|•••DEEbbbpëÖ-899víÚ…‚‚„‡‡ãøñã())Á… ƒÝ»wãðáÃ011Q–NV©Txì±Çðã?ÂÌÌ Ë—/Ç­[·ggg¨Õj 2/½ôR­ãhΘøá;vLi[DPQQ˜˜À¡C‡ "8tèàäÉ“(--p{êÛÑ£GQTT¤Ä§ÍøÞ}÷]lÙ²(((€ˆ`РAn/ ܾnèÓO?Ezzú}¼èA‚ÿüç?HLLDII ._¾Œo¿ýS§N…¹¹9öíÛ‡×^{ ;v„««+^yå¬_¿ÿûßÿ´î#++ ~~~°²²Âc=¦œ9mŠëׯcÓ¦M‰ÿþ÷¿n_3¶cÇôë×OIn`Ĉ¨¨¨ÀŽ;šÔ¿±±q³.ÊADÿ DD-ìÒ¥KÈÍÍÅŒ3€ÂÂBãìÙ³xë­·0qâD}‡HôPëÓ§¶lÙ‚ß~û nnnðññAPP.^¼ˆ¬¬,tìØQ£~·nÝÜ^üƒˆ~\Eˆ¨…½øâ‹ˆŒŒDHH|||——‡Ž;âå—_ÆÂ… • è‰èþtìØ{÷îÅ®]»0iÒ$eu¿š›ÖÖP«Õ€7n´xŒD¤{Lpˆˆô`äÈ‘9r¤¾Ã z$øûûãÔ©SÊ}—,,,4¶×,}ÞºuëˆtSÔˆˆˆÈà=õÔSÈËËp{iø;Õ”wèСÅã""Ýc‚CDDDœœÌ™3{÷îm°nee%>ÿüsxzzÂÊÊ IIIÛkî¡óÜsÏ5K¬DÔ²˜àˆÒÒRìØ±ÞÞÞXºt©Rž›› ¬\¹²Yûo©~péÒ¥fk?99‹/†““®\¹ÒlýÚï³–Ú·†®¾ýøë¯¿bäÈ‘hÛ¶-¨\¯aHrrràììŒ+Vè;”&+--ÅÊ•+áêêŠ$$$Ô[?77ýë_ñóÏ?ãÃ?ÄĉqìØ1äçç+u8sssøúú6wøDÔ˜àˆo¾ùsçÎűcÇˆ@¥Ré´¿ 6h|Ah®~îTQQ+W®àñÇo¶>fÍš…5kÖ 33³Ùú¸“¶û¬¹÷í£¢¶ý˜žžoooÌž=×®]äI“ðÙgŸ!==½ÉýÔöùhªëׯcÓ¦M&Ož,½{÷PoÝÒÒR5j”Númi¡¡¡R××’ØØXéׯŸ¨T*Q©T@y8;;+õª««åôéÓ(vvvbff&o¾ùæ=Ç"99YFŒ!Ò£GùüóÏ5¶ôÑGbmm-qqqõ–‰ˆÌ›7O#’p¿»ƒˆîWQ#2 ¶¶¶-ÒÏŒ3œœÜ"}Ý)44«V­jö~î^B– Û•+Wtºz–®?Û·oGUU,--uÖæÃ"55‹-ÂîÝ»all\ë™§ŒŒ „……!** ‘‘‘ÈÈÈ@§N0kÖ,L:ŽŽŽ÷¼¦sçÎØ¿ýΙ3sæÌi° Ö¬Yƒ5kÖ4atDÔ\8E¨¤¦¦Â××vvv°´´„§§§2oüÌ™3˜9s&\]]‘žžŽÑ£GÃÒÒîîî8|ø°ÖuÜ3õ¦´´;wîÄÀ¬±mÿþýèׯÌÍÍѹsg„„„hï´iÓ”»}ÛØØ@¥R!;;»Î~>ŒÂÒÒ:tÀôéÓ•©;‰‰‰ „ƒƒ233±dÉØÚÚÂÉÉ áááí””” ??ÎÎÎèÑ£T*•òøí·ßÜþ¢QSöÞ{ïiÝö‰'àåå <ýôÓZ9­ol íçúŽÍj«wùòe,Z´NNNHIIÁºuëàêê [[[lذÀíé4®®®hÛ¶-,X Ñf}Ƿƾ}ûЧO´mÛ}ûö­õˆaaapssƒ©©)üq|õÕWuŽ£9cÖæ}TÛ~ŒŠŠ‚J¥Â–-[““£¼wÒÒÒ_RRž{î9¨Õjaûöí¸~ýz­Ÿ¢¢¢{ö‡6ïá;/ž766†™™YûWeeeøâ‹/0hÐ 68–ºú 7F^^.\ˆnݺ!,, "Rç5Q"?~&LÀÑ£G‘œœŒ¥K—ÖšÜÑ#@ÏgˆJhä5:t¨dffÊ¥K—ÄÅÅEú÷ï/""ŽŽŽ@LMMeéÒ¥ríÚ5¹pá‚<ñÄbjj*/^ÔªŽÈíé)¸cŠÚŽ;D­V RâÙ³g8::Ê‘#G¤¤¤Dþþ÷¿ Ù³gOƒñŠÜžÒ@™öQW?¶mÛJDD„ܼySBCCÅÒÒR<<<¤¢¢B¼¼¼ÄØØXÈìÙ³åÌ™3’ŸŸ/ÞÞÞ¢V«¥¢¢Bik÷îݲuëVÉÊÊ’çŸ^HDD„R§ººZfΜ)Ÿ|ò‰xzzjÕvll¬˜™™ÉêÕ«%//OÂÂÂÄÜܼÁ)j ­¡ý\×>»[mõ†.­Zµ²páB‰•¼¼<9r¤Ipp°ìß¿_Š‹‹•évÑÑÑZ½EnOT©T²mÛ6)**’­[·*SoŒŒŒ$--M>ûì3ñöö–¤¤$ÉÎΖ1cƈ‘‘‘ÄÇÇ×:ŽæŒY›÷Q}ûûõ×_—öíÛk”54> —ÒÒR‰‰‰‘öíÛKff¦ˆÜûù¨6ïáêêj×X[[ß×µ]»v‰yóæiìۺƢËÏpCj¦¨mÙ²EÔjµ˜˜˜Ü3õ«¶‡‰‰‰|üñÇZ÷CD† Q46Áyæ™gdãÆÊóI“&‰òÜÇÇGÌÍÍ¥²²R);tèéÓ§k]çîGD$--MãK]YY™ØÙÙÉ–-[”:¿üò‹´k×N>ýôS­â­í ÜÝýTWWK÷îÝeæÌ™û¢æËë¦M›Däùë×®]Sê¬]»VHZZšRöòË/Knn®FÌä“O>ÑhòäÉÊÏÚ´íææ&#FŒÐh#  ÞG›±i³ŸïÞgu©­^M_‰‰‰JYDD„ï¿ÿ^)KLL²yóf¥¬¡ã;vìXqppЈÁÃÃCùâ\QQ!öööJb-"rõêU ¯¼òJãhΘµ9Öuíﻜ†ÆWRR"ä§Ÿ~R¶‡„„4*ÁÑî=|§Ú???­’€š^dggk$8õEןá†üãÿÐj,w?Z·n-³gÏÖº"2|œ¢FÔâãã1cÆ ÄÅÅaüøñ EEE…²ÝÅÅFFF066VÊ +++œ>}Zë:µ±³³Óx~êÔ)dgg£OŸ>JÙ“O>‰œœ¼þúëZÅ«M?ñññHJJ‚›››Fù´iÓ‘‘‘þ¸ÞåÎé75w¯é3//*• 66612›7oVÊΜ9ƒþýû+ÏjûìÙ³8{ö,† ¦£»»{½cÕflÚìç»÷Y]j«W3¶;¯iÓ¦ h¼Gj¶ßyü:¾(((@yy¹RÖ¡CÄÇÇÎ;‡¬¬,ôìÙS™NõØcΟ?_ç8š3fmÞGÚîï†ÆgnnGGG 4ÁÁÁHOOǬY³}“HmÞà ùòË/5VF+--ŨQ£4ÊD¯¼ò €Û×éÝ9•µ¾±èò3Ü´´4åæ›ýúõCÛ¶m•m­Zµª÷©òòò—Š&¢G ¢žžÀÇÇ~~~ËÕþQtqqQ¾djS§6w¿.++ ÝäxµéçêÕ«n_;s''''XXX ##£Ö×ÕfïÞ½xùå—ï)óÍ7“'OöìÙƒñãÇ×ÓÝ.^¼@û/¾5´›6ûY›±×UOÛ×Ö¦¡ã +++ÌŸ?7oÞÄ©S§päÈŒ1ÀcJKK»ç‹ô¹sç5]ŬMÛÚö¯ÍøÂ V«±jÕ*tîÜ‹/Fuuu£ÇÕÐ{¸9ܽê‹.?à qqqÁÈ‘#±±±(,,DFF¢¢¢°víZL™2 €µµµòšV­Z)IÕ/¿ürß1‘á`‚CÔÌŠŠŠàíí kkkÄÇÇÃß߿֋…kK rss•ÿk[§!íÚµìܹó¾âmÈ1¸ IDATHÍý$j’ˆ;™˜˜ K—.Z·—^zéžòQ£F¡{÷îØ°a `nnÞ¨•¦jþ+œššªõkíÆÖÐ~ÖmŽo=0þ|œ;w:t€¯¯/¦NŠ7€ò%3,,ì‰Y—´Ÿ——’’’°nÝ:´oßï¿ÿ>>úè£F÷u¿ïa]¨k,ºü 7…££#† ‚Y³fá_ÿúŽ?Žüü|deeáСCøøã1eÊxyy¡U«V #Ñ£ Q3;zô(RRR0eÊi8w'+eee(--Už_¼x7nÜÀ˜1c´®S3äÎÕ†î.ëÛ·/,--±gÏ,[¶ 7nÜÀÍ›7‰wÞyG«xk¦¸ÜYvw?O?ý4:vìˆ/¿üRc©´´4ÂÏÏOTUU)ujþ^YY‰ŒŒ ØØØ(S^î¤R©0{ölìÝ»k×®ÅäÉ“ïÙ§õµÝ¯_?a÷îݵþ÷½®³/ÚŒ­¡ý\Û>«K}ǵ¶±Õ5^@»÷c\\"##qðàAãêÕ«X»v­r ÜÝÝammàà`¬^½(((À‘#G0þüÇÑ17t¬ïìÿîý]^^Ž[·n)Ï_YYV¬X333¼ùæ›HLLDÏž=•³0µ}>êÒÐ{¸¹Õ7]}†uÍÎ΃ ÂôéÓ±qãF=zYYYž"HD†‹ Q3srrìÚµ ÇñãÇQRR‚ . &æÿ³wçqQÕûÿÀ_ƒ(²ã‚.e^Ó«( &’¹€[Ý@îOAÑ BÍ%\"Qo×JÅ — TPo×ÈLwÑ@pAS¯; B ÈüðsPà°¼ŸÇ<Š3Ÿùœ÷çsÎŒóžÏ9ŸÏIe_†æÎ‹ÌÌLÜ¿Ÿ|ò lmmááá!Ô¥©LLL €²/„yyy€èèhÀ… PPPøûûƒˆ°bÅ ˜™™ÁÈÈ'N„‹‹‹¨x•÷ÂÄÇÇcçÎHII©´¬[·YYY˜4iRSSñäÉøøø`äÈ‘pqqAQQΞ=+ÄND())ú$::aaaÂ)u<==¡§§‡ÄÄD•_”ÅÔmaaO?ýIII˜zô¨ÆcMDjû;%%gΜAnn®Ÿ˜ö­\¹Û·oGvv6²³³AD6l¨}¨;®šÎa%"Bjj* šš*$µ¥ª¶ÔÖ{XL¢Çcµª®f/`¬)C gQóõõ%###²´´¤ƒRhh(éëëÓ¼yó¨´´”¼½½I__Ÿ6oÞLmÛ¶%###òð𠌌 ¡MeŽ9RiuïC‡©l³²²êûöÛo©K—.d``@ǧ˗/‹Ž7##ƒL¦¦¦´oß¾j÷IVVV¤££C]»v¥%K–Paa! :Tåuk×®%;;»J³$išjvþüùtôèQ•mbêÞ´iÉårZ²d ™šš’yxxP`` Y[[ÓæÍ›)++«ÊÌ«k›¦~®ªÏ*îK]¹Ñ£G«l[¶lMš4Ie››››0Û•ò¡œMÓñ%µ3V™›› m ¦îÝ»“®®.ÙÚÚÒñãÇUÚ]¾u³ƒƒƒÆcíèèX©/\¸P©}Ý»wר¾‚‚ ¢+VP‡¨S§N´råJaZçŠïuý!æ.ÿ\Å8Ô–£E‹´páBQm!zõ÷ð¦M›DÅ¥œ&š1Æ^•ŒˆZa¬¦d2öïß &ÔJ}Ÿ~ú)öìÙ£vAÀš”a¬6„‡‡ãÅ‹˜>}º°-??÷î݃§§'.]ºT+7–3ihkkcÙ²eð÷÷—:ááá¢&4aŒ1M´¥€1Vvízùë×_¶ c¯êÖ­[ðññ©tÿ‘žžúôéWWWNn1åçH¿~ý¤…1Æê ÿ+ŘIJ³³ÂÂBœ9sFí¯—bÊ0Vnß¾ÌÌL̘1 xñâòòòpåÊ|ùå—˜øãÇÇäÉ“‘››+uXŒ1ÆšÁaŒ±—téÒ%xxx -- AAA˜4i’Ô!5*.U Á!C¤‰1ÆXÀ#8Œ1VCr¹«W¯Æ!CеkW\»v“›—ðÑG!)) ½{÷ưaðhÑ"KcŒ±FŽGpc¬îß¿ÄÇÇ# .„–ÿVô*ˆ;vìÀ矎޽{#44={ö”:,Æcÿ«Ìc"…„„ _¿~xñâ.^¼???NnjL&ƒ——âââ P(`ccƒ 6ðtÁŒ1Æ^ ÿËÌc¤¥¥aܸq˜:u*¦M›†¸¸8ôë×Oê°šœ^½z!66¾¾¾˜?>F…ÔÔT©ÃbŒ1ÖÈp‚ÃcÕ8tèúôéƒk×®!&&6l@«V­¤«ÉÒÖÖF@@Î;‡û÷ï£OŸ> “:,Æc'8Œ1¦FNN¼½½ñüNNN¸zõ*Þyç©Ãj6ìì옘ˆÉ“'câĉ˜0až?.uXŒ1Æžd€1Æ*ˆ…‡‡²³³Œ>ø@êšµ_ýÓ¦MC«V­ðÃ?`èСR‡Äc¬ãÆû?r¹2dºwïŽÄÄDNn€Q£F!11VVV6læÌ™ƒ¢¢"©ÃbŒ1Ö@ñcŒ¸yó&ÜÝÝqóæMböìÙÉdR‡Å* ÁÌ™3ñúë¯cÏž=°²²’:$Æc à0Æš5"Bpp0mmm$&&bΜ9œÜ4P“'OÆÕ«Wabb‚AƒaõêÕP(R‡Åc¬á‡1Öl=}úcÆŒÁÌ™3ñÙgŸáìÙ³xóÍ7¥‹iЭ[7ÄÄÄ _~ù%FŒääd©ÃbŒ1Ö@p‚Ãk–"""`ii‰?þø'OžÄªU«Ð²eK©Ãb"ikkÃÏÏgÏžErr2,--*uXŒ1ÆNpcÍJvv6¼½½1aÂ8;;ãÊ•+°··—:,ö’lmm‘€)S¦`Ê”)˜0a233¥‹1Ƙ„x’ÆX³ OOOaçÎ;v¬Ô!±ZtìØ1L:¥¥¥Ø½{7œœœ¤‰1Ƙx‡1ÖäbÑ¢E>|8lmm‘””ÄÉM4|øp\¿~ï½÷F oooäççKcŒ±zÆ#8Œ±&-)) îîî¸wïÖ®] ///©Cbõ ""ÞÞÞ077Çž={`cc#uHŒ1Æê à0Æš$"† 0`Àèêê">>ž“›fÄÕÕ 055…PZZ*uXŒ1Æêà0ÆšœGaÊ”)8wî–,Y´hÑBê°˜ˆ7n„ŸŸú÷ïÐÐPtïÞ]ê°cŒÕ!ÁaŒ5)°¶¶FZZbccÀÉM3&“É0gÎÄÅÅ!??ýû÷Gpp°Ôa1Æ«Cœà0Æš„¬¬,¸»»ÃÍÍ ®®®øý÷ßÑ¿©Ãb „¥¥%bccáã㸸¸àÏ?ÿ”:,Æcu€/QcŒ5zå§Þµkœ¥‰5`'NœÀÔ©SQ\\Œ;wb̘1R‡Äc¬ñc¬ÑRNÿj³.Ö°¹ºº")) ={öĻヒE‹¡¤¤¤ÖꯋséÖ­[¸{÷n­ÔÅcM'8Œ±FãÁƒ6l°bÅ ;v ]ºt,^¼Û¶mCLL ärù+í§6ëb Ÿ™™¢¢¢°yóflÚ´ C† ÁíÛ·k¥îÚ:—–-[†>}úà?þÀÛo¿ [[[,]º;vDfff­ÄÊcM'8Œ±F!$$}ûöÅóçÏqáÂøùùAK믰ï¾û ÐÑÑyå}Õf]¬qÉdðòòÂï¿ÿ¹\kkklذ¯:OmK^^^pssÃòåË¡££ƒ˜˜øàxzzbÚ´iˆ‹‹ƒµµµÚ²-Z´@ëÖ­ke¿µYk>qqqøê«¯ðìÙ3JcŒ5Tœà0Æ”‹/ÂÊÊ !!!سgÂÃÃѦM©ÃbÍ”‘‘¶oߎàÈ‘#èÛ·/Μ9#iL¯¿þ:zõê%i Œ1Öq‚Ãkär9V¯^ ¼þúë¸~ý:&Nœ(uXŒþñàúõëèÛ·/† †E‹¡¸¸X’X0vìXIöÍc'8Œ1É)§¾]¾|9V®\‰_ý:u’:,ÆTtìØ?ýô¶lÙ‚   ØÚÚâÚµkR‡Åc¬Npc’!"càÀ€Ë—/Wšþ™±†D9ôÕ«Wahhˆ·Þz «W¯†B¡:4Æcÿ‡¿E0Æ$ñìÙ3Œ73gÎĬY³pîܹWº¯€ˆššŠ‚‚¤¦¦¢°°Påù7ÂÄÄ/^¬v›˜º{ã7pòäIÀßߣFBJJJ¥rµy^2ƇÆX½;pà,--‘””„èèh¬Zµ ­Zµz¥:.\ˆN:¡¸¸‡†®®.…ç• 6Êd²j·‰©‹1 lm???œ={>„¥¥%öîÝ«R¦6ÏKÆcâÈèU—ifŒ1‘^¼x… "88زe ¤‹±WVPP€E‹aÓ¦MpqqÁöíÛyö?Æ“'8Œ±zqáÂxxx ''ÁÁÁ?~¼Ô!1VëŽ=ŠiÓ¦A[[?üð¯ßÄcàKÔcuª¤¤ppp@=˜˜ÈÉ k²FމÄÄDôïßï½÷æÌ™ƒ¢¢"©ÃbŒ±f…GpcuæÆpwwÇ­[·ðïÿsæÌ‘:$ÆêMHHfÍš…®]»bÏž=°¶¶–:$Ækx‡1Vë”Ó?ÛÚÚ¢U«VHLLää†5;“'OÆÕ«WÑ®]; 4ˆ§“fŒ±z c¬V=~üï¿ÿ>fΜ‰Ï>û gΜA=¤‹1I¼þúëˆŽŽÆòåËñå—_ÂÁÁ÷îÝ“:,ÆkÒ8ÁaŒÕšˆˆX[[#55.\ÀªU«Ð²eK©ÃbLR-Z´€ŸŸâââ›› KcŒ5Yœà0Æ^Yvv6&Ož 777¸¸¸ ..”:,Æ”¾}ûââÅ‹ðññ\]]‘‘‘!uXŒ1Öäð$Œ±WrâÄ xzz¢¤¤;wîĘ1c¤‰±ïøñã˜:u*är9víÚggg©CbŒ±&ƒGpc/¥°°‹-ˆ#`gg‡¤¤$Nnéý÷ßǵk×àèèˆ1cÆÀÛÛùùùR‡ÅcMà0ÆjìúõëpwwÇýû÷±víZxyyIcVDD¼½½aff†={ö ÿþR‡Äcà0ÆDS(ذa ===\¾|™“Æ^‘««+aff;;; ´´Tê°c¬ÑâƘ(>Ä”)Spþüy,Y²þþþhÑ¢…Ôa1Öd6nÜ???ØØØ 44ûÛߤ‹1ÆÁaŒi¤œþ9==/^D@@'7ŒÕ2™L†9sæ >>………èß¿?O'Íc/ÆX•²²²0qâD¸¹¹a„ øý÷ßacc#uXŒ5i}úôAll,f̘8;;ãéÓ§R‡Åc_¢ÆSë·ß~ÃÔ©SÑ¢E üðÃ6l˜Ô!1Öìœ?ÈÍÍÅŽ;0nܸjË+ hiño—Œ±æ?c* 0gÎŒ5 öööHLLää†1‰ < øàƒ0~üxLž<¹¹¹j˦¦¦bäÈ‘(..®ç(c¬aá‡1&P^‚öÃ? $$áááhÛ¶­Ôa1Ö¬aûö툈ˆÀ/¿ü‚~ýúáìÙ³*eˆ8~ü8-Z$Q¤Œ1Ö0p‚Ã\.ÇêÕ«1dÈtéÒEXç†1Öp¸¸¸àúõëèÝ»7† †E‹¡¤¤°iÓ&œÿüsôîÝøðÃ…KÓ´´´`llŒ7nÀÌÌLâhc¬þñ·Æš±ôë×ÙÙÙ¸xñ"üüü8¹a¬“ÉdðòòÂ¥K— —ËñÿþßÿCùß* rssáîîþ “1Öñ7Æš¡´´4Œ?S§NÅ´iÓ‡~ýúIc¬z÷î#F //O¸TM©¤¤111ظq£DÑ1Ƙtø5Æš™#GŽàã?F«V­‚wÞyGêc/áܹsxçw P(ª,Ó²eK\¼x‘ׯbŒ5+<‚ÃX3‘ŸŸ9sæÀÙÙC† Abb"'7Œ5Ryyy˜4id2YµåˆÿøÇ?ªœZš1Æš"Npkbccamm°°0|ˆÒÒÒjËÉår$''cîܹõcŒI¯E@@@€ÔA0Æê†\.ÇŠ+àéé‰þýûã×_Å[o½%uXŒ±WÔ¾}{XXXàÅ‹xöì´´´Ð²eKµ B¡@BBúöí‹Þ½{K-cŒÕ/¾‡±&êæÍ›ðððÀ7ˆÙ³gk¼œ…1Öøddd ::ÇŽÃO?ý„´´4´jÕ r¹\¸?G&“A__ׯ_Çk¯½&qÄŒ1V·8Áa¬‰©¸FFhh(zöì)uXŒ±z@D¸rå Ž=Š_~ùçÏŸGii)´µµQRR‚ÁƒãôéÓhÑ¢…Ô¡2ÆXᇱ&äéÓ§˜>}:Ž=ŠùóçcåÊ•hÙ²¥Ôa1&L˜€ˆˆ©Ã`Œ1Æ”/¿üË—/¯Ñk´ë(ÆX=‹ŒŒÄ§Ÿ~ ###ÄÄÄ`È!R‡ÄjhРAøüóÏ¥ƒ5aOž<Áõë×aoo===©ÃaŒ±jM˜0+W®„±±qþ}䇱FîÅ‹X¸p!‚ƒƒááá-[¶ÀÀÀ@ê°ØKèÒ¥ \]]¥ƒ1Æk0&OžŒùó磨¨‹/õNpkÄΟ?äææâ§Ÿ~¸q㤉1Æc¬Ö8;;ÃÚÚóæÍQI'8Œ5B%%%øê«¯°råJŒ9»v킹¹¹Ôa1ÆcŒÕ:åZ^b“Npkd’’’àîwïbëÖ­ðòò’:$ÆcŒ±:U“$‡Æ "ÂÆáçç\¾|ûÛߤ‹1Æc¬^ˆMr8Áa¬xôè<==qæÌ,]ºþþþ¼ŽcŒ1Æš1IŽV½FÄ«±ˆˆX[[ãéÓ§ˆE@@'7Œ1ÖLܾ}~~~èØ±#ž>}Ze¹ÌÌLtîÜõcukРApssƒL&Sy(“›%K–àĉ•^Ç#8Œ5PYYY˜5köíÛ‡O>ùß|ó ¯[Á“”§§'~øá‡JÛÓÓÓѾ}{ "ª¹   ¸»»ÃÄÄDêPDñööÆÙ³g!—Ë5–%"Èd²zˆŠ±úóçÏWù¼››222*m—Õe`Œ±š;~ü8¦N ¹\Ž]»vÁÙÙYêX›0a <<\âH«Þ“'O`mmôôtÄÇÇ£_¿~fT9//ýúõC|||£Ip`áÂ…X·nž>žìíí©E‹€¾þúkºtéuéÒ…Ž;¦6žÀÀ@@ÏŸ?cMëÙºÂÂÂÈÜÜœNŸ>Mùùù4sæL@aaaDD´víZ@³gϦ„„JOO§·ß~›Ú·oO …‚BBBÈÄÄ„ŸŸ¥¥¥Ñ»ï¾KèðáÃ*ý;kÖ,Ú±c)Šjû—±†íß¿¿òv baŒýŸû÷ïÓ;ï¼C:::´jÕ**--•:$&NpXc"6Áéß¿?mÞ¼Yø{Ê”)djj*üýðáCÒÖÖ¦9sæÛ233éí·ß&"¢’’êСݼySå5èŸÿü'ùúú:{ö¬ÆxÔ%8šb¬Iý/SWaa!™ššÒöíÛ…m×®]£¶mÛÒÎ;‰è¯çÞ½{B™Õ«Wzúô)%''«$8ÊzÐŽ;Tâôôô$"qýËXCVU‚ó¨1&‘Ìš5 ]»vEll,¬­­¥‰1ÆjU||<àâŋشi8€Ö­[ ÏwíÚ&LÀÎ;áïïvíÚ!44€«W¯"-- ÿûß+Õ””Âìm={ö¬“kRÿËÔuéÒ%¤§§cÀ€Â6KKKµ3Céêê ÿ¯œU³°°€úût,--áèèˆmÛ¶aúôé€Ë—/cРAÄõ/c߃ÃX=KOOLJ~OOOL:ñññœÜ0Æš¤””899ÁÛÛNNNpssU˜¼uÁ‚ÈËËî9 Ãĉ”}^@rr2¨ìªáqõêUxåi‘5ÅX“ú_¦®´´4µµ¦”õ+ïÓ©hîܹˆÇ… ”õ¯»»»Ê>«ë_Æ#Np«%ÿÑVçèÑ£°¶¶ÆåË— 6@GG§¢cŒ±úsèÐ!ùDØnmm cccúÒuì IDAT,^¼kÖ¬Ajj*²³³qúôi,X° P(@ÔB˜Êe gΜÑ£Øú_¶.[[[èëë#,, Ë–-ógÏ““ƒ¨¨(¬X±PRR ¬o«ªKY¦bœ2™ ³gÏFdd$Ö¯_OOOá91ýËXcÄ cµ`þüù8rä¼¼¼*=wéÒ%X[[#$$¡¡¡G›6m$ˆ’1Æ^]jj*ž>}Šââb$%% _à ñÇ`„ hß¾=,,,{÷îEvv6"""pîÜ9äççãÆ8yò¤Pç¨Q£Ð·o_tèЃ¶·nÝ(**‚ŸŸ:uê8::bܸqÈËËCtt4€²H5Q~öÆÇÇcçÎBìUÅ%º~Mí­ª.øûûƒˆ°bÅ ˜™™ÁÈÈ'N„‹‹ ž?Ž3gÎbbb P(PRR‚Ó§ON:"ê¾pá Tbóôô„žžñÆoˆî_Æ­:Ú€±fà§Ÿ~"™LF…„„QÙì4«V­¢–-[Òûï¿OÉÉÉGÊ2žE5S¦L>ëª{?~œˆÊf 322"KKK:xð …††’¾¾>Í›7¯Ò¬‘ëׯ§o¾ùFí~ƒƒƒ©{÷«K¶¶¶BývvvÂ>MMMiþüùÕÆŸ‘‘Aƒ&SSSÚ·oŸÆmmmkTÿ«Ôõí·ßR—.]ÈÀÀ€†N—/_&"¢¡C‡ªôm`` 0@eÛøñãUþ¶²²ªÛüùóéèÑ£5ê_Æ:T1‹šìÿždŒ½„ÔÔTôéÓ/^¼€B¡€L&ƒžž~ùå,Y²ñññÀÂ… «¼”1˜0a¾ž5_ÎÎÎ åŽc¢Éd2ìß¿_ø7T‰§‰fì%) ¸»»#//O¸šˆP\\Œ‘#G¢OŸ>HHH@¯^½$Ž”1Æ."Âwß}‡öíÛsrëœà0ö’Ö¬YƒS§N ÉRII JKKáââÂÉ cŒUáĉ?~<òòò`hhˆ„„©CbŒ5|Í c/!>>þþþ•’%…B/¿üW®\©çÈc¬q000@ë֭ѯ_?üúë¯èÞ½»Ô!1ÆšÁa¬†rssáêꪱÁÕÕW®\QY}š1Æ`gg‡?ÿüSê0cMà0VC>>>HNNÖ¸&‚\.Ç;wðÅ_ÔSdŒ1ÆcŒGp«}ûöaÏž=U>ߢE ˆ–––;v,œœœê1BÆcŒ±æGpéþýûðòòVÂʦ'lÕªÀØØ|ð¶nÝŠÇãêÕ«øê«¯0dÈ©BfŒ5 ƒƒüýý…í™™™èܹ3ëtÿõµoooܾ}»Îê¿wï–.] >ûì3?~ÅÅÅu¶òÄöY]÷m]«îüllž>}Šƒ"22½{÷FPP¨×©{ϰF¬âÊŸû÷ïµJ1?øÁ~4µÇÀ)//¯î–\®†««+¹ººJ²oV?=zDhéÒ¥uºŸÜÜ\zã7èùóçuºŸŠ>LëÖ­«óý,[¶ŒÐýû÷ë|_ÍI}ŸuÍÓÓ“úöíKÈÛÛ[Ôk¤zϰW€öïß_i{•#8¼š6cerrrpîÜ9ôë×R‡ÃêÈÚµkqåÊŒ;‡†žžžÔ!±&¦}ûöõ²Ÿ3fàÞ½{õ²¯òöïßU«VÕù~:tèPçûhŽêëü¬kß}÷JKK¡¯¯/ú5R½gXª˜ñ(Gpc¬9qqq¡áÇSûöíÉÁÁrrrêuÿ<‚#‡’‹‹ µoßžôôôhðàÁtùòe""Ч™3gR—.](99™FMzzzdeeE'Ož]†ˆ¨  @åòüü| ¡wÞy‡-Z¤Ó/¿üBo½õµnÝš^ýuÚ°aƒ¨x?ùä“J#“iiiUîçäÉ“ôÎ;ïžžuìØ‘>ýôSáWì?þøƒ.\H:t ÔÔTZºt)µk׎ÌÍÍ)<<\¥ž¼¼<3f õìÙSeÿ7oÞ$"¢µk× Ûþõ¯‰®ûܹsdooOºººdmmMóçÏ5‚S]Û4õsuǦ͜9“PXX˜Æx‰ˆ €ðe¾ªýüöÛodhhH‡¦œœÚ¿?éëëÓÀ©¤¤„† B-Z´ 4{ölº|ù2eee‘ƒƒ™˜˜PII‰P×¾}û(88˜ˆˆÒÒÒèÝwß%tøða¡ŒB¡ Y³fÑŽ;ÈÞÞ^Tݱ±±ÔºukZ³f =þœÂÃÃIWWWc‚£©mšú¹ª>«H]¹‘#GRË–- -Z´ˆbccéùóçäììLZZZ´xñb:räååå —ÛÅÄĈ:‰Ê.”Éd´k×.ÊÍÍ¥àà`ዹ––%''ÓîÝ»ÉÁÁîܹCééé4~üxÒÒÒ¢øøø*Û¢.Á©.–””rtt$ôûï¿«ç?üöîÝK¥¥¥ÕÆRþ<øúë¯éÒ¥KÔ¥K:vì˜JlbÎ)…B¡ò± Qå÷Œ¦¶‹›Õ=Npc¬Ê‡ˆ$Ir8Á‘NÿþýióæÍÂßS¦L!SSSáo'''ÒÕÕ%¹\.l‹ŽŽ&äãã#ºŒº/ÉÉÉ*_Ž ÉÔÔ”¶oß.”¹víµmÛ–vîÜ)*^u_Ö*îG¡PP=hÖ¬Y*}¡ü½eË""a´äñãÇB™õë×JNN¶}ôÑG”™™©sù_ð•<==…ÿS·••5J¥ooïj1mÓÏû¬*êÊ)÷uëÖ-aÛáÇ ýüó϶[·nÚ¶m›°MÓñuqq¡Ž;ªÄ0pà@=z4•””P‡„Äš¨l$ýóŸÿ¬²êÎOM±<|ø´µµiΜ9¶ÌÌLzûí·EÇâëëKèìÙ³UÆF$îœ*ïUMm7«[U%8<åcŒU`ee…ãÇãæÍ›pvvFnn®Ô!±:3fàâÅ‹pwwÇþýûQRR"<ß¹sghii¡E‹¶aÆÁÈÈqqq¢Ë¨cjjªò÷¥K—žžŽÛ,--‘‘‘?þXT¼bö;wîÀÊÊJe»—— ** À_÷»´nÝZ(£¼?M¹ÏçÏŸC&“¡M›6*1;::bÛ¶m¶˗/cРAÂßšê¾rå ®\¹‚#F¨Ähmm]m[Å´ML?W쳪¨+§l›r000•sDù|ùã§éøêéé!;;[e&9333ÄÇÇ®^½Š´´4üýï‡L&ƒL&Ãk¯½HJJÕ&±±tíÚ&LÀÎ;‘‘‘ …‡‡‡èX”÷þôìÙ³ÚXÄœSµISÛÅÆÍ¤Á cŒ©ÁINó‘’’'''x{{ÃÉÉ nnn(ûa°LUÓ¿wîÜYø’)¦Œ:_—––HOOéxÅìçáÇ€üü|•íÐÓÓCjjªÚש‰>ú¨Òö¹sç">>.\„……ÁÝݽʘ*ºyó&ñ‰†’˜¶‰ég±Óþ«+÷*Kh:¾‹/†‘‘,X€œœ\ºt §OŸÆ¨Q£üÕ¦äädaáiåãêÕ«µ ,X°yyyظq#€²ã°lÙ2<{ö 999ˆŠŠÂŠ+DÅ«üe¹ü¶Šû±±±A—.]ðã?ª$îÉÉÉxñâÜÜÜ„6@ii©PF¡Pu¥¦¦¢M›6j§U—Éd˜={6"##±~ýzxzzVêÓêê¶³³ƒ––öíÛ'l/¯ªÑ1mÓÔÏêú¬*ÕWum«ª½€¸óñâÅ‹ˆŠŠÂ‰'——‡‡býúõÂ1°¶¶†±±1/^Œ5kÖ 55ÙÙÙ8}ú4,X ºbß@Ù(Nff&ÜÜÜðÉ'ŸÛÅÄR±ª£éœzYß3bÚ^“¸™*ޔÓ Ô/??¿JÓvïÞ]ê°…ääd211¡#GŽÐóçÏiáÂ…$“ɾrý?V»ä‘#Gˆˆ(&&††JÆÆÆdaaAóæÍ£‡ÒòåË+Õ•ššJ¾¾¾Ô»woÒÕÕ%CCC4hmÚ´‰ŠŠŠ„úÊïç³Ï>SW»víTÊ­]»ö•ÛÊÊìß¿¿ÊÇ Aƒêtžd@‰‰‰€&OžLYYYN–––¤­­MIIICÞÞÞ$“ÉÈËË‹222èÞ½{dooOo½õ‰*óÓO?1çTùç*öKBBB•m'¢JïMm·µµU7«œà4pʹäë{qÁÆÌÛÛ›ÚµkWçûQNí¹råJaÛðáÃiĈ•Ê&$$³³³ð÷… HGG‡Þÿ}µ‰ë;wH__Ÿ,--U~e²··~å:qâ„Ú×}ôÑG¯Ú4Vœà4_ÊäåUË0Vöïß_iªä¼¼<ºví 0@²IœœèÏ?ÿ”d߬ùª*Áá{p¨»wïbÉ’%°°°Àýû÷ñÍ7ß k×®hß¾=‚‚‚7nD×®]ahhXéÞ€GÁÕÕ¦¦¦Ð×ׇ½½=TÊ:t €¡¡!lmmqñâÅJq„‡‡ÃÊÊ :::xóÍ7qàÀ±9rvvvÐÕÕE·nÝ„™U”N:…¡C‡B__fffðññAVVàÖ­[ðõõEÇŽñäÉ|ñÅhß¾=,,,8~ü8d2¶oߎŒŒ á^‰;wî 44C‡ÅâÅ‹kÜÖš())A\\þøã•íÖÖÖpppþþì³ÏPTT„ÀÀ@µ³êüíoôiÓpýúuá¸*B.—ÃÕÕwîÜy¥xc/¯´´T徉—-ÃØ«ºuë|||0mÚ4•ízzzèÓ§\]]_i·—ADؽ{7Ú·ovíÚÕ뾫RÅŒ‡Gp¤Qq§±®„¬iîÚ\9ûã?VÁ©jåi1m­Žºœ}ûöÒÕÕ%µ—Šýïÿ#Ô¶mÛjëÿïÿKhàÀÂ6{{{ÊÉÉîÑêÙ³§Êd<‚Sÿx§yÊÊÊ"@§OŸ®´ZºØ2ŒÕå¿ÞÞÞtùòeÊÎÎî—ùâ‹/(55µÞb9~ü8éëë244¤ÿýïõ¶oÆ”À—¨5lê.Qkl+!kZº¶Wή˜à©_QZS[5Q—àíܹ“ŒŒŒ„w___JOOžÿå—_õíÛ·Úú•7r Û” ŽB¡ www@ÇVIç§þq‚Óü<þ¼Òµü/ S†±ÚE#GޤŽ;R«V­¨{÷îäëë[ï÷dÆÆÆR»ví¨_¿~tîܹzÝ7cJU%8Úu2,ÄjÅ«®„ ”M'¹iÓ&8p ÒjÑÊ••¯733VÜ.¿úpEU­„\ÝÊЇ;wîÀ××Wåu^^^X¾|9¢¢¢àãã#jå쪨[NS[_ÖÇŒqãÆaíڵغu+Ö¬YƒíÛ·cÇŽpuu¦ÔtÙJË–-¨S%™L†Ý»wãÙ³g8vìæÎ‹M›6½RÜŒ1qLLL4. )¦ cµÉÙÙÎÎÎR‡;;;üùçŸR‡Á˜Z|NÖØVBÖ´2tm®œ]u¯ÕÔV±Ô­ZljjŠ5kÖàñãÇøòË/‘ŸŸ‰'âÚµkxóÍ7?V»†ƒÒ“'O”-Þ¦NË–-qðàAôïßAAAغukâfŒ1ÆkN8Ái‚¤Z YÓÊе¹rvMhj«XÊÑ3øê«¯Tž311Áòå˱}ûvÈår«QìŒ1ñ øûû Û333ѹsgÖéþëk?ÞÞÞ¸}ûvÕïÞ=,]ºxðàAíßgõÕ·u©ªó“5|Máük,8Ái222ðøñc@BBJKKQ\\Œ˜˜@LL  är9Ž=  lªe¹\"ÂñãÇ'OžDQQ,,,{÷îEvv6"""pîÜ9äççãÆ8yò$öíÛ‡S§NA[[[˜fY&“áµ×^ñcÇкuk ¨¨~~~èÔ©LLLàèèˆqãÆ©m‡üýýADX±bÌÌÌ`dd„‰'ÂÅÅ:::X·n²²²0iÒ$¤¦¦âÉ“'ðññÁÈ‘#áââ‚¢¢"œ={Vh7¡¤¤'OžP6ÚADHIIÁ™3g››+ô“òy¸pá @c[ÕÙ²e Ú¶m‹ƒ")) }úô£££ð<a̘1Ø´iRRRPTT„Ë—/ÃÇÇݺuƒ‡‡`èСسgàää„K—.¡¸¸™™™ …½½=zô訨(áþ ´´4¤¤¤àÊ•+•®íóÍ7ñóÏ? ÷í0ÆjßþóÌ›7gÏž­ô$"µ—«¾Š   aªüºÜOy%%%xðàp)m]øì³Ï°nÝ:á2ܺ&¶ÏêºoëZuçgcóôéSlÙ²ï½÷fÍš%úuêÞ3¯ª°°cÆŒ©Õ:Õiìç_£QqÖžE­~)§.ÿèÞ½{£X ¹*Õ­ÀMôê+gWìeŸUµò´Ø¶–wòäIzýõ×I__ŸF­2£ѪU«(55•V­ZE={ö$êÖ­Íœ9“ÒÒÒ*Õw÷î]š1cuïÞtttÈÈȈ† BÛ¶m£ââb¡\Řûôé£6¾Ã‡“›››ÆcÁjÏ¢Ö¼LëÖ­«óý(ÿºÿ~ï«9©¯ó³®yzzRß¾}…©¯Å¨«÷LAAèÙUYÞ&š•×PWB® Mµ­ê)Vw8Ái^òóóëå ääÉ“ @½'8îîî׫ ›7oæ§Ô×ùYär9éèèˆNpêê=à NãTU‚ר5C q%äºÒ”ÛªnJlÆšºGÁÕÕ¦¦¦Ð×ׇ½½=—/_ƬY³ÐµkW¤¤¤`̘1Ð×ׇµµ5N:%º PyÖÄ‚‚„††bèСX¼x±ÊsGŽtuuÑ­[7lܸQT¼^^^ ´iÓ2™ éééUîçÔ©S:t(ôõõaffá2[·nÁ××;vÄ“'OðÅ_ }ûö°°°@DD„J=ùùùÈÊÊB§NЫW/•KwÿøãÀºuë„m_}õ•èºÏŸ?!C†@OO666¸wãZ]Û4õsuǦ|˜rrrhÿþý¤¯¯O¤’’2dµhÑ‚ÐìÙ³éòåË”••EdbbB%%%B]ûöí£àà`"* ~÷Ýw >|X(£P(hÖ¬Y´cDz··Uwll,µnÝšÖ¬YCÏŸ?§ððpÒÕÕÕ8‚£©mšú¹ª>«H]¹‘#GRË–- -Z´ˆbccéùóçäììLZZZ´xñb:räååå —ÛÅÄĈ:‰Ê.”Éd´k×.ÊÍÍ¥àà`ád---JNN¦Ý»w“ƒƒݹs‡ÒÓÓiüøñ¤¥¥EñññU¶¥âù©)–””aAñßÿ]å8øá‡´wï^*--­6–òçÁ×_M—.]¢.]ºÐ±cÇTbsN) •׋Á©øžÑÔv±qkÁÑt,ïܹC>>>TPP ¼&44”Ю]»Ôžb?XÕÀ—¨±òÊJÈõ¡9µ•ÕNp†þýûÓæÍ›…¿§L™B¦¦¦ÂßNNN¤««Kr¹\ØMÈÇÇGtu_ “““U¾œ’©©)mß¾](síÚ5jÛ¶-íܹST¼ê¾¬UÜB¡ =zЬY³TúBù…{Ë–-Dô×=|åï\¿~=P¹í£>Rùü»ví¨t)¯§§§ðÿbê¶²²¢Q£F©Ôáíí]m‚#¦mbú¹bŸUE]9å¾nݺ%l;|ø0 ŸþYØvëÖBxE7 IDAT-@Û¶m¶i:¾...Ô±cG•(|‘.))¡:¨|‘}øð! þóŸU¶CÝù©)–‡’¶¶6Í™3GØ–™™Io¿ý¶èX|}} ={¶Ê؈ÄSå½j‚£©íêâvssS{onŇòÇ MDz¢7n¾¾>M™2EئîüóyĪVU‚£ýòc?¬1k(+!ׇæÔVÆšºøøxeÓ¿oÚ´ P¹¼¥sçÎÐÒÒR™"ذa022B\\œè2êT¼,ôÒ¥KHOOÇ€„m–––ÈÈȯ˜ýÄÇÇãÎ;ðõõUÙîåå…åË—#** >>>èС¨Ô¯œ_9…þóçÏ!“ÉЦM•˜±mÛ6LŸ>@Ù¥3ƒ ÊhªûÊ•+¸rå ¦L™¢£µµuµmÓ6KKKý,ö’]uå”mSÎd üµîYùsDù¼²/•ñU_===dgg£¸¸Xx½™™™pž]½ziiiøûßÿ^)®¤¤$QmK×®]1aÂìܹþþþh×®BCC…Y?ÅÄÒ¾}{@Ïž=«EÌ9U›4µ]]Ü?þø#~üñGáïÂÂB¸¸¸àçŸV»MDz¼üü|¸ºº¢[·nزe‹°]Ýù÷²ŸG¬zóæÆcÍRJJ œœœàíí '''¸¹¹©L•[Õ=u;wFqq±è2êT|]ZZ ==ý¥ã³Ÿ‡(ûÒTž……ôôôššªöuêDFFâ£>ª´}îܹˆÇ… aaapww¯2¦Š” 8×ôÞ@1mÓÏbï¥TWîUîÃÔt|/^ ###,X°999¸téNŸ>Q£Fø«MÉÉÉ ²«j„ÇÕ«Wk5X°`òòò„û—„E¦ÅÄR“é5SµISÛkcZfMDz¼3fàÑ£GˆŒŒTYs¯&矦Ï#V=NpcŒ5 ¹¹¹ppp€±±1âãã1iÒ$µ£!êˆÌÌL¼öÚk5*£‰rAßÐÐÐWŠW“N:ø+‰(O[[o¼ñ†èº>¬v-³Ñ£G£G Bvv6tuu¡¯¯/º^å/Ú=ý@\Û4õ³TÄß^½zaÁ‚¸zõ*ÌÌÌàêêŠéÓ§cóæÍccce7ö×u,@ÙbÔŽŽŽ Btt4zõê%ÄP[±(½ê9%Vm½Ï4Ñt,•vïÞ~ø;vìÐ8Ò¥TŸGLU£IpxeéÚÁ+K7ׯ_‡³³3 ѱcGLŸ>fff¶322ЩS'üë_ÿ’:Ö@9s÷ïßÇ´iÓT.ç¨øå °°PXè(ûòüìÙ3Œ?^tåeHr¹\(Sq›­­-ôõõ†eË–áÙ³gÈÉÉATTV¬X!*^å/Ëå·UÜ ºté‚ü¹¹¹B¹ääd¼xñnnnB›€²Ùœ” …PWjj*Ú´i£ò‹rù8fÏžÈÈH¬_¿žžž•ú´ººíìì ¥¥…}ûö ÛË«jôELÛ4õ³º>«JuÇU]Ûªj/ î|¼xñ"¢¢¢pâÄ äååááÇX¿~½p ¬­­allŒÅ‹cÍš5HMMEvv6NŸ> ˆn‡Ø÷P6Š“™™ 777|òÉ'Âv1±Tìƒêh:§^VÅ÷Œ˜¶×$îªh:–píÚ5Ìš5 ³fÍÞ—åUužŠùÌb5Óh^YºvðÊÒMCJJ 0{öl<~üS¦LÁîÝ»ñìÙ³zíÇš¬B­i•èò—C0¦Ž……`ïÞ½ÈÎÎFDDÎ;‡üü|ܸq'OžPv.Í;™™™¸ÿ>>ùäØÚÚ ÷ˆ) ìËS^^ ::páÂÀÀÀþþþ "¬X±fff022Âĉáââ"*^å½0ñññعs'RRR*íGGGëÖ­CVV&Mš„ÔÔT>>9r$\\\PTT„³gÏ ±JJJ„>‰ŽŽFXX˜Ú/]JžžžÐÓÓCbb¢Ê¨˜º-,,ðé§Ÿ")) “'OÆãÇqïÞ=:t0bĬ^½7n„‰‰‰0½®˜¶iêguÇ@¥}©+W\\,똘( Èår=z@ÙôÕr¹D„ãÇNž<‰¢¢"QÇwß¾}8uê´µµU¦ ~íµ×pìØ1´nÝ(**‚ŸŸ:uê8:: #mêÚQñüûÞ€Q£F¡oß¾èС,l×K^^žÐå¿C¨‹OÓ9¥DDHMMEAARSS…Dººº+¾g”ÿfTÕö¨¨(µq×”¦c™›› WWWXZZbýúõÂërss1wî\êÏSe?húÌb5TqÖ†<‹¯,];xeéÆ/00 ¥£F«P7öEÔxµ†Á××—ŒŒŒÈÒÒ’‡Ñð’· û÷¿;¹÷2sg€{Íþ¬åZrî™sö>ç;gæÌœ9›Ž;¦“æáá!”K®®®dccC¿ûÝï(77W±½åååôÌ3σƒ%''¬'==<<<È‚ÜÜÜhÓ¦MÔØØHDD3gÎÔ9îwÞ¡É“'·ÛJ{»h1Ö®]KŸ~ú©Nš’²ß{ï=jii¡M›6‘ƒƒÙØØÐ /¼@;vì OOOÚ½{7UUUQll,ÙÚÚÒÅ‹uê0ä›\;Kµ™~]bùtÒ¶nÝJ‹/ÖI ®›šš±L®³²²ÈÆÆFtw.'''Á·ýû÷ÓÈ‘#ÉÊÊŠ¼½½éäÉ“:~kû!¦O%¶hM111¢²E»ÏhíÚµ¢ö)Ñ”öoúíréÒ%I߉¨Ý9#ç»···¨ÝE®/ׯ_/¹›“““¤N•ŒYŒ4ØE푚àpdiãÀ‘¥}ÂÂÂÈÎή§Í "åQ¨y‚Ó³åÿ\ÐÜ,t5ÃÔÔÔv[%×ÕÕÑ•+WhÒ¤Ií&Ý…ŸŸýøã=R÷£Š©ú’Ç£®!5Á1Ê5Ž,Í‘¥9²´áöPÒ¦JôròäI˜™™aß¾}(//ôPXX(ÙÞJ|ÕÆ”Q¨¥hllÄ|íb 1cÆ ¨ÕjlܸÄ;wŒÖžÌãÇÇu¾›èl†é*Ç‹/¾¨“nmmqãÆ!00°K;¸u"Â`oo;;»n­ûQÆ”}É㑉Пñtæ G–æÈÒYZ^wÆÔKhh¨Î©öVâ«>¦ŠBmè ÎáÇiРA@gù€——=z”èìÙ³dggGeeeFoO%ðœÞOUUMœ8‘ÐùóçÛéTi†1ÿþ÷¿…廹¹¹T]]Mµµµ”——G¯¾ú*•––v›-'Ož$•JEhÀ€ôÝwßu[ݦêKºL¹D#KÿG–þyF––kcëE‚#ÕŽ¼¬m»œþ´›àt4Jô½{÷t&8š%©_ýµPæ®]»¨¬¬Ìèí©žàôn*++ÛiK_¿Jò0Œ1ÉÌÌ$___:t(õïߟFŽI6lйÞwYYYdggG&L ÿüç?ÝZ÷ケû’Ç#ã 5Á1ʻќœ¬\¹/^Ä’%Kššªé··D– Ud¯’z4Ñ—=<>>ˆŒŒDII V­Z%Øoêöd-Ôju;mi"¨w$Ã|òÉ'¸sçšššðÝwßá­·ÞÒ¹Þw“'OÆ?þˆüü|Óå»/y<2-F™àpdéŸàÈÒ?ñsŠ,-×ÆÔ‹bÇv$ò²>Ý…Zƒ¾iiiP«Õعs'†ŽÍ›7£µµµ[Ú“a†a˜G“._ý9²4G–îMôTdi¹ö0¦^:‚ÒÈËbtWjCL›6 ………ˆ‰‰Þ|óMÄÆÆöX{2 Ã0 Óûéò‡#KsdiŽ,-¯;céEÃÐÔÔ$ÛŽJ"/Kaª(ÔJillÄo¼KKK¬Y³3f ¾úê+£·'Ó½444àСC˜>}:¶lÙ"¤WTTÀÅÅ;vì0iýÝUOXX®]»f²ò¯_¿ŽÍ›7ÃÙÙ7oÞ4Y=€ò6ë®¶5%RúdÚÓ)û]¿ìììl,[¶ Ç7z]r(©›õÓ;èò‡#KsdiŽ, Ùö0–^ˆ%%%øâ‹/P[[+´“T{Ëù*Õ'rúÓ@2Q¨»ÊöíÛ±oß>TWW£ººD£¶'Óý|ôÑGxùå—qáÂ…v}@DíBt•¸¸¸v[Ü›¢mš››qóæMŒ=Údu¬Zµ QQQ]ŠÎÞ”¶™©ÛÖÔÒ'#­»Žö»Øy)…¦ìÖÖVÌŸ?‰‰‰¨©©éÝ]µCiÝ=¡Ÿ;wî`Ïž=øÍo~ƒˆˆÅÇu¤9ôwèÌ.jYš#KÿÜ#K+Ñ1ô¢ßhäÈ‘’í­ÄWSF¡î(}úô¡õë×QÛ®‰qqq´mÛ62d 6Œ¶oß®³fWÛó½÷ÞSlï¢f\ŠŠŠ0}àæÚÚZ1bD·nÎÈÈ ¨¨(“×£9p³qé.}>ªtUw]=/Œìº3v(©»»õBO=õ Ù ¡§ÆFc‰]ÔŒ2Á‘ƒ#K3½‰ÞYÚ|˜N:E#Gޤ¦¦¦ž6K”ŸË///úíoKeeetíÚ5rqq¡)S¦‘““ Ú²e ݾ}›¾ùæ;v,YXXзß~«(QûÀ͇"µZM€n°Ú””rrr¢óçÏS}}=ýùÏ&à§±†ì%j¸YªžÏ>ûŒ @TSSC©©©¤R©ÈËË‹š››iÚ´iÔ§O@«W¯¦ÜÜ\ªªª¢éÓ§“Z­ÖYjœœœLû÷ï'"¢»wïÒ¯ýk@BžÖÖVŠˆˆ øøxš:uª¢²³²²ÈÒÒ’Þ~ûmª¬¬¤´´4²²²’}’.ç›\;Kµ™>bù|}}©_¿~€^yåÊÊÊ¢ÊÊJò÷÷'sssŠŒŒ¤'NP]]°ìéÌ™3ŠôHÔ¶ÐÌÌŒ©¶¶–öïß/,A577§ââb:pàMŸ> éÞ½{4oÞ<277§œœI_Ä‹²¥¤¤„fÍšE€npâÖÖVš?>>|˜>|hÐm¼ûî»”M®®®ôùçŸëئT‹ÆÒ´œî¤ôáååEG¥††:{ö,ÙÙÙQYYµ?/¥|-;44”,--içÎTVVFyyy4nÜ8R©TT\\L•••4fÌûÙòòra™rMM¨J4'W·”~:ªC%c‡þý²XÐm):ê»R}v7è‰%jYšéô–ÈÒÝAo÷5//žxâ ²´´$___úþûï{Ú$I~.œ_þò—´{÷náï¥K—’ƒƒƒð·ŸŸYYYQKK‹vúôi@áááŠóˆÝëÜÈ466’ƒƒíÛ·OÈsåÊ>>8p þûßÿ*Î#†~PâììlÜ»w“&MÒÆòòrÅö*©'''………ذaƒNúòåËñúë¯#33ááá2d蔯Ùr]³M{ee%ÌÌÌt¢›?³fÍÂÞ½{…Hå¹¹¹˜2eŠG®ìüü|äççcéÒ¥:6zzzôU‰oãÇ—mg¥£Åòi|ÓÄfÚvž £Íïš¶ÔØH÷¯µµ5ª««ñàÁáxGGGAg—/_ÆÝ»w1f̘vv]½zU‘OJmqssâE‹€-[¶ÀÎÎIIIÂN°Jl±··<ùä“m‘Ó‹±4­Twúýnee'''øøø ""Xµj•AŸ¤|Wª=¸ºº"??€®Þ4(YÂÕ™1E¿n}:«C%c‡1‘ó]©>{½g>Ã0 Óã”””ÀÏÏaaaðóóCPPÎC(©ï¶\\\ðàÁÅyÄÐ?îîÝ»¤cv)±WI=·nÝÐöíŒ6ÎÎΰ¶¶Fii©èqb¤§§cÁ‚íÒ׬Yƒœœ|õÕW€””,Y²DÒ&}4Am•ÞìiPâ›’vVú½žX¾®|ë'׿‘‘‘8p Ö­[‡ššdggãüùó˜3g€Ÿ|*..µ­Zþ]¾|Ù¨¶ÀºuëPWW'|¿”’’‚çŸ^±-J·Y–kSciZ©îÄÊIKKƒZ­ÆÎ;1|øplÞ¼Y4&Ÿ)ß;¢‡.o{Ü™1E®î®èPnì0&r¾?JÛ¿ó‡a†ÔÖÖbúôé°µµENN/^,úäRìb_QQ'žx¢Cyä{<Áa†a´-_€Ã‡£ººGÅþóÔ××ã›o¾ÁÙ³g´]ðÖ¬YƒŠŠ ܸqË–-ƒ···pqW’çÌ™3Ú.ªuuu€Ó§O¾úê+444ÀÆÆ[¶laÛ¶mpttÄÀñüóÏcáÂ…ŠìÕ| “““ƒ„„”””´«ÇÂÂQQQ¨ªªÂâÅ‹QZZв²2„‡‡Ã×× .DSS“° ì™3g@DhnnÚäôéÓHIInÅ µµ5òòòtž +)ÛÙÙ+V¬ÀÕ«WŒÛ·oãúõë8vì`öìÙxë­·°k×.¨Õja«d%¾Éµ³XßhW—X¾}}æÌ´¶¶¢¥¥Ÿ~ú)€¶mŒ[ZZ@D8yò$àìÙ³hjjRÔ¿ÉÉÉ8wîœÎ¶Àfffxâ‰'ðùçŸÃÒÒûÛßÐÔÔ„7bذaP«Õ˜5k–ð¦MÌ}}*=7`Μ9xê©§0dÈ<óÌ3Bºœ-uuuBû••• ÇéÛ§D/ýû÷7Ц•êNLÛ·oǾ}ûP]]êêj||| ÝyyíÚ5Qߥ´çììŒŠŠ lÞ¼wîÜÁ•+Wð§?ý ¡¡¡B¿Ž9˜˜ˆºº:$&& ,///$&&¶³Cs3o¨Ÿ•Ô­¯ŸÎêPƒÔØ¡ˆPZZІ†”–– W) ‰õœï™™™’}Ô‘Üd@t†a˜Ÿ3·o߆««kO›aR<<<°aÃìÝ»¹¹¹Ø¶m6n܈+V !!QQQ8r䬭­áááQ£F¡¥¥óæÍCll¬ðÄ€Á<Ÿ|ò‰ð&çË/¿Ä“O>‰¸¸8ÌŸ?_H{úé§‘——‡7ÂÒÒÑÑѨ¬¬ÄÓO?·Þz cÇŽY{'L˜€þóŸxþùçñü_ýµh=‹-BŸ>}°}ûvŒ1C‡Å’%KðÚk¯ÁÌÌ ¾¾¾BŸ?þñ(..FzzºpÃ@÷y}lllŠÙ³gë¤+)ûÁƒÂMJ||<>þøcÌŸ?>>>¸{÷.–-[†Å‹ãý÷ß »V^Î7Ûù£>m3Í ‘¦ ±|...ÈÌÌ,[¶ ÅÅÅøî»ïpøðaÀ;#¢¢"¸»»ãõ×_|üñÇX°`Ž?.Û¿VVV8pà€ÎSz mIÕÒ¥KQZZŠ5kÖ@¥Rá­·ÞBii)Æ;v`ÆŒÐÎ1}ËÚ¢MHHˆè·#†l™2eŠÐç¾¾¾FTTT;û”ê%""¢ËšV¢;•J…¹sçêô{VVÞ}÷]ܽ{£GF¿~ý°bÅ „‡‡.\¨s^‹ú.¥½×_nnnˆ‰‰ATTFŒÕ«WcÅŠB[/^¼'NœÀ+¯¼‚øøxÄÅÅaÖ¬YhhhÀ²eË„¦¦&;üýýeûyæÌ™ë–ÒOGu¨ÔØ¡aýúõˆŽŽжLÖÊÊ —.]6ƒ+[¿ä|¿pá¾þúëv}Ô[1#½÷niiiŸ@1 Ãü\ 4ÙúùE‹èžõù]aÅŠøàƒÚÝPv4ô´4Ü¿_Øa hû°þúõë Avvv4ö÷÷GRRìì캽n†ù9aff†ÔÔT᪡ݜE‹µËÄ0 Ã0@ÛZ}íõúÍÃ0]¥  áááí¾?²¶¶Æ¸qãØí“"ÂÁƒaooÏ“†éAø†aFÕÕÕÈÉÉAcc#¾øâ Ño•äacpíÚ5TTT`åÊ•¸téîß¿ºº:äççãµ×^Cppp·ÙrêÔ)ØØØÀÜÜkÖ¬ÁÖ­[»­n†aÚÆaF–ªª*¨Õj\ºt 0cÆ $&&v8ËgŸ}™™™¸yó&üüüààà$''ã¯ý+œœœºÍXZZb„ øä“O„܆é$7`†a jµZömŒ’< cLüýýáïïßÓf`òäÉøñÇ{Ú †aþ~ƒÃ0 Ã0 Ã0î9iQIDATÌcOp†a†a†ylà Ã0 #ICC:„éÓ§cË–-BzEE\\\°cÇ“Öß]õ„……áÚµk&+ÿúõëØ¼y3œqóæM“Õ(o³îj[S"¥O¦ 1Ý™²ßõËÎÎÎÆ²eË0|øp£×%‡’ºY?¦§§Æžà0 Ã0’|ôÑGxùå—qáÂ…vßבhPº®‡ªª*“×£Mss3nÞ¼‰Ñ£G›¬ŽU«V!**ªÛ"€+m3S·­©1¤OFZwíw±óR MÙ­­­˜?>QSSÓ!»»j‡Òº{B?wîÜÁž={ð›ßüŠëH(¥±±QÒjJzdœ!†a¦Ç ¤ÀÀÀž6C”¢¢"@›7o6i=µµµ4bά¬4i=údddPTT”ÉëÙºu+ 7n˜¼®ŸÝ¥ÏG•®ê®«çe@@ÙÙÙuêØ®Ú¡¤îîÖOHH=õÔS€ÂÂÂcª±±¡¡ŒZfw€RSSÛ¥ó.j Ã0ŒAìíí»¥ž•+WâúõëÝR—6©©©Ø¹s§Éë2dˆÉëø9Ò]ú|Téªîºz^K÷±CIÝÝ­ŸƒâáÇP©TŠé©±ñQ†—¨1 Ã<¢!00P©T˜:uªƒ&77pssCII æÎ •JOOOœ;wNqí–444 )) 3gÎDdd¤Îo'NœÀäÉ“aee…áÇc×®]Šì]¾|9:4hÌÌÌpïÞ=ÉzÎ;‡™3gB¥RÁÑÑáááÂò‚‚lذC‡EYY^}õUØÛÛÃÙÙGÕ)§¾¾UUU6lÜÝÝaff&üûßÿþˆŠŠÒþþ÷¿+.ûË/¿Ä´iÓ`mm‰'*¾A1ä›\;êmÄò}ÿý÷Ø´iœqãÆ ÄÄÄÀÍÍ öööˆ‹‹ìÚµ nnn0`Ö¯_¯S¦¡þÕpìØ1Lš4  €··7.^¼ØÎ¶´´4xxxÀ£GƇ~h°½Ä–¾²ÅÅÅE§Ÿ5Û;¿ÿþûBZBB‚A[®]»†7ÂÑÑEEE˜;w.ììì­cGG´h,MÒ”> 1cÆ ¨ÕjlܸÄ;wDÏËÜÜ\QßÏ;'Z¶¹yÛ­f^^fΜ +++xzzâÂ… €¾}û í®Aû\¬­­µ£¶¶VVsruKéÇPß‹¡dìHOOò÷éÓ–––’åiÓß•êS †ÎÙ‡êø­ýÏÚÚÅÅÅí4¡ôºÓezàmÃ0 £Gg–¨yyyÑoû[*++£k×®‘‹‹ M™2…ˆˆœœœYXXЖ-[èöíÛôÍ7ßÐØ±cÉ‚¾ýö[EyˆÚ–1@k Ç¡C‡H­VÚ¸q£`OJJ 999Ñùó穾¾žþüç?JII‘µ—ˆhÇŽ@X†!UÏgŸ}F  ŒŒ ª©©¡ÔÔTR©TäååEÍÍÍ4mÚ4êÓ§ Õ«WSnn.UUUÑôéÓI­VSss³PVrr2íß¿ŸˆˆîÞ½K¿þõ¯ eddyZ[[)""‚âããiêÔ©ŠÊÎÊÊ"KKKzûí·©²²’ÒÒÒÈÊÊJv©œorí,Õfúˆåóõõ¥~ýúzå•W(++‹*++ÉßߟÌÍÍ)22’Nœ8Auuu²§3gÎ(Ò#QÛR@333JLL¤ÚÚZÚ¿? dnnNÅÅÅtàÀš>}:Ò½{÷hÞ¼ydnnN999’¾èëSΖ’’š5k ¯¿þZ§ŸçÏŸO‡¦‡´E[ï¾û.egg“««+}þùç:¶)Õ¢±4-§;)}xyyÑÑ£G©¡¡Îž=KvvvTVVFDíÏK)߃ƒƒEË %KKKÚ¹s'•••Q^^7ŽT*See%3†´oIËËËiòäÉ€jjjDíP¢9¹º¥ôÓQ*;Z[[uޱµµU¼D­£¾+Õ§Ü5¹s¶°°ÂÃé¡¡A8&))‰Pbb¢¨Þ”^w”‰%j<Áa†étf‚óË_þ’vïÞ-ü½téRrppþöóó#+++jiiÒNŸ>M(<<\q±€ââb‹Vcc#988о}û„¥ÇŠ!׿‘‘‘8p Ö­[‡ššdggãüùó˜3g€Ÿ|*..nwÃuùòe£ÚëÖ­C]]ðýRJJ žþyŶ(ÝöV®M¥i¥º+'-- jµ;wîÄðáñyóf´¶¶J–!å{GôãààÐåm;3¦ÈÕÝÊÆDÎwclË,wÎj³råJ!==]˜xgä®;'8 Ã0 µµµ˜>}:lmm‘““ƒÅ‹‹>ñ»ØWTTO$•æ‘cðàÁÚž‚wÅ^9† à§›9múöí‹#F(.+##¿ÿýïÛ¥`Ô¨Qˆ‹‹Cuu5¬¬¬:´ã‘æitQQ‘âce¾ÉµsO¡¤ÝÝݱnÝ:\¾|ŽŽŽ ÄK/½„Ý»wlmm´Ýl›Ú˜8q"fÍš…¸¸8œ>}îîî‚ Æ²E ÆÒtguÓ¦MCaa!bbb`gg‡7ß|±±±.§#”––â¿øE§ïʘb¨î®ô}WÇ¥k<•CîœÕpàÀüóŸÿD||¼ìM Ƹî‚'8 Ã0 _|ñnܸ_|Qç5¿þE£±± Âßß~û-~øáÌ›7OqͲ‡––!~š··7T*RRR°uëVüðè©©Aff&¶mÛ¦È^ÍGí4ýz&NœWWW9rµµµB¾ââbÜ¿AAA‚O@Û.?4O¤[ZZPZZŠAƒé—zû¢Ä7¹vk3) õ«˜oRþÊôxñâEdffâÔ©S¨««Ã­[·-ô§§'lmm‰·ß~¥¥¥¨®®Æùóç±nÝ:Å~(=7€¶·8 ²eË„t%¶è·rz1–¦•êN¿½ñÆoÀÒÒkÖ¬AAAÆŒ#¼…;/¥|Wª½¬¬,”•• Kûõë:þkÆ$Ýúvt¤Ÿ Õ­osgu¨±ÑÐØÑY:ã»R}B+W® ""‚Vµ‘Ò„’kS—èЗ< Ã0ŒIèè&yyy€‚ƒƒ©ªªŠÒÒÒhüøñÔ·o_ºzõ*9s†ÂÂÂÈÌÌŒ–/_Nåååtýúuš:u*ýêW¿¢)ÊóñÇzæ™g¨¶¶–ˆˆŽ?.¤Õ××ÑÎ;Û}¬:pà@ºzõª"{÷íÛGèóÏ?§øøx*..­'55•Ðïÿ{*))¡ÒÒRš;w.ùúúRkk+566’¯¯¯ð±lkk+=xð€ íÛ·¢¢¢(33S²}kjjH­VÓ³Ï>«“®¤ìÖÖVZ¹r% Å‹SQQ}ÿý÷4{öl@jµšvîÜIÿøÇ?ÈÖÖ–²²²„òå|“kg©¾«K?_SSÍŸ?_øPúáÇÔÜÜ,|¬¼~ýzjnn¦ÖÖV¡¯æÍ›GŠúwõêÕ¢4»¹¹ÑgŸ}FDD111í~ïÛ·/;wNÒ}}*±E›§žzŠÆŽÛN†l©­­t››+£oŸR½CÓJu§ßï Ô¿Ú»w/UUUQQQ¹»» °ëŸ—¢¾KioË–-dffF›6m¢²²2º|ù2¹»»Shh¨p\||< ØØXª­­¥„„òññ!ÂúvdffÊö³’ºÅÆ·ÎèPƒÔØ¡¡µµ•JJJ¨ÿþôì³Ïêì@&UvG}?~ü¸di#·‹šÜ9[SSCO>ù$y{{SSS“Nh6qÓ„’ëŽR ±ÉOp†azÙEmÆ 4pà@?~<ýë_ÿ¢¤¤$R©TôòË/ÓÇ),,ŒT*íÞ½›L¤^xÊËË…2äòœ8qBçÂ6lØ0:vì˜Nš‡‡‡P^ll,¹ºº’ ýîw¿Ó¹¸ÊÙ[^^NÏ<ó 988Prr²ÁzÒÓÓÉÃÃ,,,ÈÍÍ6mÚDDD4sæLãÞyçaËYíÚÛE‹±víZúôÓOuÒ””ýÞ{ïQKK mÚ´‰ÈÆÆ†^xáÚ±cyzzÒîÝ»©ªªŠbccÉÖÖ–.^¼¨S‡!ßäÚYªÍôëË “¶uëVZ¼x±NZPP°»—æŸæI®³²²ÈÆÆFô†ÉÉÉIðmÿþý4räH²²²"ooo:yò¤ŽßÚ~ˆéS‰-ÚDGGSLLŒ¨¤lÑîsZ»v­¨}Jõ"×ïÆÒÝûï¿ß®ß(..޶mÛFC† ¡aÆÑöíÛ… µþy)å»”öZ[[)>>žÆŽKýû÷'wwwÚ³gζÉõõõô‡?ü,--iܸqtæÌzã7hÊ”)ÂÅúv(ég¹º¥ôÓQê#6vhÿ¦¯ÿK—.,»£¾{{{‹öQG‘;gׯ_/ú›æw)M(¹6)Ej‚cöÿ?2 Ã0=È¢E‹wÍÿŠ+ðÁè,ûèL†1iii¸ÿ>^zé%!­¾¾ׯ_GHH²³³»´ÉAgñ÷÷GRRìì캽n†é͘êœ5æuÇÌÌ ©©©Â5TCß.—Ì0 ÃôJ>|¨³^¿³y¦« <<¼Ý÷GÖÖÖ7n»}rCD8xð ìííyrÃ0z˜òœíŽëo2À0 óR]]œœ466â‹/¾ýðVI†1×®]CEEV®\‰K—.áþýû¨««C~~>^{í5w›-§N‚ ÌÍͱfÍlݺµÛêf˜GS³ÝuÝá Ã0ÌcFUUÔj5.]º˜1c;œ‡aŒÅ³Ï>‹ÌÌLܼy~~~ppp€‡‡’““ñ׿þNNNÝf‹ ,--1aÂ|òÉ'9rd·ÕÍ0 ¦8g»óºÃßà0 ÃôLñ Ã0 Ã<ÎH}ƒÃop†a†a†ylà Ã0 Ã0 Ã0 <Áa†a†aæ±'8 Ã0 Ã0 Ã<6p†a˜^ÂíÛ·qôèÑž6ƒa†aix‚Ã0 ÓKÈÊÊj· Ã0 Ã0ƒ·‰f†a†a汿Áa†a†aæ±'8 Ã0 Ã0 Ã<6ð‡a†a†a˜Ç†¾xˆa†a†a þ-¢V®ñc IEND®B`‚crun-1.16.1/libocispec/image-spec/.github/0000775000000000000000000000000014332154664016435 5ustar0000000000000000crun-1.16.1/libocispec/image-spec/.github/workflows/0000775000000000000000000000000014614670026020470 5ustar0000000000000000crun-1.16.1/libocispec/image-spec/.github/workflows/docs-and-linting.yml0000644000000000000000000000222414614670026024343 0ustar0000000000000000name: Render and Lint Documentation on: pull_request: branches_ignore: [] jobs: build: runs-on: ubuntu-latest strategy: matrix: go: ['1.19', '1.20', '1.21'] name: Documentation and Linting steps: - uses: actions/checkout@v4 with: path: go/src/github.com/opencontainers/image-spec - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - name: Render and Lint env: GOPATH: /home/runner/work/image-spec/image-spec/go # do not automatically upgrade go to a different version: https://go.dev/doc/toolchain GOTOOLCHAIN: local run: | export PATH=$GOPATH/bin:$PATH cd go/src/github.com/opencontainers/image-spec make install.tools go get -t -d ./... ls ../ make make .gitvalidation make lint make check-license make test make docs - name: documentation artifacts uses: actions/upload-artifact@v3 with: name: oci-docs path: go/src/github.com/opencontainers/image-spec/output crun-1.16.1/libocispec/image-spec/.github/PULL_REQUEST_TEMPLATE/0000755000000000000000000000000014614670103021704 5ustar0000000000000000crun-1.16.1/libocispec/image-spec/.github/PULL_REQUEST_TEMPLATE/maintainer_nomination.md0000644000000000000000000000111214614670103026603 0ustar0000000000000000# Nomination for a New Maintainer ## Nominating Maintainer Name of the existing OCI maintainer with GitHub username ## New Maintainer Name of the new maintainer with GitHub username ## Justification Highlight any work contributed by the new maintainer. Examples of contributions may be: - Community involvement in mailing lists and meetings - Involvement in any OCI working groups - Contributions to any of the OCI git repositories Other considerations may be: - Diversity of organizations - Time involved in the community - Personal experience working with the new maintainer crun-1.16.1/libocispec/image-spec/schema/0000775000000000000000000000000014614670026016333 5ustar0000000000000000crun-1.16.1/libocispec/image-spec/schema/content-descriptor.json0000644000000000000000000000253614416051456023060 0ustar0000000000000000{ "description": "OpenContainer Content Descriptor Specification", "$schema": "http://json-schema.org/draft-04/schema#", "id": "https://opencontainers.org/schema/descriptor", "type": "object", "properties": { "mediaType": { "description": "the mediatype of the referenced object", "$ref": "defs-descriptor.json#/definitions/mediaType" }, "size": { "description": "the size in bytes of the referenced object", "$ref": "defs.json#/definitions/int64" }, "digest": { "description": "the cryptographic checksum digest of the object, in the pattern ':'", "$ref": "defs-descriptor.json#/definitions/digest" }, "urls": { "description": "a list of urls from which this object may be downloaded", "$ref": "defs-descriptor.json#/definitions/urls" }, "data": { "description": "an embedding of the targeted content (base64 encoded)", "$ref": "defs.json#/definitions/base64" }, "artifactType": { "description": "the IANA media type of this artifact", "$ref": "defs-descriptor.json#/definitions/mediaType" }, "annotations": { "id": "https://opencontainers.org/schema/descriptor/annotations", "$ref": "defs-descriptor.json#/definitions/annotations" } }, "required": [ "mediaType", "size", "digest" ] } crun-1.16.1/libocispec/image-spec/schema/defs.json0000644000000000000000000000336114416051456020150 0ustar0000000000000000{ "description": "Definitions used throughout the OpenContainer Specification", "definitions": { "int8": { "type": "integer", "minimum": -128, "maximum": 127 }, "int16": { "type": "integer", "minimum": -32768, "maximum": 32767 }, "int32": { "type": "integer", "minimum": -2147483648, "maximum": 2147483647 }, "int64": { "type": "integer", "minimum": -9223372036854776000, "maximum": 9223372036854776000 }, "uint8": { "type": "integer", "minimum": 0, "maximum": 255 }, "uint16": { "type": "integer", "minimum": 0, "maximum": 65535 }, "uint32": { "type": "integer", "minimum": 0, "maximum": 4294967295 }, "uint64": { "type": "integer", "minimum": 0, "maximum": 18446744073709552000 }, "uint16Pointer": { "oneOf": [ { "$ref": "#/definitions/uint16" }, { "type": "null" } ] }, "uint64Pointer": { "oneOf": [ { "$ref": "#/definitions/uint64" }, { "type": "null" } ] }, "base64": { "type": "string", "media": { "binaryEncoding": "base64" } }, "stringPointer": { "oneOf": [ { "type": "string" }, { "type": "null" } ] }, "mapStringString": { "type": "object", "patternProperties": { ".{1,}": { "type": "string" } } }, "mapStringObject": { "type": "object", "patternProperties": { ".{1,}": { "type": "object" } } } } } crun-1.16.1/libocispec/image-spec/schema/descriptor_test.go0000644000000000000000000002135714416051456022105 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package schema_test import ( "strings" "testing" "github.com/opencontainers/image-spec/schema" ) func TestDescriptor(t *testing.T) { for i, tt := range []struct { descriptor string fail bool }{ // valid descriptor { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: false, }, // expected failure: mediaType missing { descriptor: ` { "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: true, }, // expected failure: mediaType does not match pattern (no subtype) { descriptor: ` { "mediaType": "application", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: true, }, // expected failure: mediaType does not match pattern (invalid first type character) { descriptor: ` { "mediaType": ".foo/bar", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: true, }, // expected failure: mediaType does not match pattern (invalid first subtype character) { descriptor: ` { "mediaType": "foo/.bar", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: true, }, // expected success: mediaType has type and subtype as long as possible { descriptor: ` { "mediaType": "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567/1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: false, }, // expected failure: mediaType does not match pattern (type too long) { descriptor: ` { "mediaType": "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678/bar", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: true, }, // expected failure: mediaType does not match pattern (subtype too long) { descriptor: ` { "mediaType": "foo/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: true, }, // expected failure: size missing { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: true, }, // expected failure: size is a string, expected integer { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": "7682", "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: true, }, // expected failure: digest missing { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682 } `, fail: true, }, // expected failure: digest does not match pattern (no algorithm) { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": ":5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: true, }, // expected failure: digest does not match pattern (no hash) { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256" } `, fail: true, }, // expected failure: digest does not match pattern (invalid aglorithm characters) { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "SHA256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: true, }, // expected failure: digest does not match pattern (characters needs to be lower for sha256) { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5B0BCABD1ED22E9FB1310CF6C2DEC7CDEF19F0AD69EFA1F392E94A4333501270" } `, fail: true, }, // expected success: valid URL entry { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "urls": [ "https://example.com/foo" ] } `, fail: false, }, // expected failure: urls does not match format (invalide url characters) { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "urls": [ "value" ] } `, fail: true, }, // expected success: artifactType is present and an IANA compliant value { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "artifactType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: false, }, // expected failure: artifactType does not match pattern (invalid first subtype character) { descriptor: ` { "mediaType": "application/vnd.oci.image.manifest.v1+json", "artifactType": "foo/.bar", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } `, fail: true, }, // expected success: data field is present and has base64 content { descriptor: ` { "mediaType": "text/plain", "size": 34, "data": "aHR0cHM6Ly9naXRodWIuY29tL29wZW5jb250YWluZXJzCg==", "digest": "sha256:2690af59371e9eca9453dc29882643f46e5ca47ec2862bd517b5e17351325153" } `, fail: false, }, { descriptor: `{ "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256+b64:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }`, }, { descriptor: `{ "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256+b64:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }`, }, { descriptor: `{ "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256+foo-bar:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }`, }, { descriptor: ` { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256.foo-bar:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }`, }, { descriptor: `{ "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "multihash+base58:QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8" }`, }, { // fail: repeated separators in algorithm descriptor: `{ "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256+foo+-b:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }`, fail: true, }, { descriptor: `{ "digest": "sha256+b64u:LCa0a2j_xo_5m0U8HTBBNBNCLXBkg7-g-YpeiGJm564", "size": 1000000, "mediaType": "application/vnd.oci.image.config.v1+json" }`, }, { // test for those who cannot use modulo arithmetic to recover padding. descriptor: `{ "digest": "sha256+b64u.unknownlength:LCa0a2j_xo_5m0U8HTBBNBNCLXBkg7-g-YpeiGJm564=", "size": 1000000, "mediaType": "application/vnd.oci.image.config.v1+json" }`, }, { descriptor: ` { "mediaType": "text/plain", "size": 34, "data": "aHR0cHM6Ly9naXRodWIuY29tL29wZW5jb250YWluZXJzCg", "digest": "sha256:2690af59371e9eca9453dc29882643f46e5ca47ec2862bd517b5e17351325153" } `, fail: true, }, } { r := strings.NewReader(tt.descriptor) err := schema.ValidatorMediaTypeDescriptor.Validate(r) if got := err != nil; tt.fail != got { t.Errorf("test %d: expected validation failure %t but got %t, err %v", i, tt.fail, got, err) } } } crun-1.16.1/libocispec/image-spec/schema/image-layout-schema.json0000644000000000000000000000066714416051456023070 0ustar0000000000000000{ "description": "OpenContainer Image Layout Schema", "$schema": "http://json-schema.org/draft-04/schema#", "id": "https://opencontainers.org/schema/image/layout", "type": "object", "properties": { "imageLayoutVersion": { "description": "version of the OCI Image Layout (in the oci-layout file)", "type": "string", "enum": [ "1.0.0" ] } }, "required": [ "imageLayoutVersion" ] } crun-1.16.1/libocispec/image-spec/schema/loader.go0000644000000000000000000000700414416051456020127 0ustar0000000000000000// Copyright 2018 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package schema import ( "bytes" "encoding/json" "fmt" "io" "net/http" "strings" "github.com/xeipuuv/gojsonreference" "github.com/xeipuuv/gojsonschema" ) // fsLoaderFactory implements gojsonschema.JSONLoaderFactory by reading files under the specified namespaces from the root of fs. type fsLoaderFactory struct { namespaces []string fs http.FileSystem } // newFSLoaderFactory returns a fsLoaderFactory reading files under the specified namespaces from the root of fs. func newFSLoaderFactory(namespaces []string, fs http.FileSystem) *fsLoaderFactory { return &fsLoaderFactory{ namespaces: namespaces, fs: fs, } } func (factory *fsLoaderFactory) New(source string) gojsonschema.JSONLoader { return &fsLoader{ factory: factory, source: source, } } // refContents returns the contents of ref, if available in fsLoaderFactory. func (factory *fsLoaderFactory) refContents(ref gojsonreference.JsonReference) ([]byte, error) { refStr := ref.String() path := "" for _, ns := range factory.namespaces { if strings.HasPrefix(refStr, ns) { path = "/" + strings.TrimPrefix(refStr, ns) break } } if path == "" { return nil, fmt.Errorf("schema reference %#v unexpectedly not available in fsLoaderFactory with namespaces %#v", path, factory.namespaces) } f, err := factory.fs.Open(path) if err != nil { return nil, err } defer f.Close() return io.ReadAll(f) } // fsLoader implements gojsonschema.JSONLoader by reading the document named by source from a fsLoaderFactory. type fsLoader struct { factory *fsLoaderFactory source string } // JsonSource implements gojsonschema.JSONLoader.JsonSource. The "Json" capitalization needs to be maintained to conform to the interface. func (l *fsLoader) JsonSource() interface{} { // revive:disable-line:var-naming return l.source } func (l *fsLoader) LoadJSON() (interface{}, error) { // Based on gojsonschema.jsonReferenceLoader.LoadJSON. reference, err := gojsonreference.NewJsonReference(l.source) if err != nil { return nil, err } refToURL := reference refToURL.GetUrl().Fragment = "" body, err := l.factory.refContents(refToURL) if err != nil { return nil, err } return decodeJSONUsingNumber(bytes.NewReader(body)) } // decodeJSONUsingNumber returns JSON parsed from an io.Reader func decodeJSONUsingNumber(r io.Reader) (interface{}, error) { // Copied from gojsonschema. var document interface{} decoder := json.NewDecoder(r) decoder.UseNumber() err := decoder.Decode(&document) if err != nil { return nil, err } return document, nil } // JsonReference implements gojsonschema.JSONLoader.JsonReference. The "Json" capitalization needs to be maintained to conform to the interface. func (l *fsLoader) JsonReference() (gojsonreference.JsonReference, error) { // revive:disable-line:var-naming return gojsonreference.NewJsonReference(l.JsonSource().(string)) } func (l *fsLoader) LoaderFactory() gojsonschema.JSONLoaderFactory { return l.factory } crun-1.16.1/libocispec/image-spec/schema/error.go0000644000000000000000000000305614614670026020015 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package schema import ( "bufio" "encoding/json" "errors" "io" ) // A SyntaxError is a description of a JSON syntax error // including line, column and offset in the JSON file. type SyntaxError struct { msg string Line, Col int Offset int64 } func (e *SyntaxError) Error() string { return e.msg } // WrapSyntaxError checks whether the given error is a *json.SyntaxError // and converts it into a *schema.SyntaxError containing line/col information using the given reader. // If the given error is not a *json.SyntaxError it is returned unchanged. func WrapSyntaxError(r io.Reader, err error) error { var serr *json.SyntaxError if errors.As(err, &serr) { buf := bufio.NewReader(r) line := 0 col := 0 for i := int64(0); i < serr.Offset; i++ { b, berr := buf.ReadByte() if berr != nil { break } if b == '\n' { line++ col = 1 } else { col++ } } return &SyntaxError{serr.Error(), line, col, serr.Offset} } return err } crun-1.16.1/libocispec/image-spec/schema/image-index-schema.json0000644000000000000000000000644714614670026022664 0ustar0000000000000000{ "description": "OpenContainer Image Index Specification", "$schema": "http://json-schema.org/draft-04/schema#", "id": "https://opencontainers.org/schema/image/index", "type": "object", "properties": { "schemaVersion": { "description": "This field specifies the image index schema version as an integer", "id": "https://opencontainers.org/schema/image/index/schemaVersion", "type": "integer", "minimum": 2, "maximum": 2 }, "mediaType": { "description": "the mediatype of the referenced object", "$ref": "defs-descriptor.json#/definitions/mediaType" }, "artifactType": { "description": "the artifact mediatype of the referenced object", "$ref": "defs-descriptor.json#/definitions/mediaType" }, "subject": { "$ref": "content-descriptor.json" }, "manifests": { "type": "array", "items": { "id": "https://opencontainers.org/schema/image/manifestDescriptor", "type": "object", "required": [ "mediaType", "size", "digest" ], "properties": { "mediaType": { "description": "the mediatype of the referenced object", "$ref": "defs-descriptor.json#/definitions/mediaType" }, "size": { "description": "the size in bytes of the referenced object", "$ref": "defs.json#/definitions/int64" }, "digest": { "description": "the cryptographic checksum digest of the object, in the pattern ':'", "$ref": "defs-descriptor.json#/definitions/digest" }, "urls": { "description": "a list of urls from which this object may be downloaded", "$ref": "defs-descriptor.json#/definitions/urls" }, "platform": { "id": "https://opencontainers.org/schema/image/platform", "type": "object", "required": [ "architecture", "os" ], "properties": { "architecture": { "id": "https://opencontainers.org/schema/image/platform/architecture", "type": "string" }, "os": { "id": "https://opencontainers.org/schema/image/platform/os", "type": "string" }, "os.version": { "id": "https://opencontainers.org/schema/image/platform/os.version", "type": "string" }, "os.features": { "id": "https://opencontainers.org/schema/image/platform/os.features", "type": "array", "items": { "type": "string" } }, "variant": { "type": "string" } } }, "annotations": { "id": "https://opencontainers.org/schema/image/descriptor/annotations", "$ref": "defs-descriptor.json#/definitions/annotations" } } } }, "annotations": { "id": "https://opencontainers.org/schema/image/index/annotations", "$ref": "defs-descriptor.json#/definitions/annotations" } }, "required": [ "schemaVersion", "manifests" ] } crun-1.16.1/libocispec/image-spec/schema/imageindex_test.go0000644000000000000000000001622014614670026022032 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package schema_test import ( "strings" "testing" "github.com/opencontainers/image-spec/schema" ) func TestImageIndex(t *testing.T) { for i, tt := range []struct { imageIndex string fail bool }{ // expected failure: mediaType does not match pattern { imageIndex: ` { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "invalid", "size": 7143, "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", "platform": { "architecture": "ppc64le", "os": "linux" } } ] } `, fail: true, }, // expected failure: manifest.size is string, expected integer { imageIndex: ` { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": "7682", "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "platform": { "architecture": "amd64", "os": "linux" } } ] } `, fail: true, }, // expected failure: manifest.digest is missing, expected required { imageIndex: ` { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "platform": { "architecture": "amd64", "os": "linux" } } ] } `, fail: true, }, // expected failure: in the optional field platform platform.architecture is missing, expected required { imageIndex: ` { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "platform": { "os": "linux" } } ] } `, fail: true, }, // expected failure: invalid referenced manifest media type { imageIndex: ` { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "invalid", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "platform": { "architecture": "amd64", "os": "linux" } } ] } `, fail: true, }, // expected failure: empty referenced manifest media type { imageIndex: ` { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "platform": { "architecture": "amd64", "os": "linux" } } ] } `, fail: true, }, // valid image index, with optional fields { imageIndex: ` { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7143, "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", "platform": { "architecture": "ppc64le", "os": "linux" } }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "platform": { "architecture": "amd64", "os": "linux" } } ], "annotations": { "com.example.key1": "value1", "com.example.key2": "value2" } } `, fail: false, }, // valid image index, with required fields only { imageIndex: ` { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7143, "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f" } ] } `, fail: false, }, // valid image index, with customized media type of referenced manifest { imageIndex: ` { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/customized.manifest+json", "size": 7143, "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", "platform": { "architecture": "ppc64le", "os": "linux" } } ] } `, fail: false, }, // valid image index with artifactType and manifests { imageIndex: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.index.v1+json", "artifactType": "application/vnd.example+type", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7143, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "artifactType": "application/vnd.example1+type", "size": 506, "digest": "sha256:99953afc4b90c7d78079d189ae10da0a1002e6be5e9e8dedaf9f7f29def42111" } ] } `, fail: false, }, // valid image index with a subject field { imageIndex: ` { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "platform": { "architecture": "amd64", "os": "linux" } } ], "subject" : { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 1234, "digest": "sha256:220a60ecd4a3c32c282622a625a54db9ba0ff55b5ba9c29c7064a2bc358b6a3e" } } `, fail: false, }, // expected failure, invalid subject field { imageIndex: ` { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", "platform": { "architecture": "amd64", "os": "linux" } } ], "subject" : "nope" } `, fail: true, }, } { r := strings.NewReader(tt.imageIndex) err := schema.ValidatorMediaTypeImageIndex.Validate(r) if got := err != nil; tt.fail != got { t.Errorf("test %d: expected validation failure %t but got %t, err %v", i, tt.fail, got, err) } } } crun-1.16.1/libocispec/image-spec/schema/manifest_test.go0000644000000000000000000002213614614670026021531 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package schema_test import ( "strings" "testing" "github.com/opencontainers/image-spec/schema" ) func TestManifest(t *testing.T) { for i, tt := range []struct { manifest string fail bool }{ // expected failure: mediaType does not match pattern { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "invalid", "size": 1470, "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 148, "digest": "sha256:c57089565e894899735d458f0fd4bb17a0f1e0df8d72da392b85c9b35ee777cd" } ] } `, fail: true, }, // expected failure: config.size is a string, expected integer { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "config": { "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": "1470", "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 148, "digest": "sha256:c57089565e894899735d458f0fd4bb17a0f1e0df8d72da392b85c9b35ee777cd" } ] } `, fail: true, }, // expected failure: layers.size is string, expected integer { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": "675598", "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" } ] } `, fail: true, }, // valid manifest with optional fields { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 675598, "digest": "sha256:9d3dd9504c685a304985025df4ed0283e47ac9ffa9bd0326fddf4d59513f0827" }, { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 156, "digest": "sha256:2b689805fbd00b2db1df73fae47562faac1a626d5f61744bfe29946ecff5d73d" }, { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 148, "digest": "sha256:c57089565e894899735d458f0fd4bb17a0f1e0df8d72da392b85c9b35ee777cd" } ], "annotations": { "key1": "value1", "key2": "value2" } } `, fail: false, }, // valid manifest with only required fields { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 675598, "digest": "sha256:9d3dd9504c685a304985025df4ed0283e47ac9ffa9bd0326fddf4d59513f0827" }, { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 156, "digest": "sha256:2b689805fbd00b2db1df73fae47562faac1a626d5f61744bfe29946ecff5d73d" }, { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 148, "digest": "sha256:c57089565e894899735d458f0fd4bb17a0f1e0df8d72da392b85c9b35ee777cd" } ] } `, fail: false, }, // expected failure: empty layer, expected at least one { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [] } `, fail: true, }, // expected pass: test bounds of algorithm field in digest. { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256+b64:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 1470, "digest": "sha256+foo-bar:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 1470, "digest": "sha256.foo-bar:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 1470, "digest": "multihash+base58:QmRZxt2b1FVZPNqd8hsiykDL3TdBDeTSPX9Kv46HmX4Gx8" } ] } `, }, // expected success: subject field with a valid descriptor { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 1470, "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" } ], "subject" : { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 1234, "digest": "sha256:220a60ecd4a3c32c282622a625a54db9ba0ff55b5ba9c29c7064a2bc358b6a3e" } } `, fail: false, }, // expected failure: subject field with invalid value (something that is not a descriptor) { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 1470, "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" } ], "subject" : ".nope" } `, fail: true, }, // expected failure: push bounds of algorithm field in digest too far. { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, "digest": "sha256+b64:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [ { "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 1470, "digest": "sha256+foo+-b:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" } ] } `, fail: true, }, // valid manifest for an artifact with a dedicated config { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/vnd.example.config+json", "size": 1470, "digest": "sha256:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" }, "layers": [ { "mediaType": "application/vnd.example.data+type", "size": 675598, "digest": "sha256:9d3dd9504c685a304985025df4ed0283e47ac9ffa9bd0326fddf4d59513f0827" } ] } `, fail: false, }, // valid manifest for an artifact using the empty config and artifactType { manifest: ` { "schemaVersion": 2, "mediaType" : "application/vnd.oci.image.manifest.v1+json", "artifactType": "application/vnd.example+type", "config": { "mediaType": "application/vnd.oci.empty.v1+json", "size": 2, "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a" }, "layers": [ { "mediaType": "application/vnd.example+type", "size": 675598, "digest": "sha256:9d3dd9504c685a304985025df4ed0283e47ac9ffa9bd0326fddf4d59513f0827" } ] } `, fail: false, }, } { r := strings.NewReader(tt.manifest) err := schema.ValidatorMediaTypeManifest.Validate(r) if got := err != nil; tt.fail != got { t.Errorf("test %d: expected validation failure %t but got %t, err %v", i, tt.fail, got, err) } } } crun-1.16.1/libocispec/image-spec/schema/spec_test.go0000644000000000000000000001206614614670026020656 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package schema_test import ( "bytes" "errors" "fmt" "io" "net/url" "os" "path/filepath" "reflect" "strings" "testing" "github.com/opencontainers/image-spec/schema" "github.com/russross/blackfriday" ) var ( errFormatInvalid = errors.New("format: invalid") ) func TestValidateDescriptor(t *testing.T) { validate(t, "../descriptor.md") } func TestValidateManifest(t *testing.T) { validate(t, "../manifest.md") } func TestValidateImageIndex(t *testing.T) { validate(t, "../image-index.md") } func TestValidateImageLayout(t *testing.T) { validate(t, "../image-layout.md") } func TestValidateConfig(t *testing.T) { validate(t, "../config.md") } func TestSchemaFS(t *testing.T) { expectedSchemaFileNames, err := filepath.Glob("*.json") if err != nil { t.Error(err) } dir, err := schema.FileSystem().Open("/") if err != nil { t.Fatal(err) } files, err := dir.Readdir(-1) if err != nil { t.Fatal(err) } var schemaFileNames []string for _, f := range files { schemaFileNames = append(schemaFileNames, f.Name()) } if !reflect.DeepEqual(schemaFileNames, expectedSchemaFileNames) { t.Fatalf("got %v, expected %v", schemaFileNames, expectedSchemaFileNames) } } // TODO(sur): include examples from all specification files func validate(t *testing.T, name string) { m, err := os.Open(name) if err != nil { t.Fatal(err) } defer m.Close() examples, err := extractExamples(m) if err != nil { t.Fatal(err) } for _, example := range examples { if errors.Is(example.Err, errFormatInvalid) && example.Mediatype == "" { // ignore continue } if example.Err != nil { printFields(t, "error", example.Mediatype, example.Title, example.Err) t.Error(err) continue } err = schema.Validator(example.Mediatype).Validate(strings.NewReader(example.Body)) if err == nil { printFields(t, "ok", example.Mediatype, example.Title) t.Log(example.Body, "---") continue } var errs []error var verr schema.ValidationError if errors.As(err, &verr) { errs = verr.Errs } else { printFields(t, "error", example.Mediatype, example.Title, err) t.Error(err) t.Log(example.Body, "---") continue } for _, err := range errs { printFields(t, "invalid", example.Mediatype, example.Title) t.Error(err) fmt.Println(example.Body, "---") continue } } } // renderer allows one to incercept fenced blocks in markdown documents. type renderer struct { blackfriday.Renderer fn func(text []byte, lang string) } func (r *renderer) BlockCode(out *bytes.Buffer, text []byte, lang string) { r.fn(text, lang) r.Renderer.BlockCode(out, text, lang) } type example struct { Lang string // gets raw "lang" field Title string Mediatype string Body string Err error // TODO(stevvooe): Figure out how to keep track of revision, file, line so // that we can trace back verification output. } // parseExample treats the field as a syntax,attribute tuple separated by a comma. // Attributes are encoded as a url values. // // An example of this is `json,title=Foo%20Bar&mediatype=application/json. We // get that the "lang" is json, the title is "Foo Bar" and the mediatype is // "application/json". // // This preserves syntax highlighting and lets us tag examples with further // metadata. func parseExample(lang, body string) (e example) { e.Lang = lang e.Body = body parts := strings.SplitN(lang, ",", 2) if len(parts) < 2 { e.Err = errFormatInvalid return } m, err := url.ParseQuery(parts[1]) if err != nil { e.Err = err return } e.Mediatype = m.Get("mediatype") e.Title = m.Get("title") return } func extractExamples(rd io.Reader) ([]example, error) { p, err := io.ReadAll(rd) if err != nil { return nil, err } var examples []example renderer := &renderer{ Renderer: blackfriday.HtmlRenderer(0, "test test", ""), fn: func(text []byte, lang string) { examples = append(examples, parseExample(lang, string(text))) }, } // just pass over the markdown and ignore the rendered result. We just want // the side-effect of calling back for each code block. // TODO(stevvooe): Consider just parsing these with a scanner. It will be // faster and we can retain file, line no. blackfriday.MarkdownOptions(p, renderer, blackfriday.Options{ Extensions: blackfriday.EXTENSION_FENCED_CODE, }) return examples, nil } // printFields prints each value tab separated. func printFields(t *testing.T, vs ...interface{}) { var ss []string for _, f := range vs { ss = append(ss, fmt.Sprint(f)) } t.Log(strings.Join(ss, "\t")) } crun-1.16.1/libocispec/image-spec/schema/validator.go0000644000000000000000000001546114614670026020654 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package schema import ( "bytes" "encoding/json" "errors" "fmt" "io" "regexp" digest "github.com/opencontainers/go-digest" v1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/xeipuuv/gojsonschema" ) // Validator wraps a media type string identifier // and implements validation against a JSON schema. type Validator string type validateFunc func(r io.Reader) error var mapValidate = map[Validator]validateFunc{ ValidatorMediaTypeImageConfig: validateConfig, ValidatorMediaTypeDescriptor: validateDescriptor, ValidatorMediaTypeImageIndex: validateIndex, ValidatorMediaTypeManifest: validateManifest, } // ValidationError contains all the errors that happened during validation. type ValidationError struct { Errs []error } func (e ValidationError) Error() string { return fmt.Sprintf("%v", e.Errs) } // Validate validates the given reader against the schema of the wrapped media type. func (v Validator) Validate(src io.Reader) error { buf, err := io.ReadAll(src) if err != nil { return fmt.Errorf("unable to read the document file: %w", err) } if f, ok := mapValidate[v]; ok { if f == nil { return fmt.Errorf("internal error: mapValidate[%q] is nil", v) } err = f(bytes.NewReader(buf)) if err != nil { return err } } sl := newFSLoaderFactory(schemaNamespaces, FileSystem()).New(specs[v]) ml := gojsonschema.NewStringLoader(string(buf)) result, err := gojsonschema.Validate(sl, ml) if err != nil { return fmt.Errorf("schema %s: unable to validate: %w", v, WrapSyntaxError(bytes.NewReader(buf), err)) } if result.Valid() { return nil } errs := make([]error, 0, len(result.Errors())) for _, desc := range result.Errors() { errs = append(errs, fmt.Errorf("%s", desc)) } return ValidationError{ Errs: errs, } } type unimplemented string func (v unimplemented) Validate(_ io.Reader) error { return fmt.Errorf("%s: unimplemented", v) } func validateManifest(r io.Reader) error { header := v1.Manifest{} buf, err := io.ReadAll(r) if err != nil { return fmt.Errorf("error reading the io stream: %w", err) } err = json.Unmarshal(buf, &header) if err != nil { return fmt.Errorf("manifest format mismatch: %w", err) } if header.Config.MediaType != string(v1.MediaTypeImageConfig) { fmt.Printf("warning: config %s has an unknown media type: %s\n", header.Config.Digest, header.Config.MediaType) } for _, layer := range header.Layers { if layer.MediaType != string(v1.MediaTypeImageLayer) && layer.MediaType != string(v1.MediaTypeImageLayerGzip) && layer.MediaType != string(v1.MediaTypeImageLayerZstd) && layer.MediaType != string(v1.MediaTypeImageLayerNonDistributable) && //nolint:staticcheck layer.MediaType != string(v1.MediaTypeImageLayerNonDistributableGzip) && //nolint:staticcheck layer.MediaType != string(v1.MediaTypeImageLayerNonDistributableZstd) { //nolint:staticcheck fmt.Printf("warning: layer %s has an unknown media type: %s\n", layer.Digest, layer.MediaType) } } return nil } func validateDescriptor(r io.Reader) error { header := v1.Descriptor{} buf, err := io.ReadAll(r) if err != nil { return fmt.Errorf("error reading the io stream: %w", err) } err = json.Unmarshal(buf, &header) if err != nil { return fmt.Errorf("descriptor format mismatch: %w", err) } err = header.Digest.Validate() if errors.Is(err, digest.ErrDigestUnsupported) { // we ignore unsupported algorithms fmt.Printf("warning: unsupported digest: %q: %v\n", header.Digest, err) return nil } return err } func validateIndex(r io.Reader) error { header := v1.Index{} buf, err := io.ReadAll(r) if err != nil { return fmt.Errorf("error reading the io stream: %w", err) } err = json.Unmarshal(buf, &header) if err != nil { return fmt.Errorf("index format mismatch: %w", err) } for _, manifest := range header.Manifests { if manifest.MediaType != string(v1.MediaTypeImageManifest) { fmt.Printf("warning: manifest %s has an unknown media type: %s\n", manifest.Digest, manifest.MediaType) } if manifest.Platform != nil { checkPlatform(manifest.Platform.OS, manifest.Platform.Architecture) checkArchitecture(manifest.Platform.Architecture, manifest.Platform.Variant) } } return nil } func validateConfig(r io.Reader) error { header := v1.Image{} buf, err := io.ReadAll(r) if err != nil { return fmt.Errorf("error reading the io stream: %w", err) } err = json.Unmarshal(buf, &header) if err != nil { return fmt.Errorf("config format mismatch: %w", err) } checkPlatform(header.OS, header.Architecture) checkArchitecture(header.Architecture, header.Variant) envRegexp := regexp.MustCompile(`^[^=]+=.*$`) for _, e := range header.Config.Env { if !envRegexp.MatchString(e) { return fmt.Errorf("unexpected env: %q", e) } } return nil } func checkArchitecture(Architecture string, Variant string) { validCombins := map[string][]string{ "arm": {"", "v6", "v7", "v8"}, "arm64": {"", "v8"}, "386": {""}, "amd64": {""}, "ppc64": {""}, "ppc64le": {""}, "mips64": {""}, "mips64le": {""}, "s390x": {""}, "riscv64": {""}, } for arch, variants := range validCombins { if arch == Architecture { for _, variant := range variants { if variant == Variant { return } } fmt.Printf("warning: combination of architecture %q and variant %q is not valid.\n", Architecture, Variant) } } fmt.Printf("warning: architecture %q is not supported yet.\n", Architecture) } func checkPlatform(OS string, Architecture string) { validCombins := map[string][]string{ "android": {"arm"}, "darwin": {"386", "amd64", "arm", "arm64"}, "dragonfly": {"amd64"}, "freebsd": {"386", "amd64", "arm"}, "linux": {"386", "amd64", "arm", "arm64", "ppc64", "ppc64le", "mips64", "mips64le", "s390x", "riscv64"}, "netbsd": {"386", "amd64", "arm"}, "openbsd": {"386", "amd64", "arm"}, "plan9": {"386", "amd64"}, "solaris": {"amd64"}, "windows": {"386", "amd64"}} for os, archs := range validCombins { if os == OS { for _, arch := range archs { if arch == Architecture { return } } fmt.Printf("warning: combination of os %q and architecture %q is invalid.\n", OS, Architecture) } } fmt.Printf("warning: operating system %q of the bundle is not supported yet.\n", OS) } crun-1.16.1/libocispec/image-spec/schema/config-schema.json0000644000000000000000000000573114416051456021735 0ustar0000000000000000{ "description": "OpenContainer Config Specification", "$schema": "http://json-schema.org/draft-04/schema#", "id": "https://opencontainers.org/schema/image/config", "type": "object", "properties": { "created": { "type": "string", "format": "date-time" }, "author": { "type": "string" }, "architecture": { "type": "string" }, "variant": { "type": "string" }, "os": { "type": "string" }, "os.version": { "type": "string" }, "os.features": { "type": "array", "items": { "type": "string" } }, "config": { "type": "object", "properties": { "User": { "type": "string" }, "ExposedPorts": { "$ref": "defs.json#/definitions/mapStringObject" }, "Env": { "type": "array", "items": { "type": "string" } }, "Entrypoint": { "oneOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "null" } ] }, "Cmd": { "oneOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "null" } ] }, "Volumes": { "oneOf": [ { "$ref": "defs.json#/definitions/mapStringObject" }, { "type": "null" } ] }, "WorkingDir": { "type": "string" }, "Labels": { "oneOf": [ { "$ref": "defs.json#/definitions/mapStringString" }, { "type": "null" } ] }, "StopSignal": { "type": "string" }, "ArgsEscaped": { "type": "boolean" } } }, "rootfs": { "type": "object", "properties": { "diff_ids": { "type": "array", "items": { "type": "string" } }, "type": { "type": "string", "enum": [ "layers" ] } }, "required": [ "diff_ids", "type" ] }, "history": { "type": "array", "items": { "type": "object", "properties": { "created": { "type": "string", "format": "date-time" }, "author": { "type": "string" }, "created_by": { "type": "string" }, "comment": { "type": "string" }, "empty_layer": { "type": "boolean" } } } } }, "required": [ "architecture", "os", "rootfs" ] } crun-1.16.1/libocispec/image-spec/schema/backwards_compatibility_test.go0000664000000000000000000003050014265762063024616 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package schema_test import ( _ "crypto/sha256" "strings" "testing" "github.com/opencontainers/go-digest" "github.com/opencontainers/image-spec/schema" v1 "github.com/opencontainers/image-spec/specs-go/v1" ) var compatMap = map[string]string{ "application/vnd.docker.distribution.manifest.list.v2+json": v1.MediaTypeImageIndex, "application/vnd.docker.distribution.manifest.v2+json": v1.MediaTypeImageManifest, "application/vnd.docker.image.rootfs.diff.tar.gzip": v1.MediaTypeImageLayerGzip, "application/vnd.docker.container.image.v1+json": v1.MediaTypeImageConfig, } // convertFormats converts Docker v2.2 image format JSON documents to OCI // format by simply replacing instances of the strings found in the compatMap // found in the input string. func convertFormats(input string) string { out := input for k, v := range compatMap { out = strings.Replace(out, k, v, -1) } return out } func TestBackwardsCompatibilityImageIndex(t *testing.T) { for i, tt := range []struct { imageIndex string digest digest.Digest fail bool }{ { digest: "sha256:4ffd0883f25635999f04ea543240a27c9a4341979ff7d46a9774f71512eebb1f", imageIndex: `{ "schemaVersion": 2, "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json", "manifests": [ { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "size": 2094, "digest": "sha256:7820f9a86d4ad15a2c4f0c0e5479298df2aa7c2f6871288e2ef8546f3e7b6783", "platform": { "architecture": "ppc64le", "os": "linux" } }, { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "size": 1922, "digest": "sha256:ae1b0e06e8ade3a11267564a26e750585ba2259c0ecab59ab165ad1af41d1bdd", "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "size": 2084, "digest": "sha256:e4c0df75810b953d6717b8f8f28298d73870e8aa2a0d5e77b8391f16fdfbbbe2", "platform": { "architecture": "s390x", "os": "linux" } }, { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "size": 2084, "digest": "sha256:07ebe243465ef4a667b78154ae6c3ea46fdb1582936aac3ac899ea311a701b40", "platform": { "architecture": "arm", "os": "linux", "variant": "v7" } }, { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "size": 2090, "digest": "sha256:fb2fc0707b86dafa9959fe3d29e66af8787aee4d9a23581714be65db4265ad8a", "platform": { "architecture": "arm64", "os": "linux", "variant": "v8" } } ] }`, fail: false, }, } { got := digest.FromString(tt.imageIndex) if tt.digest != got { t.Errorf("test %d: expected digest %s but got %s", i, tt.digest, got) } imageIndex := convertFormats(tt.imageIndex) r := strings.NewReader(imageIndex) err := schema.ValidatorMediaTypeImageIndex.Validate(r) if got := err != nil; tt.fail != got { t.Errorf("test %d: expected validation failure %t but got %t, err %v", i, tt.fail, got, err) } } } func TestBackwardsCompatibilityManifest(t *testing.T) { for i, tt := range []struct { manifest string digest digest.Digest fail bool }{ // manifest pulled from docker hub using hash value // // curl -L -H "Authorization: Bearer ..." -H \ // "Accept: application/vnd.docker.distribution.manifest.v2+json" \ // https://registry-1.docker.io/v2/library/docker/manifests/sha256:888206c77cd2811ec47e752ba291e5b7734e3ef137dfd222daadaca39a9f17bc { digest: "sha256:888206c77cd2811ec47e752ba291e5b7734e3ef137dfd222daadaca39a9f17bc", manifest: `{ "schemaVersion": 2, "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "config": { "mediaType": "application/octet-stream", "size": 3210, "digest": "sha256:5359a4f250650c20227055957e353e8f8a74152f35fe36f00b6b1f9fc19c8861" }, "layers": [ { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 2310272, "digest": "sha256:fae91920dcd4542f97c9350b3157139a5d901362c2abec284de5ebd1b45b4957" }, { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 913022, "digest": "sha256:f384f6ab36adad485192f09379c0b58dc612a3cde82c551e082a7c29a87c95da" }, { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 9861668, "digest": "sha256:ed0d2dd5e1a0e5e650a330a864c8a122e9aa91fa6ba9ac6f0bd1882e59df55e7" }, { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", "size": 465, "digest": "sha256:ec4d00b58417c45f7ddcfde7bcad8c9d62a7d6d5d17cdc1f7d79bcb2e22c1491" } ] }`, fail: false, }, } { got := digest.FromString(tt.manifest) if tt.digest != got { t.Errorf("test %d: expected digest %s but got %s", i, tt.digest, got) } manifest := convertFormats(tt.manifest) r := strings.NewReader(manifest) err := schema.ValidatorMediaTypeManifest.Validate(r) if got := err != nil; tt.fail != got { t.Errorf("test %d: expected validation failure %t but got %t, err %v", i, tt.fail, got, err) } } } func TestBackwardsCompatibilityConfig(t *testing.T) { for i, tt := range []struct { config string digest digest.Digest fail bool }{ // config pulled from docker hub blob store // // $ TOKEN=$(curl https://auth.docker.io/token\?service\=registry.docker.io\&scope\=repository:library/docker:pull | jq -r .token) // $ CONFIG_DIGEST=$(curl -H "Authorization: Bearer ${TOKEN}" -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' https://index.docker.io/v2/library/docker/manifests/1.12.1 | jq -r .config.digest) // $ curl -LH "Authorization: Bearer ${TOKEN}" https://index.docker.io/v2/library/docker/blobs/${CONFIG_DIGEST} { digest: "sha256:a059ea7356d5b5a9e0f6352bfa463e7bd4721c2ade3ef168603826e0de6fe54b", config: `{"architecture":"amd64","config":{"Hostname":"09713501c176","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","DOCKER_BUCKET=get.docker.com","DOCKER_VERSION=1.12.1","DOCKER_SHA256=05ceec7fd937e1416e5dce12b0b6e1c655907d349d52574319a1e875077ccb79"],"Cmd":["sh"],"Image":"sha256:32e2e3ccf2a4fbaa75b078bf539cd5ea2e374a4242665a5ec3f3c01e7a3eefb8","Volumes":null,"WorkingDir":"","Entrypoint":["docker-entrypoint.sh"],"OnBuild":[],"Labels":{}},"container":"15a30be053fb3069a7879b4ea537e84689d8e8e8ba94dc4dd499271506803ba1","container_config":{"Hostname":"09713501c176","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","DOCKER_BUCKET=get.docker.com","DOCKER_VERSION=1.12.1","DOCKER_SHA256=05ceec7fd937e1416e5dce12b0b6e1c655907d349d52574319a1e875077ccb79"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"sh\"]"],"Image":"sha256:32e2e3ccf2a4fbaa75b078bf539cd5ea2e374a4242665a5ec3f3c01e7a3eefb8","Volumes":null,"WorkingDir":"","Entrypoint":["docker-entrypoint.sh"],"OnBuild":[],"Labels":{}},"created":"2016-10-10T23:04:00.821781828Z","docker_version":"1.12.1","history":[{"created":"2016-09-23T16:29:57.276868291Z","created_by":"/bin/sh -c #(nop) ADD file:d6ee3ba7a4d59b161917082cc7242c660c61bb3f3cc1549c7e2dfff2b0de7104 in / "},{"created":"2016-09-23T16:36:54.024611637Z","created_by":"/bin/sh -c apk add --no-cache \t\tca-certificates \t\tcurl \t\topenssl"},{"created":"2016-09-23T16:36:54.365914519Z","created_by":"/bin/sh -c #(nop) ENV DOCKER_BUCKET=get.docker.com","empty_layer":true},{"created":"2016-09-23T16:36:54.662005049Z","created_by":"/bin/sh -c #(nop) ENV DOCKER_VERSION=1.12.1","empty_layer":true},{"created":"2016-09-23T16:36:54.946033025Z","created_by":"/bin/sh -c #(nop) ENV DOCKER_SHA256=05ceec7fd937e1416e5dce12b0b6e1c655907d349d52574319a1e875077ccb79","empty_layer":true},{"created":"2016-09-23T16:36:58.535084011Z","created_by":"/bin/sh -c set -x \t\u0026\u0026 curl -fSL \"https://${DOCKER_BUCKET}/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz\" -o docker.tgz \t\u0026\u0026 echo \"${DOCKER_SHA256} *docker.tgz\" | sha256sum -c - \t\u0026\u0026 tar -xzvf docker.tgz \t\u0026\u0026 mv docker/* /usr/local/bin/ \t\u0026\u0026 rmdir docker \t\u0026\u0026 rm docker.tgz \t\u0026\u0026 docker -v"},{"created":"2016-10-10T23:04:00.334158993Z","created_by":"/bin/sh -c #(nop) COPY file:399605dc1850a60a586b5494ab538bad495fd6f94eabca0c5f8a26468ce6030f in /usr/local/bin/ "},{"created":"2016-10-10T23:04:00.577900192Z","created_by":"/bin/sh -c #(nop) ENTRYPOINT [\"docker-entrypoint.sh\"]","empty_layer":true},{"created":"2016-10-10T23:04:00.821781828Z","created_by":"/bin/sh -c #(nop) CMD [\"sh\"]","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:9007f5987db353ec398a223bc5a135c5a9601798ba20a1abba537ea2f8ac765f","sha256:1b06990ff0df8dad281fad7e6e4c5e91f32f8f8c095d6c74cf1e90a6f4407e28","sha256:9d12251ce74aac7619a83641ab72431a8d82e58bcd8a262c2bb0cdb280f1f3b5","sha256:17a7f292c2427adfc75c3a789bab8efec925dc38c5437bf83d2f528013ab80e2"]}}`, fail: false, }, { // fedora:23 from docker hub // both Entrypoint and Cmd can be nullable digest: "sha256:a20665eb1fe2912accb3d5dadaed360430df0d1aa46874875886947d61d3d4ee", config: `{"architecture":"amd64","author":"Patrick Uiterwijk \u003cpatrick@puiterwijk.org\u003e","config":{"Hostname":"8dfe43d80430","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":null,"Image":"sha256:6986ae504bbf843512d680cc959484452034965db15f75ee8bdd1b107f61500b","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"container":"6249cd2c4b1d6b1bf05903364cbcb95781508994d6407c1564d494e748ea1b41","container_config":{"Hostname":"8dfe43d80430","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ADD file:293a6e463aa402bb8f80eb5cfc937f375cedc6843abaeb9eccfe3923bb3fc80b in /"],"Image":"sha256:6986ae504bbf843512d680cc959484452034965db15f75ee8bdd1b107f61500b","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"created":"2016-06-10T18:44:31.784795904Z","docker_version":"1.10.3","history":[{"created":"2016-06-10T18:44:03.360264073Z","author":"Patrick Uiterwijk \u003cpatrick@puiterwijk.org\u003e","created_by":"/bin/sh -c #(nop) MAINTAINER Patrick Uiterwijk \u003cpatrick@puiterwijk.org\u003e","empty_layer":true},{"created":"2016-06-10T18:44:31.784795904Z","author":"Patrick Uiterwijk \u003cpatrick@puiterwijk.org\u003e","created_by":"/bin/sh -c #(nop) ADD file:293a6e463aa402bb8f80eb5cfc937f375cedc6843abaeb9eccfe3923bb3fc80b in /"}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:d43f38155a799dc53d8fbb9f3bc11f51805f4027cd5c3d10b9823201cd5b9400"]}}`, fail: false, }, } { got := digest.FromString(tt.config) if tt.digest != got { t.Errorf("test %d: expected digest %s but got %s", i, tt.digest, got) } config := convertFormats(tt.config) r := strings.NewReader(config) err := schema.ValidatorMediaTypeImageConfig.Validate(r) if got := err != nil; tt.fail != got { t.Errorf("test %d: expected validation failure %t but got %t, err %v", i, tt.fail, got, err) } } } crun-1.16.1/libocispec/image-spec/schema/config_test.go0000664000000000000000000001325614160576556021206 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package schema_test import ( "strings" "testing" "github.com/opencontainers/image-spec/schema" ) func TestConfig(t *testing.T) { for i, tt := range []struct { config string fail bool }{ // expected failure: field "os" has numeric value, must be string { config: ` { "architecture": "amd64", "os": 123, "rootfs": { "diff_ids": [ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" ], "type": "layers" } } `, fail: true, }, // expected failure: field "variant" has numeric value, must be string { config: ` { "architecture": "arm64", "variant": 123, "os": "linux", "rootfs": { "diff_ids": [ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" ], "type": "layers" } } `, fail: true, }, // expected failure: field "config.User" has numeric value, must be string { config: ` { "created": "2015-10-31T22:22:56.015925234Z", "author": "Alyssa P. Hacker ", "architecture": "amd64", "os": "linux", "config": { "User": 1234 }, "rootfs": { "diff_ids": [ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" ], "type": "layers" } } `, fail: true, }, // expected failue: history has string value, must be an array { config: ` { "history": "should be an array", "architecture": "amd64", "os": 123, "rootfs": { "diff_ids": [ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" ], "type": "layers" } } `, fail: true, }, // expected failure: Env has numeric value, must be a string { config: ` { "architecture": "amd64", "os": 123, "config": { "Env": [ 7353 ] }, "rootfs": { "diff_ids": [ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" ], "type": "layers" } } `, fail: true, }, // expected failure: config.Volumes has string array, must be an object (string set) { config: ` { "architecture": "amd64", "os": 123, "config": { "Volumes": [ "/var/job-result-data", "/var/log/my-app-logs" ] }, "rootfs": { "diff_ids": [ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" ], "type": "layers" } } `, fail: true, }, // expected failue: invalid JSON { config: `invalid JSON`, fail: true, }, // valid config with optional fields { config: ` { "created": "2015-10-31T22:22:56.015925234Z", "author": "Alyssa P. Hacker ", "architecture": "arm64", "variant": "v8", "os": "linux", "config": { "User": "1:1", "ExposedPorts": { "8080/tcp": {} }, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "FOO=docker_is_a_really", "BAR=great_tool_you_know" ], "Entrypoint": [ "/bin/sh" ], "Cmd": [ "--foreground", "--config", "/etc/my-app.d/default.cfg" ], "Volumes": { "/var/job-result-data": {}, "/var/log/my-app-logs": {} }, "StopSignal": "SIGKILL", "WorkingDir": "/home/alice", "Labels": { "com.example.project.git.url": "https://example.com/project.git", "com.example.project.git.commit": "45a939b2999782a3f005621a8d0f29aa387e1d6b" } }, "rootfs": { "diff_ids": [ "sha256:9d3dd9504c685a304985025df4ed0283e47ac9ffa9bd0326fddf4d59513f0827", "sha256:2b689805fbd00b2db1df73fae47562faac1a626d5f61744bfe29946ecff5d73d" ], "type": "layers" }, "history": [ { "created": "2015-10-31T22:22:54.690851953Z", "created_by": "/bin/sh -c #(nop) ADD file:a3bc1e842b69636f9df5256c49c5374fb4eef1e281fe3f282c65fb853ee171c5 in /" }, { "created": "2015-10-31T22:22:55.613815829Z", "created_by": "/bin/sh -c #(nop) CMD [\"sh\"]", "empty_layer": true } ] } `, fail: false, }, // valid config with only required fields { config: ` { "architecture": "amd64", "os": "linux", "rootfs": { "diff_ids": [ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" ], "type": "layers" } } `, fail: false, }, // expected failure: Env is invalid { config: ` { "architecture": "amd64", "os": "linux", "config": { "Env": [ "foo" ] }, "rootfs": { "diff_ids": [ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" ], "type": "layers" } } `, fail: true, }, } { r := strings.NewReader(tt.config) err := schema.ValidatorMediaTypeImageConfig.Validate(r) if got := err != nil; tt.fail != got { t.Errorf("test %d: expected validation failure %t but got %t, err %v", i, tt.fail, got, err) } } } crun-1.16.1/libocispec/image-spec/schema/defs-descriptor.json0000664000000000000000000000151413677106243022327 0ustar0000000000000000{ "description": "Definitions particular to OpenContainer Descriptor Specification", "definitions": { "mediaType": { "id": "https://opencontainers.org/schema/image/descriptor/mediaType", "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}$" }, "digest": { "description": "the cryptographic checksum digest of the object, in the pattern ':'", "type": "string", "pattern": "^[a-z0-9]+(?:[+._-][a-z0-9]+)*:[a-zA-Z0-9=_-]+$" }, "urls": { "description": "a list of urls from which this object may be downloaded", "type": "array", "items": { "type": "string", "format": "uri" } }, "annotations": { "$ref": "defs.json#/definitions/mapStringString" } } } crun-1.16.1/libocispec/image-spec/schema/doc.go0000664000000000000000000000130713677106243017433 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Package schema defines the OCI image media types, schema definitions and validation functions. package schema crun-1.16.1/libocispec/image-spec/schema/schema.go0000664000000000000000000000664114265762063020136 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package schema import ( "embed" "net/http" v1 "github.com/opencontainers/image-spec/specs-go/v1" ) // Media types for the OCI image formats const ( ValidatorMediaTypeDescriptor Validator = v1.MediaTypeDescriptor ValidatorMediaTypeLayoutHeader Validator = v1.MediaTypeLayoutHeader ValidatorMediaTypeManifest Validator = v1.MediaTypeImageManifest ValidatorMediaTypeImageIndex Validator = v1.MediaTypeImageIndex ValidatorMediaTypeImageConfig Validator = v1.MediaTypeImageConfig ValidatorMediaTypeImageLayer unimplemented = v1.MediaTypeImageLayer ) var ( // fs stores the embedded http.FileSystem // having the OCI JSON schema files in root "/". //go:embed *.json fs embed.FS // schemaNamespaces is a set of URI prefixes which are treated as containing the schema files of fs. // This is necessary because *.json schema files in this directory use "id" and "$ref" attributes which evaluate to such URIs, e.g. // ./image-manifest-schema.json URI contains // "id": "https://opencontainers.org/schema/image/manifest", // and // "$ref": "content-descriptor.json" // which evaluates as a link to https://opencontainers.org/schema/image/content-descriptor.json . // // To support such links without accessing the network (and trying to load content which is not hosted at these URIs), // fsLoaderFactory accepts any URI starting with one of the schemaNamespaces below, // and uses _escFS to load them from the root of its in-memory filesystem tree. // // (Note that this must contain subdirectories before its parent directories for fsLoaderFactory.refContents to work.) schemaNamespaces = []string{ "https://opencontainers.org/schema/image/descriptor/", "https://opencontainers.org/schema/image/index/", "https://opencontainers.org/schema/image/manifest/", "https://opencontainers.org/schema/image/", "https://opencontainers.org/schema/descriptor/", "https://opencontainers.org/schema/", } // specs maps OCI schema media types to schema URIs. // These URIs are expected to be used only by fsLoaderFactory (which trims schemaNamespaces defined above) // and should never cause a network access. specs = map[Validator]string{ ValidatorMediaTypeDescriptor: "https://opencontainers.org/schema/content-descriptor.json", ValidatorMediaTypeLayoutHeader: "https://opencontainers.org/schema/image/image-layout-schema.json", ValidatorMediaTypeManifest: "https://opencontainers.org/schema/image/image-manifest-schema.json", ValidatorMediaTypeImageIndex: "https://opencontainers.org/schema/image/image-index-schema.json", ValidatorMediaTypeImageConfig: "https://opencontainers.org/schema/image/config-schema.json", } ) // FileSystem returns an in-memory filesystem including the schema files. // The schema files are located at the root directory. func FileSystem() http.FileSystem { return http.FS(fs) } crun-1.16.1/libocispec/image-spec/schema/imagelayout_test.go0000664000000000000000000000244213677106243022246 0ustar0000000000000000// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package schema_test import ( "strings" "testing" "github.com/opencontainers/image-spec/schema" ) func TestImageLayout(t *testing.T) { for i, tt := range []struct { imageLayout string fail bool }{ // expected faulure: imageLayoutVersion does not match pattern { imageLayout: ` { "imageLayoutVersion": 1.0.0 } `, fail: true, }, // validate layout { imageLayout: ` { "imageLayoutVersion": "1.0.0" } `, fail: false, }, } { r := strings.NewReader(tt.imageLayout) err := schema.ValidatorMediaTypeLayoutHeader.Validate(r) if got := err != nil; tt.fail != got { t.Errorf("test %d: expected validation failure %t but got %t, err %v", i, tt.fail, got, err) } } } crun-1.16.1/libocispec/image-spec/schema/image-manifest-schema.json0000644000000000000000000000241714432210717023347 0ustar0000000000000000{ "description": "OpenContainer Image Manifest Specification", "$schema": "http://json-schema.org/draft-04/schema#", "id": "https://opencontainers.org/schema/image/manifest", "type": "object", "properties": { "schemaVersion": { "description": "This field specifies the image manifest schema version as an integer", "id": "https://opencontainers.org/schema/image/manifest/schemaVersion", "type": "integer", "minimum": 2, "maximum": 2 }, "mediaType": { "description": "the mediatype of the referenced object", "$ref": "defs-descriptor.json#/definitions/mediaType" }, "artifactType": { "description": "the artifact mediatype of the referenced object", "$ref": "defs-descriptor.json#/definitions/mediaType" }, "config": { "$ref": "content-descriptor.json" }, "subject": { "$ref": "content-descriptor.json" }, "layers": { "type": "array", "minItems": 1, "items": { "$ref": "content-descriptor.json" } }, "annotations": { "id": "https://opencontainers.org/schema/image/manifest/annotations", "$ref": "defs-descriptor.json#/definitions/annotations" } }, "required": [ "schemaVersion", "config", "layers" ] } crun-1.16.1/libocispec/yajl/0000755000000000000000000000000014656670214014023 5ustar0000000000000000crun-1.16.1/libocispec/yajl/src/0000755000000000000000000000000014656670214014612 5ustar0000000000000000crun-1.16.1/libocispec/yajl/src/yajl_alloc.h0000664000000000000000000000234114025721605017065 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /** * \file yajl_alloc.h * default memory allocation routines for yajl which use malloc/realloc and * free */ #ifndef __YAJL_ALLOC_H__ #define __YAJL_ALLOC_H__ #include "api/yajl_common.h" #define YA_MALLOC(afs, sz) (afs)->malloc((afs)->ctx, (sz)) #define YA_FREE(afs, ptr) (afs)->free((afs)->ctx, (ptr)) #define YA_REALLOC(afs, ptr, sz) (afs)->realloc((afs)->ctx, (ptr), (sz)) void yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf); #endif crun-1.16.1/libocispec/yajl/src/yajl_bytestack.h0000664000000000000000000000451314025721605017767 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * A header only implementation of a simple stack of bytes, used in YAJL * to maintain parse state. */ #ifndef __YAJL_BYTESTACK_H__ #define __YAJL_BYTESTACK_H__ #include "api/yajl_common.h" #define YAJL_BS_INC 128 typedef struct yajl_bytestack_t { unsigned char * stack; size_t size; size_t used; yajl_alloc_funcs * yaf; } yajl_bytestack; /* initialize a bytestack */ #define yajl_bs_init(obs, _yaf) { \ (obs).stack = NULL; \ (obs).size = 0; \ (obs).used = 0; \ (obs).yaf = (_yaf); \ } \ /* initialize a bytestack */ #define yajl_bs_free(obs) \ if ((obs).stack) (obs).yaf->free((obs).yaf->ctx, (obs).stack); #define yajl_bs_current(obs) \ (assert((obs).used > 0), (obs).stack[(obs).used - 1]) #define yajl_bs_push(obs, byte) { \ if (((obs).size - (obs).used) == 0) { \ (obs).size += YAJL_BS_INC; \ (obs).stack = (obs).yaf->realloc((obs).yaf->ctx,\ (void *) (obs).stack, (obs).size);\ } \ (obs).stack[((obs).used)++] = (byte); \ } /* removes the top item of the stack, returns nothing */ #define yajl_bs_pop(obs) { ((obs).used)--; } #define yajl_bs_set(obs, byte) \ (obs).stack[((obs).used) - 1] = (byte); #endif crun-1.16.1/libocispec/yajl/src/yajl_lex.h0000664000000000000000000001012614025721605016563 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __YAJL_LEX_H__ #define __YAJL_LEX_H__ #include "api/yajl_common.h" typedef enum { yajl_tok_bool, yajl_tok_colon, yajl_tok_comma, yajl_tok_eof, yajl_tok_error, yajl_tok_left_brace, yajl_tok_left_bracket, yajl_tok_null, yajl_tok_right_brace, yajl_tok_right_bracket, /* we differentiate between integers and doubles to allow the * parser to interpret the number without re-scanning */ yajl_tok_integer, yajl_tok_double, /* we differentiate between strings which require further processing, * and strings that do not */ yajl_tok_string, yajl_tok_string_with_escapes, /* comment tokens are not currently returned to the parser, ever */ yajl_tok_comment } yajl_tok; typedef struct yajl_lexer_t * yajl_lexer; yajl_lexer yajl_lex_alloc(yajl_alloc_funcs * alloc, unsigned int allowComments, unsigned int validateUTF8); void yajl_lex_free(yajl_lexer lexer); /** * run/continue a lex. "offset" is an input/output parameter. * It should be initialized to zero for a * new chunk of target text, and upon subsetquent calls with the same * target text should passed with the value of the previous invocation. * * the client may be interested in the value of offset when an error is * returned from the lexer. This allows the client to render useful * error messages. * * When you pass the next chunk of data, context should be reinitialized * to zero. * * Finally, the output buffer is usually just a pointer into the jsonText, * however in cases where the entity being lexed spans multiple chunks, * the lexer will buffer the entity and the data returned will be * a pointer into that buffer. * * This behavior is abstracted from client code except for the performance * implications which require that the client choose a reasonable chunk * size to get adequate performance. */ yajl_tok yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, size_t jsonTextLen, size_t * offset, const unsigned char ** outBuf, size_t * outLen); /** have a peek at the next token, but don't move the lexer forward */ yajl_tok yajl_lex_peek(yajl_lexer lexer, const unsigned char * jsonText, size_t jsonTextLen, size_t offset); typedef enum { yajl_lex_e_ok = 0, yajl_lex_string_invalid_utf8, yajl_lex_string_invalid_escaped_char, yajl_lex_string_invalid_json_char, yajl_lex_string_invalid_hex_char, yajl_lex_invalid_char, yajl_lex_invalid_string, yajl_lex_missing_integer_after_decimal, yajl_lex_missing_integer_after_exponent, yajl_lex_missing_integer_after_minus, yajl_lex_unallowed_comment } yajl_lex_error; const char * yajl_lex_error_to_string(yajl_lex_error error); /** allows access to more specific information about the lexical * error when yajl_lex_lex returns yajl_tok_error. */ yajl_lex_error yajl_lex_get_error(yajl_lexer lexer); /** get the current offset into the most recently lexed json string. */ size_t yajl_lex_current_offset(yajl_lexer lexer); /** get the number of lines lexed by this lexer instance */ size_t yajl_lex_current_line(yajl_lexer lexer); /** get the number of chars lexed by this lexer instance since the last * \n or \r */ size_t yajl_lex_current_char(yajl_lexer lexer); #endif crun-1.16.1/libocispec/yajl/src/yajl_buf.h0000664000000000000000000000350314025721605016550 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __YAJL_BUF_H__ #define __YAJL_BUF_H__ #include "api/yajl_common.h" #include "yajl_alloc.h" /* * Implementation/performance notes. If this were moved to a header * only implementation using #define's where possible we might be * able to sqeeze a little performance out of the guy by killing function * call overhead. YMMV. */ /** * yajl_buf is a buffer with exponential growth. the buffer ensures that * you are always null padded. */ typedef struct yajl_buf_t * yajl_buf; /* allocate a new buffer */ yajl_buf yajl_buf_alloc(yajl_alloc_funcs * alloc); /* free the buffer */ void yajl_buf_free(yajl_buf buf); /* append a number of bytes to the buffer */ void yajl_buf_append(yajl_buf buf, const void * data, size_t len); /* empty the buffer */ void yajl_buf_clear(yajl_buf buf); /* get a pointer to the beginning of the buffer */ const unsigned char * yajl_buf_data(yajl_buf buf); /* get the length of the buffer */ size_t yajl_buf_len(yajl_buf buf); /* truncate the buffer */ void yajl_buf_truncate(yajl_buf buf, size_t len); #endif crun-1.16.1/libocispec/yajl/src/yajl_encode.h0000664000000000000000000000243014025721605017227 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __YAJL_ENCODE_H__ #define __YAJL_ENCODE_H__ #include "yajl_buf.h" #include "api/yajl_gen.h" void yajl_string_encode(const yajl_print_t printer, void * ctx, const unsigned char * str, size_t length, int escape_solidus); void yajl_string_decode(yajl_buf buf, const unsigned char * str, size_t length); int yajl_string_validate_utf8(const unsigned char * s, size_t len); #endif crun-1.16.1/libocispec/yajl/src/yajl_parser.h0000664000000000000000000000470014025721605017270 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __YAJL_PARSER_H__ #define __YAJL_PARSER_H__ #include "api/yajl_parse.h" #include "yajl_bytestack.h" #include "yajl_buf.h" #include "yajl_lex.h" typedef enum { yajl_state_start = 0, yajl_state_parse_complete, yajl_state_parse_error, yajl_state_lexical_error, yajl_state_map_start, yajl_state_map_sep, yajl_state_map_need_val, yajl_state_map_got_val, yajl_state_map_need_key, yajl_state_array_start, yajl_state_array_got_val, yajl_state_array_need_val, yajl_state_got_value, } yajl_state; struct yajl_handle_t { const yajl_callbacks * callbacks; void * ctx; yajl_lexer lexer; const char * parseError; /* the number of bytes consumed from the last client buffer, * in the case of an error this will be an error offset, in the * case of an error this can be used as the error offset */ size_t bytesConsumed; /* temporary storage for decoded strings */ yajl_buf decodeBuf; /* a stack of states. access with yajl_state_XXX routines */ yajl_bytestack stateStack; /* memory allocation routines */ yajl_alloc_funcs alloc; /* bitfield */ unsigned int flags; }; yajl_status yajl_do_parse(yajl_handle handle, const unsigned char * jsonText, size_t jsonTextLen); yajl_status yajl_do_finish(yajl_handle handle); unsigned char * yajl_render_error_string(yajl_handle hand, const unsigned char * jsonText, size_t jsonTextLen, int verbose); /* A little built in integer parsing routine with the same semantics as strtol * that's unaffected by LOCALE. */ long long yajl_parse_integer(const unsigned char *number, unsigned int length); #endif crun-1.16.1/libocispec/yajl/src/yajl_alloc.c0000664000000000000000000000275014025721605017064 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /** * \file yajl_alloc.h * default memory allocation routines for yajl which use malloc/realloc and * free */ #include "yajl_alloc.h" #include static void * yajl_internal_malloc(void *ctx, size_t sz) { (void)ctx; return malloc(sz); } static void * yajl_internal_realloc(void *ctx, void * previous, size_t sz) { (void)ctx; return realloc(previous, sz); } static void yajl_internal_free(void *ctx, void * ptr) { (void)ctx; free(ptr); } void yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf) { yaf->malloc = yajl_internal_malloc; yaf->free = yajl_internal_free; yaf->realloc = yajl_internal_realloc; yaf->ctx = NULL; } crun-1.16.1/libocispec/yajl/src/yajl.c0000664000000000000000000001152414025721605015711 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "api/yajl_parse.h" #include "yajl_lex.h" #include "yajl_parser.h" #include "yajl_alloc.h" #include #include #include #include const char * yajl_status_to_string(yajl_status stat) { const char * statStr = "unknown"; switch (stat) { case yajl_status_ok: statStr = "ok, no error"; break; case yajl_status_client_canceled: statStr = "client canceled parse"; break; case yajl_status_error: statStr = "parse error"; break; } return statStr; } yajl_handle yajl_alloc(const yajl_callbacks * callbacks, yajl_alloc_funcs * afs, void * ctx) { yajl_handle hand = NULL; yajl_alloc_funcs afsBuffer; /* first order of business is to set up memory allocation routines */ if (afs != NULL) { if (afs->malloc == NULL || afs->realloc == NULL || afs->free == NULL) { return NULL; } } else { yajl_set_default_alloc_funcs(&afsBuffer); afs = &afsBuffer; } hand = (yajl_handle) YA_MALLOC(afs, sizeof(struct yajl_handle_t)); /* copy in pointers to allocation routines */ memcpy((void *) &(hand->alloc), (void *) afs, sizeof(yajl_alloc_funcs)); hand->callbacks = callbacks; hand->ctx = ctx; hand->lexer = NULL; hand->bytesConsumed = 0; hand->decodeBuf = yajl_buf_alloc(&(hand->alloc)); hand->flags = 0; yajl_bs_init(hand->stateStack, &(hand->alloc)); yajl_bs_push(hand->stateStack, yajl_state_start); return hand; } int yajl_config(yajl_handle h, yajl_option opt, ...) { int rv = 1; va_list ap; va_start(ap, opt); switch(opt) { case yajl_allow_comments: case yajl_dont_validate_strings: case yajl_allow_trailing_garbage: case yajl_allow_multiple_values: case yajl_allow_partial_values: if (va_arg(ap, int)) h->flags |= opt; else h->flags &= ~opt; break; default: rv = 0; } va_end(ap); return rv; } void yajl_free(yajl_handle handle) { yajl_bs_free(handle->stateStack); yajl_buf_free(handle->decodeBuf); if (handle->lexer) { yajl_lex_free(handle->lexer); handle->lexer = NULL; } YA_FREE(&(handle->alloc), handle); } yajl_status yajl_parse(yajl_handle hand, const unsigned char * jsonText, size_t jsonTextLen) { yajl_status status; /* lazy allocation of the lexer */ if (hand->lexer == NULL) { hand->lexer = yajl_lex_alloc(&(hand->alloc), hand->flags & yajl_allow_comments, !(hand->flags & yajl_dont_validate_strings)); } status = yajl_do_parse(hand, jsonText, jsonTextLen); return status; } yajl_status yajl_complete_parse(yajl_handle hand) { /* The lexer is lazy allocated in the first call to parse. if parse is * never called, then no data was provided to parse at all. This is a * "premature EOF" error unless yajl_allow_partial_values is specified. * allocating the lexer now is the simplest possible way to handle this * case while preserving all the other semantics of the parser * (multiple values, partial values, etc). */ if (hand->lexer == NULL) { hand->lexer = yajl_lex_alloc(&(hand->alloc), hand->flags & yajl_allow_comments, !(hand->flags & yajl_dont_validate_strings)); } return yajl_do_finish(hand); } unsigned char * yajl_get_error(yajl_handle hand, int verbose, const unsigned char * jsonText, size_t jsonTextLen) { return yajl_render_error_string(hand, jsonText, jsonTextLen, verbose); } size_t yajl_get_bytes_consumed(yajl_handle hand) { if (!hand) return 0; else return hand->bytesConsumed; } void yajl_free_error(yajl_handle hand, unsigned char * str) { /* use memory allocation functions if set */ YA_FREE(&(hand->alloc), str); } /* XXX: add utility routines to parse from file */ crun-1.16.1/libocispec/yajl/src/yajl_gen.c0000664000000000000000000002534714025721605016552 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "api/yajl_gen.h" #include "yajl_buf.h" #include "yajl_encode.h" #include #include #include #include #include typedef enum { yajl_gen_start, yajl_gen_map_start, yajl_gen_map_key, yajl_gen_map_val, yajl_gen_array_start, yajl_gen_in_array, yajl_gen_complete, yajl_gen_error } yajl_gen_state; struct yajl_gen_t { unsigned int flags; unsigned int depth; const char * indentString; yajl_gen_state state[YAJL_MAX_DEPTH]; yajl_print_t print; void * ctx; /* yajl_buf */ /* memory allocation routines */ yajl_alloc_funcs alloc; }; int yajl_gen_config(yajl_gen g, yajl_gen_option opt, ...) { int rv = 1; va_list ap; va_start(ap, opt); switch(opt) { case yajl_gen_beautify: case yajl_gen_validate_utf8: case yajl_gen_escape_solidus: if (va_arg(ap, int)) g->flags |= opt; else g->flags &= ~opt; break; case yajl_gen_indent_string: { const char *indent = va_arg(ap, const char *); g->indentString = indent; for (; *indent; indent++) { if (*indent != '\n' && *indent != '\v' && *indent != '\f' && *indent != '\t' && *indent != '\r' && *indent != ' ') { g->indentString = NULL; rv = 0; } } break; } case yajl_gen_print_callback: yajl_buf_free(g->ctx); g->print = va_arg(ap, const yajl_print_t); g->ctx = va_arg(ap, void *); break; default: rv = 0; } va_end(ap); return rv; } yajl_gen yajl_gen_alloc(const yajl_alloc_funcs * afs) { yajl_gen g = NULL; yajl_alloc_funcs afsBuffer; /* first order of business is to set up memory allocation routines */ if (afs != NULL) { if (afs->malloc == NULL || afs->realloc == NULL || afs->free == NULL) { return NULL; } } else { yajl_set_default_alloc_funcs(&afsBuffer); afs = &afsBuffer; } g = (yajl_gen) YA_MALLOC(afs, sizeof(struct yajl_gen_t)); if (!g) return NULL; memset((void *) g, 0, sizeof(struct yajl_gen_t)); /* copy in pointers to allocation routines */ memcpy((void *) &(g->alloc), (void *) afs, sizeof(yajl_alloc_funcs)); g->print = (yajl_print_t)&yajl_buf_append; g->ctx = yajl_buf_alloc(&(g->alloc)); g->indentString = " "; return g; } void yajl_gen_reset(yajl_gen g, const char * sep) { g->depth = 0; memset((void *) &(g->state), 0, sizeof(g->state)); if (sep != NULL) g->print(g->ctx, sep, strlen(sep)); } void yajl_gen_free(yajl_gen g) { if (g->print == (yajl_print_t)&yajl_buf_append) yajl_buf_free((yajl_buf)g->ctx); YA_FREE(&(g->alloc), g); } #define INSERT_SEP \ if (g->state[g->depth] == yajl_gen_map_key || \ g->state[g->depth] == yajl_gen_in_array) { \ g->print(g->ctx, ",", 1); \ if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); \ } else if (g->state[g->depth] == yajl_gen_map_val) { \ g->print(g->ctx, ":", 1); \ if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, " ", 1); \ } #define INSERT_WHITESPACE \ if ((g->flags & yajl_gen_beautify)) { \ if (g->state[g->depth] != yajl_gen_map_val) { \ unsigned int _i; \ for (_i=0;_idepth;_i++) \ g->print(g->ctx, \ g->indentString, \ (unsigned int)strlen(g->indentString)); \ } \ } #define ENSURE_NOT_KEY \ if (g->state[g->depth] == yajl_gen_map_key || \ g->state[g->depth] == yajl_gen_map_start) { \ return yajl_gen_keys_must_be_strings; \ } \ /* check that we're not complete, or in error state. in a valid state * to be generating */ #define ENSURE_VALID_STATE \ if (g->state[g->depth] == yajl_gen_error) { \ return yajl_gen_in_error_state;\ } else if (g->state[g->depth] == yajl_gen_complete) { \ return yajl_gen_generation_complete; \ } #define INCREMENT_DEPTH \ if (++(g->depth) >= YAJL_MAX_DEPTH) return yajl_max_depth_exceeded; #define DECREMENT_DEPTH \ if (--(g->depth) >= YAJL_MAX_DEPTH) return yajl_gen_generation_complete; #define APPENDED_ATOM \ switch (g->state[g->depth]) { \ case yajl_gen_start: \ g->state[g->depth] = yajl_gen_complete; \ break; \ case yajl_gen_map_start: \ case yajl_gen_map_key: \ g->state[g->depth] = yajl_gen_map_val; \ break; \ case yajl_gen_array_start: \ g->state[g->depth] = yajl_gen_in_array; \ break; \ case yajl_gen_map_val: \ g->state[g->depth] = yajl_gen_map_key; \ break; \ default: \ break; \ } \ #define FINAL_NEWLINE \ if ((g->flags & yajl_gen_beautify) && g->state[g->depth] == yajl_gen_complete) \ g->print(g->ctx, "\n", 1); yajl_gen_status yajl_gen_integer(yajl_gen g, long long int number) { char i[32]; ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; sprintf(i, "%lld", number); g->print(g->ctx, i, (unsigned int)strlen(i)); APPENDED_ATOM; FINAL_NEWLINE; return yajl_gen_status_ok; } #if defined(_WIN32) || defined(WIN32) #include #define isnan _isnan #define isinf !_finite #endif yajl_gen_status yajl_gen_double(yajl_gen g, double number) { char i[32]; ENSURE_VALID_STATE; ENSURE_NOT_KEY; if (isnan(number) || isinf(number)) return yajl_gen_invalid_number; INSERT_SEP; INSERT_WHITESPACE; sprintf(i, "%.20g", number); if (strspn(i, "0123456789-") == strlen(i)) { strcat(i, ".0"); } g->print(g->ctx, i, (unsigned int)strlen(i)); APPENDED_ATOM; FINAL_NEWLINE; return yajl_gen_status_ok; } yajl_gen_status yajl_gen_number(yajl_gen g, const char * s, size_t l) { ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; g->print(g->ctx, s, l); APPENDED_ATOM; FINAL_NEWLINE; return yajl_gen_status_ok; } yajl_gen_status yajl_gen_string(yajl_gen g, const unsigned char * str, size_t len) { // if validation is enabled, check that the string is valid utf8 // XXX: This checking could be done a little faster, in the same pass as // the string encoding if (g->flags & yajl_gen_validate_utf8) { if (!yajl_string_validate_utf8(str, len)) { return yajl_gen_invalid_string; } } ENSURE_VALID_STATE; INSERT_SEP; INSERT_WHITESPACE; g->print(g->ctx, "\"", 1); yajl_string_encode(g->print, g->ctx, str, len, g->flags & yajl_gen_escape_solidus); g->print(g->ctx, "\"", 1); APPENDED_ATOM; FINAL_NEWLINE; return yajl_gen_status_ok; } yajl_gen_status yajl_gen_null(yajl_gen g) { ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; g->print(g->ctx, "null", strlen("null")); APPENDED_ATOM; FINAL_NEWLINE; return yajl_gen_status_ok; } yajl_gen_status yajl_gen_bool(yajl_gen g, int boolean) { const char * val = boolean ? "true" : "false"; ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; g->print(g->ctx, val, (unsigned int)strlen(val)); APPENDED_ATOM; FINAL_NEWLINE; return yajl_gen_status_ok; } yajl_gen_status yajl_gen_map_open(yajl_gen g) { ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; INCREMENT_DEPTH; g->state[g->depth] = yajl_gen_map_start; g->print(g->ctx, "{", 1); if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); FINAL_NEWLINE; return yajl_gen_status_ok; } yajl_gen_status yajl_gen_map_close(yajl_gen g) { ENSURE_VALID_STATE; DECREMENT_DEPTH; if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); APPENDED_ATOM; INSERT_WHITESPACE; g->print(g->ctx, "}", 1); FINAL_NEWLINE; return yajl_gen_status_ok; } yajl_gen_status yajl_gen_array_open(yajl_gen g) { ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; INCREMENT_DEPTH; g->state[g->depth] = yajl_gen_array_start; g->print(g->ctx, "[", 1); if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); FINAL_NEWLINE; return yajl_gen_status_ok; } yajl_gen_status yajl_gen_array_close(yajl_gen g) { ENSURE_VALID_STATE; DECREMENT_DEPTH; if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); APPENDED_ATOM; INSERT_WHITESPACE; g->print(g->ctx, "]", 1); FINAL_NEWLINE; return yajl_gen_status_ok; } yajl_gen_status yajl_gen_get_buf(yajl_gen g, const unsigned char ** buf, size_t * len) { if (g->print != (yajl_print_t)&yajl_buf_append) return yajl_gen_no_buf; *buf = yajl_buf_data((yajl_buf)g->ctx); *len = yajl_buf_len((yajl_buf)g->ctx); return yajl_gen_status_ok; } void yajl_gen_clear(yajl_gen g) { if (g->print == (yajl_print_t)&yajl_buf_append) yajl_buf_clear((yajl_buf)g->ctx); } crun-1.16.1/libocispec/yajl/src/yajl_parser.c0000664000000000000000000005053014025721605017265 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "api/yajl_parse.h" #include "yajl_lex.h" #include "yajl_parser.h" #include "yajl_encode.h" #include "yajl_bytestack.h" #include #include #include #include #include #include #include #include #define MAX_VALUE_TO_MULTIPLY ((LLONG_MAX / 10) + (LLONG_MAX % 10)) /* same semantics as strtol */ long long yajl_parse_integer(const unsigned char *number, unsigned int length) { long long ret = 0; long sign = 1; const unsigned char *pos = number; if (*pos == '-') { pos++; sign = -1; } if (*pos == '+') { pos++; } while (pos < number + length) { if ( ret > MAX_VALUE_TO_MULTIPLY ) { errno = ERANGE; return sign == 1 ? LLONG_MAX : LLONG_MIN; } ret *= 10; if (LLONG_MAX - ret < (*pos - '0')) { errno = ERANGE; return sign == 1 ? LLONG_MAX : LLONG_MIN; } if (*pos < '0' || *pos > '9') { errno = ERANGE; return sign == 1 ? LLONG_MAX : LLONG_MIN; } ret += (*pos++ - '0'); } return sign * ret; } unsigned char * yajl_render_error_string(yajl_handle hand, const unsigned char * jsonText, size_t jsonTextLen, int verbose) { size_t offset = hand->bytesConsumed; unsigned char * str; const char * errorType = NULL; const char * errorText = NULL; char text[72]; const char * arrow = " (right here) ------^\n"; if (yajl_bs_current(hand->stateStack) == yajl_state_parse_error) { errorType = "parse"; errorText = hand->parseError; } else if (yajl_bs_current(hand->stateStack) == yajl_state_lexical_error) { errorType = "lexical"; errorText = yajl_lex_error_to_string(yajl_lex_get_error(hand->lexer)); } else { errorType = "unknown"; } { size_t memneeded = 0; memneeded += strlen(errorType); memneeded += strlen(" error"); if (errorText != NULL) { memneeded += strlen(": "); memneeded += strlen(errorText); } str = (unsigned char *) YA_MALLOC(&(hand->alloc), memneeded + 2); if (!str) return NULL; str[0] = 0; strcat((char *) str, errorType); strcat((char *) str, " error"); if (errorText != NULL) { strcat((char *) str, ": "); strcat((char *) str, errorText); } strcat((char *) str, "\n"); } /* now we append as many spaces as needed to make sure the error * falls at char 41, if verbose was specified */ if (verbose) { size_t start, end, i; size_t spacesNeeded; spacesNeeded = (offset < 30 ? 40 - offset : 10); start = (offset >= 30 ? offset - 30 : 0); end = (offset + 30 > jsonTextLen ? jsonTextLen : offset + 30); for (i=0;ialloc), (unsigned int)(strlen((char *) str) + strlen((char *) text) + strlen(arrow) + 1)); if (newStr) { newStr[0] = 0; strcat((char *) newStr, (char *) str); strcat((char *) newStr, text); strcat((char *) newStr, arrow); } YA_FREE(&(hand->alloc), str); str = (unsigned char *) newStr; } } return str; } /* check for client cancelation */ #define _CC_CHK(x) \ if (!(x)) { \ yajl_bs_set(hand->stateStack, yajl_state_parse_error); \ hand->parseError = \ "client cancelled parse via callback return value"; \ return yajl_status_client_canceled; \ } yajl_status yajl_do_finish(yajl_handle hand) { yajl_status stat; stat = yajl_do_parse(hand,(const unsigned char *) " ",1); if (stat != yajl_status_ok) return stat; switch(yajl_bs_current(hand->stateStack)) { case yajl_state_parse_error: case yajl_state_lexical_error: return yajl_status_error; case yajl_state_got_value: case yajl_state_parse_complete: return yajl_status_ok; default: if (!(hand->flags & yajl_allow_partial_values)) { yajl_bs_set(hand->stateStack, yajl_state_parse_error); hand->parseError = "premature EOF"; return yajl_status_error; } return yajl_status_ok; } } yajl_status yajl_do_parse(yajl_handle hand, const unsigned char * jsonText, size_t jsonTextLen) { yajl_tok tok; const unsigned char * buf; size_t bufLen; size_t * offset = &(hand->bytesConsumed); *offset = 0; around_again: switch (yajl_bs_current(hand->stateStack)) { case yajl_state_parse_complete: if (hand->flags & yajl_allow_multiple_values) { yajl_bs_set(hand->stateStack, yajl_state_got_value); goto around_again; } if (!(hand->flags & yajl_allow_trailing_garbage)) { if (*offset != jsonTextLen) { tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen, offset, &buf, &bufLen); if (tok != yajl_tok_eof) { yajl_bs_set(hand->stateStack, yajl_state_parse_error); hand->parseError = "trailing garbage"; } goto around_again; } } return yajl_status_ok; case yajl_state_lexical_error: case yajl_state_parse_error: return yajl_status_error; case yajl_state_start: case yajl_state_got_value: case yajl_state_map_need_val: case yajl_state_array_need_val: case yajl_state_array_start: { /* for arrays and maps, we advance the state for this * depth, then push the state of the next depth. * If an error occurs during the parsing of the nesting * enitity, the state at this level will not matter. * a state that needs pushing will be anything other * than state_start */ yajl_state stateToPush = yajl_state_start; tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen, offset, &buf, &bufLen); switch (tok) { case yajl_tok_eof: return yajl_status_ok; case yajl_tok_error: yajl_bs_set(hand->stateStack, yajl_state_lexical_error); goto around_again; case yajl_tok_string: if (hand->callbacks && hand->callbacks->yajl_string) { _CC_CHK(hand->callbacks->yajl_string(hand->ctx, buf, bufLen)); } break; case yajl_tok_string_with_escapes: if (hand->callbacks && hand->callbacks->yajl_string) { yajl_buf_clear(hand->decodeBuf); yajl_string_decode(hand->decodeBuf, buf, bufLen); _CC_CHK(hand->callbacks->yajl_string( hand->ctx, yajl_buf_data(hand->decodeBuf), yajl_buf_len(hand->decodeBuf))); } break; case yajl_tok_bool: if (hand->callbacks && hand->callbacks->yajl_boolean) { _CC_CHK(hand->callbacks->yajl_boolean(hand->ctx, *buf == 't')); } break; case yajl_tok_null: if (hand->callbacks && hand->callbacks->yajl_null) { _CC_CHK(hand->callbacks->yajl_null(hand->ctx)); } break; case yajl_tok_left_bracket: if (hand->callbacks && hand->callbacks->yajl_start_map) { _CC_CHK(hand->callbacks->yajl_start_map(hand->ctx)); } stateToPush = yajl_state_map_start; break; case yajl_tok_left_brace: if (hand->callbacks && hand->callbacks->yajl_start_array) { _CC_CHK(hand->callbacks->yajl_start_array(hand->ctx)); } stateToPush = yajl_state_array_start; break; case yajl_tok_integer: if (hand->callbacks) { if (hand->callbacks->yajl_number) { _CC_CHK(hand->callbacks->yajl_number( hand->ctx,(const char *) buf, bufLen)); } else if (hand->callbacks->yajl_integer) { long long int i = 0; errno = 0; i = yajl_parse_integer(buf, bufLen); if ((i == LLONG_MIN || i == LLONG_MAX) && errno == ERANGE) { yajl_bs_set(hand->stateStack, yajl_state_parse_error); hand->parseError = "integer overflow" ; /* try to restore error offset */ if (*offset >= bufLen) *offset -= bufLen; else *offset = 0; goto around_again; } _CC_CHK(hand->callbacks->yajl_integer(hand->ctx, i)); } } break; case yajl_tok_double: if (hand->callbacks) { if (hand->callbacks->yajl_number) { _CC_CHK(hand->callbacks->yajl_number( hand->ctx, (const char *) buf, bufLen)); } else if (hand->callbacks->yajl_double) { double d = 0.0; yajl_buf_clear(hand->decodeBuf); yajl_buf_append(hand->decodeBuf, buf, bufLen); buf = yajl_buf_data(hand->decodeBuf); errno = 0; d = strtod((char *) buf, NULL); if ((d == HUGE_VAL || d == -HUGE_VAL) && errno == ERANGE) { yajl_bs_set(hand->stateStack, yajl_state_parse_error); hand->parseError = "numeric (floating point) " "overflow"; /* try to restore error offset */ if (*offset >= bufLen) *offset -= bufLen; else *offset = 0; goto around_again; } _CC_CHK(hand->callbacks->yajl_double(hand->ctx, d)); } } break; case yajl_tok_right_brace: { if (yajl_bs_current(hand->stateStack) == yajl_state_array_start) { if (hand->callbacks && hand->callbacks->yajl_end_array) { _CC_CHK(hand->callbacks->yajl_end_array(hand->ctx)); } yajl_bs_pop(hand->stateStack); goto around_again; } /* intentional fall-through */ __attribute__((fallthrough)); } case yajl_tok_colon: case yajl_tok_comma: case yajl_tok_right_bracket: yajl_bs_set(hand->stateStack, yajl_state_parse_error); hand->parseError = "unallowed token at this point in JSON text"; goto around_again; default: yajl_bs_set(hand->stateStack, yajl_state_parse_error); hand->parseError = "invalid token, internal error"; goto around_again; } /* got a value. transition depends on the state we're in. */ { yajl_state s = yajl_bs_current(hand->stateStack); if (s == yajl_state_start || s == yajl_state_got_value) { yajl_bs_set(hand->stateStack, yajl_state_parse_complete); } else if (s == yajl_state_map_need_val) { yajl_bs_set(hand->stateStack, yajl_state_map_got_val); } else { yajl_bs_set(hand->stateStack, yajl_state_array_got_val); } } if (stateToPush != yajl_state_start) { yajl_bs_push(hand->stateStack, stateToPush); } goto around_again; } case yajl_state_map_start: case yajl_state_map_need_key: { /* only difference between these two states is that in * start '}' is valid, whereas in need_key, we've parsed * a comma, and a string key _must_ follow */ tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen, offset, &buf, &bufLen); switch (tok) { case yajl_tok_eof: return yajl_status_ok; case yajl_tok_error: yajl_bs_set(hand->stateStack, yajl_state_lexical_error); goto around_again; case yajl_tok_string_with_escapes: if (hand->callbacks && hand->callbacks->yajl_map_key) { yajl_buf_clear(hand->decodeBuf); yajl_string_decode(hand->decodeBuf, buf, bufLen); buf = yajl_buf_data(hand->decodeBuf); bufLen = yajl_buf_len(hand->decodeBuf); } /* intentional fall-through */ __attribute__((fallthrough)); case yajl_tok_string: if (hand->callbacks && hand->callbacks->yajl_map_key) { _CC_CHK(hand->callbacks->yajl_map_key(hand->ctx, buf, bufLen)); } yajl_bs_set(hand->stateStack, yajl_state_map_sep); goto around_again; case yajl_tok_right_bracket: if (yajl_bs_current(hand->stateStack) == yajl_state_map_start) { if (hand->callbacks && hand->callbacks->yajl_end_map) { _CC_CHK(hand->callbacks->yajl_end_map(hand->ctx)); } yajl_bs_pop(hand->stateStack); goto around_again; } /* intentional fall-through */ __attribute__((fallthrough)); default: yajl_bs_set(hand->stateStack, yajl_state_parse_error); hand->parseError = "invalid object key (must be a string)"; goto around_again; } } case yajl_state_map_sep: { tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen, offset, &buf, &bufLen); switch (tok) { case yajl_tok_colon: yajl_bs_set(hand->stateStack, yajl_state_map_need_val); goto around_again; case yajl_tok_eof: return yajl_status_ok; case yajl_tok_error: yajl_bs_set(hand->stateStack, yajl_state_lexical_error); goto around_again; default: yajl_bs_set(hand->stateStack, yajl_state_parse_error); hand->parseError = "object key and value must " "be separated by a colon (':')"; goto around_again; } } case yajl_state_map_got_val: { tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen, offset, &buf, &bufLen); switch (tok) { case yajl_tok_right_bracket: if (hand->callbacks && hand->callbacks->yajl_end_map) { _CC_CHK(hand->callbacks->yajl_end_map(hand->ctx)); } yajl_bs_pop(hand->stateStack); goto around_again; case yajl_tok_comma: yajl_bs_set(hand->stateStack, yajl_state_map_need_key); goto around_again; case yajl_tok_eof: return yajl_status_ok; case yajl_tok_error: yajl_bs_set(hand->stateStack, yajl_state_lexical_error); goto around_again; default: yajl_bs_set(hand->stateStack, yajl_state_parse_error); hand->parseError = "after key and value, inside map, " "I expect ',' or '}'"; /* try to restore error offset */ if (*offset >= bufLen) *offset -= bufLen; else *offset = 0; goto around_again; } } case yajl_state_array_got_val: { tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen, offset, &buf, &bufLen); switch (tok) { case yajl_tok_right_brace: if (hand->callbacks && hand->callbacks->yajl_end_array) { _CC_CHK(hand->callbacks->yajl_end_array(hand->ctx)); } yajl_bs_pop(hand->stateStack); goto around_again; case yajl_tok_comma: yajl_bs_set(hand->stateStack, yajl_state_array_need_val); goto around_again; case yajl_tok_eof: return yajl_status_ok; case yajl_tok_error: yajl_bs_set(hand->stateStack, yajl_state_lexical_error); goto around_again; default: yajl_bs_set(hand->stateStack, yajl_state_parse_error); hand->parseError = "after array element, I expect ',' or ']'"; goto around_again; } } } abort(); return yajl_status_error; } crun-1.16.1/libocispec/yajl/src/yajl_buf.c0000664000000000000000000000506114265762063016555 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "yajl_buf.h" #include #include #include #define YAJL_BUF_INIT_SIZE 2048 struct yajl_buf_t { size_t len; size_t used; unsigned char * data; yajl_alloc_funcs * alloc; }; static int yajl_buf_ensure_available(yajl_buf buf, size_t want) { size_t need; assert(buf != NULL); /* first call */ if (buf->data == NULL) { buf->len = YAJL_BUF_INIT_SIZE; buf->data = (unsigned char *) YA_MALLOC(buf->alloc, buf->len); buf->data[0] = 0; } need = buf->len; while (want >= (need - buf->used)) need <<= 1; if (need < buf->used) { return -1; } if (need != buf->len) { buf->data = (unsigned char *) YA_REALLOC(buf->alloc, buf->data, need); buf->len = need; } return 0; } yajl_buf yajl_buf_alloc(yajl_alloc_funcs * alloc) { yajl_buf b = YA_MALLOC(alloc, sizeof(struct yajl_buf_t)); memset((void *) b, 0, sizeof(struct yajl_buf_t)); b->alloc = alloc; return b; } void yajl_buf_free(yajl_buf buf) { assert(buf != NULL); if (buf->data) YA_FREE(buf->alloc, buf->data); YA_FREE(buf->alloc, buf); } void yajl_buf_append(yajl_buf buf, const void * data, size_t len) { if (yajl_buf_ensure_available(buf, len)) return; if (len > 0) { assert(data != NULL); memcpy(buf->data + buf->used, data, len); buf->used += len; buf->data[buf->used] = 0; } } void yajl_buf_clear(yajl_buf buf) { buf->used = 0; if (buf->data) buf->data[buf->used] = 0; } const unsigned char * yajl_buf_data(yajl_buf buf) { return buf->data; } size_t yajl_buf_len(yajl_buf buf) { return buf->used; } void yajl_buf_truncate(yajl_buf buf, size_t len) { assert(len <= buf->used); buf->used = len; } crun-1.16.1/libocispec/yajl/src/yajl_encode.c0000664000000000000000000001615014025721605017226 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "yajl_encode.h" #include #include #include #include static void CharToHex(unsigned char c, char * hexBuf) { const char * hexchar = "0123456789ABCDEF"; hexBuf[0] = hexchar[c >> 4]; hexBuf[1] = hexchar[c & 0x0F]; } void yajl_string_encode(const yajl_print_t print, void * ctx, const unsigned char * str, size_t len, int escape_solidus) { size_t beg = 0; size_t end = 0; char hexBuf[7]; hexBuf[0] = '\\'; hexBuf[1] = 'u'; hexBuf[2] = '0'; hexBuf[3] = '0'; hexBuf[6] = 0; while (end < len) { const char * escaped = NULL; switch (str[end]) { case '\r': escaped = "\\r"; break; case '\n': escaped = "\\n"; break; case '\\': escaped = "\\\\"; break; /* it is not required to escape a solidus in JSON: * read sec. 2.5: http://www.ietf.org/rfc/rfc4627.txt * specifically, this production from the grammar: * unescaped = %x20-21 / %x23-5B / %x5D-10FFFF */ case '/': if (escape_solidus) escaped = "\\/"; break; case '"': escaped = "\\\""; break; case '\f': escaped = "\\f"; break; case '\b': escaped = "\\b"; break; case '\t': escaped = "\\t"; break; default: if ((unsigned char) str[end] < 32) { CharToHex(str[end], hexBuf + 4); escaped = hexBuf; } break; } if (escaped != NULL) { print(ctx, (const char *) (str + beg), end - beg); print(ctx, escaped, (unsigned int)strlen(escaped)); beg = ++end; } else { ++end; } } print(ctx, (const char *) (str + beg), end - beg); } static void hexToDigit(unsigned int * val, const unsigned char * hex) { unsigned int i; for (i=0;i<4;i++) { unsigned char c = hex[i]; if (c >= 'A') c = (c & ~0x20) - 7; c -= '0'; assert(!(c & 0xF0)); *val = (*val << 4) | c; } } static void Utf32toUtf8(unsigned int codepoint, char * utf8Buf) { if (codepoint < 0x80) { utf8Buf[0] = (char) codepoint; utf8Buf[1] = 0; } else if (codepoint < 0x0800) { utf8Buf[0] = (char) ((codepoint >> 6) | 0xC0); utf8Buf[1] = (char) ((codepoint & 0x3F) | 0x80); utf8Buf[2] = 0; } else if (codepoint < 0x10000) { utf8Buf[0] = (char) ((codepoint >> 12) | 0xE0); utf8Buf[1] = (char) (((codepoint >> 6) & 0x3F) | 0x80); utf8Buf[2] = (char) ((codepoint & 0x3F) | 0x80); utf8Buf[3] = 0; } else if (codepoint < 0x200000) { utf8Buf[0] =(char)((codepoint >> 18) | 0xF0); utf8Buf[1] =(char)(((codepoint >> 12) & 0x3F) | 0x80); utf8Buf[2] =(char)(((codepoint >> 6) & 0x3F) | 0x80); utf8Buf[3] =(char)((codepoint & 0x3F) | 0x80); utf8Buf[4] = 0; } else { utf8Buf[0] = '?'; utf8Buf[1] = 0; } } void yajl_string_decode(yajl_buf buf, const unsigned char * str, size_t len) { size_t beg = 0; size_t end = 0; while (end < len) { if (str[end] == '\\') { char utf8Buf[5]; const char * unescaped = "?"; yajl_buf_append(buf, str + beg, end - beg); switch (str[++end]) { case 'r': unescaped = "\r"; break; case 'n': unescaped = "\n"; break; case '\\': unescaped = "\\"; break; case '/': unescaped = "/"; break; case '"': unescaped = "\""; break; case 'f': unescaped = "\f"; break; case 'b': unescaped = "\b"; break; case 't': unescaped = "\t"; break; case 'u': { unsigned int codepoint = 0; hexToDigit(&codepoint, str + ++end); end+=3; /* check if this is a surrogate */ if ((codepoint & 0xFC00) == 0xD800) { end++; if (str[end] == '\\' && str[end + 1] == 'u') { unsigned int surrogate = 0; hexToDigit(&surrogate, str + end + 2); codepoint = (((codepoint & 0x3F) << 10) | ((((codepoint >> 6) & 0xF) + 1) << 16) | (surrogate & 0x3FF)); end += 5; } else { unescaped = "?"; break; } } Utf32toUtf8(codepoint, utf8Buf); unescaped = utf8Buf; if (codepoint == 0) { yajl_buf_append(buf, unescaped, 1); beg = ++end; continue; } break; } default: assert("this should never happen" == NULL); } yajl_buf_append(buf, unescaped, (unsigned int)strlen(unescaped)); beg = ++end; } else { end++; } } yajl_buf_append(buf, str + beg, end - beg); } #define ADV_PTR s++; if (!(len--)) return 0; int yajl_string_validate_utf8(const unsigned char * s, size_t len) { if (!len) return 1; if (!s) return 0; while (len--) { /* single byte */ if (*s <= 0x7f) { /* noop */ } /* two byte */ else if ((*s >> 5) == 0x6) { ADV_PTR; if (!((*s >> 6) == 0x2)) return 0; } /* three byte */ else if ((*s >> 4) == 0x0e) { ADV_PTR; if (!((*s >> 6) == 0x2)) return 0; ADV_PTR; if (!((*s >> 6) == 0x2)) return 0; } /* four byte */ else if ((*s >> 3) == 0x1e) { ADV_PTR; if (!((*s >> 6) == 0x2)) return 0; ADV_PTR; if (!((*s >> 6) == 0x2)) return 0; ADV_PTR; if (!((*s >> 6) == 0x2)) return 0; } else { return 0; } s++; } return 1; } crun-1.16.1/libocispec/yajl/src/yajl_lex.c0000664000000000000000000006313014025721605016561 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "yajl_lex.h" #include "yajl_buf.h" #include #include #include #include #ifdef YAJL_LEXER_DEBUG static const char * tokToStr(yajl_tok tok) { switch (tok) { case yajl_tok_bool: return "bool"; case yajl_tok_colon: return "colon"; case yajl_tok_comma: return "comma"; case yajl_tok_eof: return "eof"; case yajl_tok_error: return "error"; case yajl_tok_left_brace: return "brace"; case yajl_tok_left_bracket: return "bracket"; case yajl_tok_null: return "null"; case yajl_tok_integer: return "integer"; case yajl_tok_double: return "double"; case yajl_tok_right_brace: return "brace"; case yajl_tok_right_bracket: return "bracket"; case yajl_tok_string: return "string"; case yajl_tok_string_with_escapes: return "string_with_escapes"; } return "unknown"; } #endif /* Impact of the stream parsing feature on the lexer: * * YAJL support stream parsing. That is, the ability to parse the first * bits of a chunk of JSON before the last bits are available (still on * the network or disk). This makes the lexer more complex. The * responsibility of the lexer is to handle transparently the case where * a chunk boundary falls in the middle of a token. This is * accomplished is via a buffer and a character reading abstraction. * * Overview of implementation * * When we lex to end of input string before end of token is hit, we * copy all of the input text composing the token into our lexBuf. * * Every time we read a character, we do so through the readChar function. * readChar's responsibility is to handle pulling all chars from the buffer * before pulling chars from input text */ struct yajl_lexer_t { /* the overal line and char offset into the data */ size_t lineOff; size_t charOff; /* error */ yajl_lex_error error; /* a input buffer to handle the case where a token is spread over * multiple chunks */ yajl_buf buf; /* in the case where we have data in the lexBuf, bufOff holds * the current offset into the lexBuf. */ size_t bufOff; /* are we using the lex buf? */ unsigned int bufInUse; /* shall we allow comments? */ unsigned int allowComments; /* shall we validate utf8 inside strings? */ unsigned int validateUTF8; yajl_alloc_funcs * alloc; }; #define readChar(lxr, txt, off) \ (((lxr)->bufInUse && yajl_buf_len((lxr)->buf) && lxr->bufOff < yajl_buf_len((lxr)->buf)) ? \ (*((const unsigned char *) yajl_buf_data((lxr)->buf) + ((lxr)->bufOff)++)) : \ ((txt)[(*(off))++])) #define unreadChar(lxr, off) ((*(off) > 0) ? (*(off))-- : ((lxr)->bufOff--)) yajl_lexer yajl_lex_alloc(yajl_alloc_funcs * alloc, unsigned int allowComments, unsigned int validateUTF8) { yajl_lexer lxr = (yajl_lexer) YA_MALLOC(alloc, sizeof(struct yajl_lexer_t)); memset((void *) lxr, 0, sizeof(struct yajl_lexer_t)); lxr->buf = yajl_buf_alloc(alloc); lxr->allowComments = allowComments; lxr->validateUTF8 = validateUTF8; lxr->alloc = alloc; return lxr; } void yajl_lex_free(yajl_lexer lxr) { yajl_buf_free(lxr->buf); YA_FREE(lxr->alloc, lxr); return; } /* a lookup table which lets us quickly determine three things: * VEC - valid escaped control char * note. the solidus '/' may be escaped or not. * IJC - invalid json char * VHC - valid hex char * NFP - needs further processing (from a string scanning perspective) * NUC - needs utf8 checking when enabled (from a string scanning perspective) */ #define VEC 0x01 #define IJC 0x02 #define VHC 0x04 #define NFP 0x08 #define NUC 0x10 static const char charLookupTable[256] = { /*00*/ IJC , IJC , IJC , IJC , IJC , IJC , IJC , IJC , /*08*/ IJC , IJC , IJC , IJC , IJC , IJC , IJC , IJC , /*10*/ IJC , IJC , IJC , IJC , IJC , IJC , IJC , IJC , /*18*/ IJC , IJC , IJC , IJC , IJC , IJC , IJC , IJC , /*20*/ 0 , 0 , NFP|VEC|IJC, 0 , 0 , 0 , 0 , 0 , /*28*/ 0 , 0 , 0 , 0 , 0 , 0 , 0 , VEC , /*30*/ VHC , VHC , VHC , VHC , VHC , VHC , VHC , VHC , /*38*/ VHC , VHC , 0 , 0 , 0 , 0 , 0 , 0 , /*40*/ 0 , VHC , VHC , VHC , VHC , VHC , VHC , 0 , /*48*/ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , /*50*/ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , /*58*/ 0 , 0 , 0 , 0 , NFP|VEC|IJC, 0 , 0 , 0 , /*60*/ 0 , VHC , VEC|VHC, VHC , VHC , VHC , VEC|VHC, 0 , /*68*/ 0 , 0 , 0 , 0 , 0 , 0 , VEC , 0 , /*70*/ 0 , 0 , VEC , 0 , VEC , 0 , 0 , 0 , /*78*/ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC , NUC }; /** process a variable length utf8 encoded codepoint. * * returns: * yajl_tok_string - if valid utf8 char was parsed and offset was * advanced * yajl_tok_eof - if end of input was hit before validation could * complete * yajl_tok_error - if invalid utf8 was encountered * * NOTE: on error the offset will point to the first char of the * invalid utf8 */ #define UTF8_CHECK_EOF if (*offset >= jsonTextLen) { return yajl_tok_eof; } static yajl_tok yajl_lex_utf8_char(yajl_lexer lexer, const unsigned char * jsonText, size_t jsonTextLen, size_t * offset, unsigned char curChar) { if (curChar <= 0x7f) { /* single byte */ return yajl_tok_string; } else if ((curChar >> 5) == 0x6) { /* two byte */ UTF8_CHECK_EOF; curChar = readChar(lexer, jsonText, offset); if ((curChar >> 6) == 0x2) return yajl_tok_string; } else if ((curChar >> 4) == 0x0e) { /* three byte */ UTF8_CHECK_EOF; curChar = readChar(lexer, jsonText, offset); if ((curChar >> 6) == 0x2) { UTF8_CHECK_EOF; curChar = readChar(lexer, jsonText, offset); if ((curChar >> 6) == 0x2) return yajl_tok_string; } } else if ((curChar >> 3) == 0x1e) { /* four byte */ UTF8_CHECK_EOF; curChar = readChar(lexer, jsonText, offset); if ((curChar >> 6) == 0x2) { UTF8_CHECK_EOF; curChar = readChar(lexer, jsonText, offset); if ((curChar >> 6) == 0x2) { UTF8_CHECK_EOF; curChar = readChar(lexer, jsonText, offset); if ((curChar >> 6) == 0x2) return yajl_tok_string; } } } return yajl_tok_error; } /* lex a string. input is the lexer, pointer to beginning of * json text, and start of string (offset). * a token is returned which has the following meanings: * yajl_tok_string: lex of string was successful. offset points to * terminating '"'. * yajl_tok_eof: end of text was encountered before we could complete * the lex. * yajl_tok_error: embedded in the string were unallowable chars. offset * points to the offending char */ #define STR_CHECK_EOF \ if (*offset >= jsonTextLen) { \ tok = yajl_tok_eof; \ goto finish_string_lex; \ } /** scan a string for interesting characters that might need further * review. return the number of chars that are uninteresting and can * be skipped. * (lth) hi world, any thoughts on how to make this routine faster? */ static size_t yajl_string_scan(const unsigned char * buf, size_t len, int utf8check) { unsigned char mask = IJC|NFP|(utf8check ? NUC : 0); size_t skip = 0; while (skip < len && !(charLookupTable[*buf] & mask)) { skip++; buf++; } return skip; } static yajl_tok yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, size_t jsonTextLen, size_t * offset) { yajl_tok tok = yajl_tok_error; int hasEscapes = 0; for (;;) { unsigned char curChar; /* now jump into a faster scanning routine to skip as much * of the buffers as possible */ { const unsigned char * p; size_t len; if ((lexer->bufInUse && yajl_buf_len(lexer->buf) && lexer->bufOff < yajl_buf_len(lexer->buf))) { p = ((const unsigned char *) yajl_buf_data(lexer->buf) + (lexer->bufOff)); len = yajl_buf_len(lexer->buf) - lexer->bufOff; lexer->bufOff += yajl_string_scan(p, len, lexer->validateUTF8); } else if (*offset < jsonTextLen) { p = jsonText + *offset; len = jsonTextLen - *offset; *offset += yajl_string_scan(p, len, lexer->validateUTF8); } } STR_CHECK_EOF; curChar = readChar(lexer, jsonText, offset); /* quote terminates */ if (curChar == '"') { tok = yajl_tok_string; break; } /* backslash escapes a set of control chars, */ else if (curChar == '\\') { hasEscapes = 1; STR_CHECK_EOF; /* special case \u */ curChar = readChar(lexer, jsonText, offset); if (curChar == 'u') { unsigned int i = 0; for (i=0;i<4;i++) { STR_CHECK_EOF; curChar = readChar(lexer, jsonText, offset); if (!(charLookupTable[curChar] & VHC)) { /* back up to offending char */ unreadChar(lexer, offset); lexer->error = yajl_lex_string_invalid_hex_char; goto finish_string_lex; } } } else if (!(charLookupTable[curChar] & VEC)) { /* back up to offending char */ unreadChar(lexer, offset); lexer->error = yajl_lex_string_invalid_escaped_char; goto finish_string_lex; } } /* when not validating UTF8 it's a simple table lookup to determine * if the present character is invalid */ else if(charLookupTable[curChar] & IJC) { /* back up to offending char */ unreadChar(lexer, offset); lexer->error = yajl_lex_string_invalid_json_char; goto finish_string_lex; } /* when in validate UTF8 mode we need to do some extra work */ else if (lexer->validateUTF8) { yajl_tok t = yajl_lex_utf8_char(lexer, jsonText, jsonTextLen, offset, curChar); if (t == yajl_tok_eof) { tok = yajl_tok_eof; goto finish_string_lex; } else if (t == yajl_tok_error) { lexer->error = yajl_lex_string_invalid_utf8; goto finish_string_lex; } } /* accept it, and move on */ } finish_string_lex: /* tell our buddy, the parser, wether he needs to process this string * again */ if (hasEscapes && tok == yajl_tok_string) { tok = yajl_tok_string_with_escapes; } return tok; } #define RETURN_IF_EOF if (*offset >= jsonTextLen) return yajl_tok_eof; static yajl_tok yajl_lex_number(yajl_lexer lexer, const unsigned char * jsonText, size_t jsonTextLen, size_t * offset) { /** XXX: numbers are the only entities in json that we must lex * _beyond_ in order to know that they are complete. There * is an ambiguous case for integers at EOF. */ unsigned char c; yajl_tok tok = yajl_tok_integer; RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); /* optional leading minus */ if (c == '-') { RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); } /* a single zero, or a series of integers */ if (c == '0') { RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); } else if (c >= '1' && c <= '9') { do { RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); } while (c >= '0' && c <= '9'); } else { unreadChar(lexer, offset); lexer->error = yajl_lex_missing_integer_after_minus; return yajl_tok_error; } /* optional fraction (indicates this is floating point) */ if (c == '.') { int numRd = 0; RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); while (c >= '0' && c <= '9') { numRd++; RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); } if (!numRd) { unreadChar(lexer, offset); lexer->error = yajl_lex_missing_integer_after_decimal; return yajl_tok_error; } tok = yajl_tok_double; } /* optional exponent (indicates this is floating point) */ if (c == 'e' || c == 'E') { RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); /* optional sign */ if (c == '+' || c == '-') { RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); } if (c >= '0' && c <= '9') { do { RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); } while (c >= '0' && c <= '9'); } else { unreadChar(lexer, offset); lexer->error = yajl_lex_missing_integer_after_exponent; return yajl_tok_error; } tok = yajl_tok_double; } /* we always go "one too far" */ unreadChar(lexer, offset); return tok; } static yajl_tok yajl_lex_comment(yajl_lexer lexer, const unsigned char * jsonText, size_t jsonTextLen, size_t * offset) { unsigned char c; yajl_tok tok = yajl_tok_comment; RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); /* either slash or star expected */ if (c == '/') { /* now we throw away until end of line */ do { RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); } while (c != '\n'); } else if (c == '*') { /* now we throw away until end of comment */ for (;;) { RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); if (c == '*') { RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); if (c == '/') { break; } else { unreadChar(lexer, offset); } } } } else { lexer->error = yajl_lex_invalid_char; tok = yajl_tok_error; } return tok; } yajl_tok yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, size_t jsonTextLen, size_t * offset, const unsigned char ** outBuf, size_t * outLen) { yajl_tok tok = yajl_tok_error; unsigned char c; size_t startOffset = *offset; *outBuf = NULL; *outLen = 0; for (;;) { assert(*offset <= jsonTextLen); if (*offset >= jsonTextLen) { tok = yajl_tok_eof; goto lexed; } c = readChar(lexer, jsonText, offset); switch (c) { case '{': tok = yajl_tok_left_bracket; goto lexed; case '}': tok = yajl_tok_right_bracket; goto lexed; case '[': tok = yajl_tok_left_brace; goto lexed; case ']': tok = yajl_tok_right_brace; goto lexed; case ',': tok = yajl_tok_comma; goto lexed; case ':': tok = yajl_tok_colon; goto lexed; case '\t': case '\n': case '\v': case '\f': case '\r': case ' ': startOffset++; break; case 't': { const char * want = "rue"; do { if (*offset >= jsonTextLen) { tok = yajl_tok_eof; goto lexed; } c = readChar(lexer, jsonText, offset); if (c != *want) { unreadChar(lexer, offset); lexer->error = yajl_lex_invalid_string; tok = yajl_tok_error; goto lexed; } } while (*(++want)); tok = yajl_tok_bool; goto lexed; } case 'f': { const char * want = "alse"; do { if (*offset >= jsonTextLen) { tok = yajl_tok_eof; goto lexed; } c = readChar(lexer, jsonText, offset); if (c != *want) { unreadChar(lexer, offset); lexer->error = yajl_lex_invalid_string; tok = yajl_tok_error; goto lexed; } } while (*(++want)); tok = yajl_tok_bool; goto lexed; } case 'n': { const char * want = "ull"; do { if (*offset >= jsonTextLen) { tok = yajl_tok_eof; goto lexed; } c = readChar(lexer, jsonText, offset); if (c != *want) { unreadChar(lexer, offset); lexer->error = yajl_lex_invalid_string; tok = yajl_tok_error; goto lexed; } } while (*(++want)); tok = yajl_tok_null; goto lexed; } case '"': { tok = yajl_lex_string(lexer, (const unsigned char *) jsonText, jsonTextLen, offset); goto lexed; } case '-': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { /* integer parsing wants to start from the beginning */ unreadChar(lexer, offset); tok = yajl_lex_number(lexer, (const unsigned char *) jsonText, jsonTextLen, offset); goto lexed; } case '/': /* hey, look, a probable comment! If comments are disabled * it's an error. */ if (!lexer->allowComments) { unreadChar(lexer, offset); lexer->error = yajl_lex_unallowed_comment; tok = yajl_tok_error; goto lexed; } /* if comments are enabled, then we should try to lex * the thing. possible outcomes are * - successful lex (tok_comment, which means continue), * - malformed comment opening (slash not followed by * '*' or '/') (tok_error) * - eof hit. (tok_eof) */ tok = yajl_lex_comment(lexer, (const unsigned char *) jsonText, jsonTextLen, offset); if (tok == yajl_tok_comment) { /* "error" is silly, but that's the initial * state of tok. guilty until proven innocent. */ tok = yajl_tok_error; yajl_buf_clear(lexer->buf); lexer->bufInUse = 0; startOffset = *offset; break; } /* hit error or eof, bail */ goto lexed; default: lexer->error = yajl_lex_invalid_char; tok = yajl_tok_error; goto lexed; } } lexed: /* need to append to buffer if the buffer is in use or * if it's an EOF token */ if (tok == yajl_tok_eof || lexer->bufInUse) { if (!lexer->bufInUse) yajl_buf_clear(lexer->buf); lexer->bufInUse = 1; yajl_buf_append(lexer->buf, jsonText + startOffset, *offset - startOffset); lexer->bufOff = 0; if (tok != yajl_tok_eof) { *outBuf = yajl_buf_data(lexer->buf); *outLen = yajl_buf_len(lexer->buf); lexer->bufInUse = 0; } } else if (tok != yajl_tok_error) { *outBuf = jsonText + startOffset; *outLen = *offset - startOffset; } /* special case for strings. skip the quotes. */ if (tok == yajl_tok_string || tok == yajl_tok_string_with_escapes) { assert(*outLen >= 2); (*outBuf)++; *outLen -= 2; } #ifdef YAJL_LEXER_DEBUG if (tok == yajl_tok_error) { printf("lexical error: %s\n", yajl_lex_error_to_string(yajl_lex_get_error(lexer))); } else if (tok == yajl_tok_eof) { printf("EOF hit\n"); } else { printf("lexed %s: '", tokToStr(tok)); fwrite(*outBuf, 1, *outLen, stdout); printf("'\n"); } #endif return tok; } const char * yajl_lex_error_to_string(yajl_lex_error error) { switch (error) { case yajl_lex_e_ok: return "ok, no error"; case yajl_lex_string_invalid_utf8: return "invalid bytes in UTF8 string."; case yajl_lex_string_invalid_escaped_char: return "inside a string, '\\' occurs before a character " "which it may not."; case yajl_lex_string_invalid_json_char: return "invalid character inside string."; case yajl_lex_string_invalid_hex_char: return "invalid (non-hex) character occurs after '\\u' inside " "string."; case yajl_lex_invalid_char: return "invalid char in json text."; case yajl_lex_invalid_string: return "invalid string in json text."; case yajl_lex_missing_integer_after_exponent: return "malformed number, a digit is required after the exponent."; case yajl_lex_missing_integer_after_decimal: return "malformed number, a digit is required after the " "decimal point."; case yajl_lex_missing_integer_after_minus: return "malformed number, a digit is required after the " "minus sign."; case yajl_lex_unallowed_comment: return "probable comment found in input text, comments are " "not enabled."; } return "unknown error code"; } /** allows access to more specific information about the lexical * error when yajl_lex_lex returns yajl_tok_error. */ yajl_lex_error yajl_lex_get_error(yajl_lexer lexer) { if (lexer == NULL) return (yajl_lex_error) -1; return lexer->error; } size_t yajl_lex_current_line(yajl_lexer lexer) { return lexer->lineOff; } size_t yajl_lex_current_char(yajl_lexer lexer) { return lexer->charOff; } yajl_tok yajl_lex_peek(yajl_lexer lexer, const unsigned char * jsonText, size_t jsonTextLen, size_t offset) { const unsigned char * outBuf; size_t outLen; size_t bufLen = yajl_buf_len(lexer->buf); size_t bufOff = lexer->bufOff; unsigned int bufInUse = lexer->bufInUse; yajl_tok tok; tok = yajl_lex_lex(lexer, jsonText, jsonTextLen, &offset, &outBuf, &outLen); lexer->bufOff = bufOff; lexer->bufInUse = bufInUse; yajl_buf_truncate(lexer->buf, bufLen); return tok; } crun-1.16.1/libocispec/yajl/src/yajl_tree.c0000664000000000000000000003376114025721605016737 0ustar0000000000000000/* * Copyright (c) 2010-2011 Florian Forster * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include #include #include #include #include "api/yajl_tree.h" #include "api/yajl_parse.h" #include "yajl_parser.h" #if defined(_WIN32) || defined(WIN32) #define snprintf sprintf_s #endif #define STATUS_CONTINUE 1 #define STATUS_ABORT 0 struct stack_elem_s; typedef struct stack_elem_s stack_elem_t; struct stack_elem_s { char * key; yajl_val value; stack_elem_t *next; }; struct context_s { stack_elem_t *stack; yajl_val root; char *errbuf; size_t errbuf_size; }; typedef struct context_s context_t; #define RETURN_ERROR(ctx,retval,...) { \ if ((ctx)->errbuf != NULL) \ snprintf ((ctx)->errbuf, (ctx)->errbuf_size, __VA_ARGS__); \ return (retval); \ } static yajl_val value_alloc (yajl_type type) { yajl_val v; v = malloc (sizeof (*v)); if (v == NULL) return (NULL); memset (v, 0, sizeof (*v)); v->type = type; return (v); } static void yajl_object_free (yajl_val v) { size_t i; if (!YAJL_IS_OBJECT(v)) return; for (i = 0; i < v->u.object.len; i++) { free((char *) v->u.object.keys[i]); v->u.object.keys[i] = NULL; yajl_tree_free (v->u.object.values[i]); v->u.object.values[i] = NULL; } free((void*) v->u.object.keys); free(v->u.object.values); free(v); } static void yajl_array_free (yajl_val v) { size_t i; if (!YAJL_IS_ARRAY(v)) return; for (i = 0; i < v->u.array.len; i++) { yajl_tree_free (v->u.array.values[i]); v->u.array.values[i] = NULL; } free(v->u.array.values); free(v); } /* * Parsing nested objects and arrays is implemented using a stack. When a new * object or array starts (a curly or a square opening bracket is read), an * appropriate value is pushed on the stack. When the end of the object is * reached (an appropriate closing bracket has been read), the value is popped * off the stack and added to the enclosing object using "context_add_value". */ static int context_push(context_t *ctx, yajl_val v) { stack_elem_t *stack; stack = malloc (sizeof (*stack)); if (stack == NULL) RETURN_ERROR (ctx, ENOMEM, "Out of memory"); memset (stack, 0, sizeof (*stack)); assert ((ctx->stack == NULL) || YAJL_IS_OBJECT (v) || YAJL_IS_ARRAY (v)); stack->value = v; stack->next = ctx->stack; ctx->stack = stack; return (0); } static yajl_val context_pop(context_t *ctx) { stack_elem_t *stack; yajl_val v; if (ctx->stack == NULL) RETURN_ERROR (ctx, NULL, "context_pop: " "Bottom of stack reached prematurely"); stack = ctx->stack; ctx->stack = stack->next; v = stack->value; free (stack->key); free (stack); return (v); } static int object_add_keyval(context_t *ctx, yajl_val obj, char *key, yajl_val value) { const char **tmpk; yajl_val *tmpv; /* We're checking for NULL in "context_add_value" or its callers. */ assert (ctx != NULL); assert (obj != NULL); assert (key != NULL); assert (value != NULL); /* We're assuring that "obj" is an object in "context_add_value". */ assert(YAJL_IS_OBJECT(obj)); tmpk = realloc((void *) obj->u.object.keys, sizeof(*(obj->u.object.keys)) * (obj->u.object.len + 1)); if (tmpk == NULL) RETURN_ERROR(ctx, ENOMEM, "Out of memory"); obj->u.object.keys = tmpk; tmpv = realloc(obj->u.object.values, sizeof (*obj->u.object.values) * (obj->u.object.len + 1)); if (tmpv == NULL) RETURN_ERROR(ctx, ENOMEM, "Out of memory"); obj->u.object.values = tmpv; obj->u.object.keys[obj->u.object.len] = key; obj->u.object.values[obj->u.object.len] = value; obj->u.object.len++; return (0); } static int array_add_value (context_t *ctx, yajl_val array, yajl_val value) { yajl_val *tmp; /* We're checking for NULL pointers in "context_add_value" or its * callers. */ assert (ctx != NULL); assert (array != NULL); assert (value != NULL); /* "context_add_value" will only call us with array values. */ assert(YAJL_IS_ARRAY(array)); tmp = realloc(array->u.array.values, sizeof(*(array->u.array.values)) * (array->u.array.len + 1)); if (tmp == NULL) RETURN_ERROR(ctx, ENOMEM, "Out of memory"); array->u.array.values = tmp; array->u.array.values[array->u.array.len] = value; array->u.array.len++; return 0; } /* * Add a value to the value on top of the stack or the "root" member in the * context if the end of the parsing process is reached. */ static int context_add_value (context_t *ctx, yajl_val v) { /* We're checking for NULL values in all the calling functions. */ assert (ctx != NULL); assert (v != NULL); /* * There are three valid states in which this function may be called: * - There is no value on the stack => This is the only value. This is the * last step done when parsing a document. We assign the value to the * "root" member and return. * - The value on the stack is an object. In this case store the key on the * stack or, if the key has already been read, add key and value to the * object. * - The value on the stack is an array. In this case simply add the value * and return. */ if (ctx->stack == NULL) { assert (ctx->root == NULL); ctx->root = v; return (0); } else if (YAJL_IS_OBJECT (ctx->stack->value)) { if (ctx->stack->key == NULL) { if (!YAJL_IS_STRING (v)) RETURN_ERROR (ctx, EINVAL, "context_add_value: " "Object key is not a string (%#04x)", v->type); ctx->stack->key = v->u.string; v->u.string = NULL; free(v); return (0); } else /* if (ctx->key != NULL) */ { char * key; int ret; key = ctx->stack->key; ctx->stack->key = NULL; ret = object_add_keyval (ctx, ctx->stack->value, key, v); if (ret) ctx->stack->key = key; return ret; } } else if (YAJL_IS_ARRAY (ctx->stack->value)) { return (array_add_value (ctx, ctx->stack->value, v)); } else { RETURN_ERROR (ctx, EINVAL, "context_add_value: Cannot add value to " "a value of type %#04x (not a composite type)", ctx->stack->value->type); } } static int handle_string (void *ctx, const unsigned char *string, size_t string_length) { yajl_val v; v = value_alloc (yajl_t_string); if (v == NULL) RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, "Out of memory"); v->u.string = malloc (string_length + 1); if (v->u.string == NULL) { free (v); RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, "Out of memory"); } memcpy(v->u.string, string, string_length); v->u.string[string_length] = 0; if ((context_add_value (ctx, v) == 0)) return STATUS_CONTINUE; yajl_tree_free (v); return STATUS_ABORT; } static int handle_number (void *ctx, const char *string, size_t string_length) { yajl_val v; char *endptr; v = value_alloc(yajl_t_number); if (v == NULL) RETURN_ERROR((context_t *) ctx, STATUS_ABORT, "Out of memory"); v->u.number.r = malloc(string_length + 1); if (v->u.number.r == NULL) { free(v); RETURN_ERROR((context_t *) ctx, STATUS_ABORT, "Out of memory"); } memcpy(v->u.number.r, string, string_length); v->u.number.r[string_length] = 0; v->u.number.flags = 0; errno = 0; v->u.number.i = yajl_parse_integer((const unsigned char *) v->u.number.r, strlen(v->u.number.r)); if (errno == 0) v->u.number.flags |= YAJL_NUMBER_INT_VALID; endptr = NULL; errno = 0; v->u.number.d = strtod(v->u.number.r, &endptr); if ((errno == 0) && (endptr != NULL) && (*endptr == 0)) v->u.number.flags |= YAJL_NUMBER_DOUBLE_VALID; if ((context_add_value (ctx, v) == 0)) return STATUS_CONTINUE; yajl_tree_free (v); return STATUS_ABORT; } static int handle_start_map (void *ctx) { yajl_val v; v = value_alloc(yajl_t_object); if (v == NULL) RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, "Out of memory"); v->u.object.keys = NULL; v->u.object.values = NULL; v->u.object.len = 0; if ((context_push (ctx, v) == 0)) return STATUS_CONTINUE; yajl_tree_free (v); return STATUS_ABORT; } static int handle_end_map (void *ctx) { yajl_val v; v = context_pop (ctx); if (v == NULL) return (STATUS_ABORT); if ((context_add_value (ctx, v) == 0)) return STATUS_CONTINUE; yajl_tree_free (v); return STATUS_ABORT; } static int handle_start_array (void *ctx) { yajl_val v; v = value_alloc(yajl_t_array); if (v == NULL) RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, "Out of memory"); v->u.array.values = NULL; v->u.array.len = 0; if ((context_push (ctx, v) == 0)) return STATUS_CONTINUE; yajl_tree_free (v); return STATUS_ABORT; } static int handle_end_array (void *ctx) { yajl_val v; v = context_pop (ctx); if (v == NULL) return (STATUS_ABORT); if ((context_add_value (ctx, v) == 0)) return STATUS_CONTINUE; yajl_tree_free (v); return STATUS_ABORT; } static int handle_boolean (void *ctx, int boolean_value) { yajl_val v; v = value_alloc (boolean_value ? yajl_t_true : yajl_t_false); if (v == NULL) RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, "Out of memory"); if ((context_add_value (ctx, v) == 0)) return STATUS_CONTINUE; yajl_tree_free (v); return STATUS_ABORT; } static int handle_null (void *ctx) { yajl_val v; v = value_alloc (yajl_t_null); if (v == NULL) RETURN_ERROR ((context_t *) ctx, STATUS_ABORT, "Out of memory"); if ((context_add_value (ctx, v) == 0)) return STATUS_CONTINUE; yajl_tree_free (v); return STATUS_ABORT; } /* * Public functions */ yajl_val yajl_tree_parse (const char *input, char *error_buffer, size_t error_buffer_size) { static const yajl_callbacks callbacks = { /* null = */ handle_null, /* boolean = */ handle_boolean, /* integer = */ NULL, /* double = */ NULL, /* number = */ handle_number, /* string = */ handle_string, /* start map = */ handle_start_map, /* map key = */ handle_string, /* end map = */ handle_end_map, /* start array = */ handle_start_array, /* end array = */ handle_end_array }; yajl_handle handle; yajl_status status; char * internal_err_str; context_t ctx = { NULL, NULL, NULL, 0 }; ctx.errbuf = error_buffer; ctx.errbuf_size = error_buffer_size; if (error_buffer != NULL) memset (error_buffer, 0, error_buffer_size); handle = yajl_alloc (&callbacks, NULL, &ctx); yajl_config(handle, yajl_allow_comments, 1); status = yajl_parse(handle, (unsigned char *) input, strlen (input)); status = yajl_complete_parse (handle); if (status != yajl_status_ok) { if (error_buffer != NULL && error_buffer_size > 0) { internal_err_str = (char *) yajl_get_error(handle, 1, (const unsigned char *) input, strlen(input)); snprintf(error_buffer, error_buffer_size, "%s", internal_err_str); YA_FREE(&(handle->alloc), internal_err_str); } while(ctx.stack != NULL) { yajl_val v = context_pop(&ctx); yajl_tree_free(v); } yajl_tree_free(ctx.root); yajl_free (handle); return NULL; } yajl_free (handle); return (ctx.root); } yajl_val yajl_tree_get(yajl_val n, const char ** path, yajl_type type) { if (!path) return NULL; while (n && *path) { size_t i; size_t len; if (n->type != yajl_t_object) return NULL; len = n->u.object.len; for (i = 0; i < len; i++) { if (!strcmp(*path, n->u.object.keys[i])) { n = n->u.object.values[i]; break; } } if (i == len) return NULL; path++; } if (n && type != yajl_t_any && type != n->type) n = NULL; return n; } void yajl_tree_free (yajl_val v) { if (v == NULL) return; if (YAJL_IS_STRING(v)) { free(v->u.string); free(v); } else if (YAJL_IS_NUMBER(v)) { free(v->u.number.r); free(v); } else if (YAJL_GET_OBJECT(v)) { yajl_object_free(v); } else if (YAJL_GET_ARRAY(v)) { yajl_array_free(v); } else /* if (yajl_t_true or yajl_t_false or yajl_t_null) */ { free(v); } } crun-1.16.1/libocispec/yajl/src/headers/0000775000000000000000000000000014025721605016216 5ustar0000000000000000crun-1.16.1/libocispec/yajl/src/headers/yajl/0000775000000000000000000000000014025721605017155 5ustar0000000000000000crun-1.16.1/libocispec/yajl/src/headers/yajl/yajl_common.h0000664000000000000000000000000014025721605031635 1crun-1.16.1/libocispec/src/yajl/yajl_common.hustar0000000000000000crun-1.16.1/libocispec/yajl/src/headers/yajl/yajl_gen.h0000664000000000000000000000000014025721605030377 1crun-1.16.1/libocispec/src/yajl/yajl_gen.hustar0000000000000000crun-1.16.1/libocispec/yajl/src/headers/yajl/yajl_parse.h0000664000000000000000000000000014025721605031301 1crun-1.16.1/libocispec/src/yajl/yajl_parse.hustar0000000000000000crun-1.16.1/libocispec/yajl/src/headers/yajl/yajl_tree.h0000664000000000000000000000000014025721605030753 1crun-1.16.1/libocispec/src/yajl/yajl_tree.hustar0000000000000000crun-1.16.1/libocispec/yajl/src/headers/yajl/yajl_version.h.cmake0000664000000000000000000000000014025721605034365 1crun-1.16.1/libocispec/src/yajl/yajl_version.h.cmakeustar0000000000000000crun-1.16.1/libocispec/yajl/src/api/0000775000000000000000000000000014025721605015354 5ustar0000000000000000crun-1.16.1/libocispec/yajl/src/api/yajl_common.h0000664000000000000000000000000014025721605030034 1crun-1.16.1/libocispec/src/yajl/yajl_common.hustar0000000000000000crun-1.16.1/libocispec/yajl/src/api/yajl_gen.h0000664000000000000000000000000014025721605026576 1crun-1.16.1/libocispec/src/yajl/yajl_gen.hustar0000000000000000crun-1.16.1/libocispec/yajl/src/api/yajl_parse.h0000664000000000000000000000000014025721605027500 1crun-1.16.1/libocispec/src/yajl/yajl_parse.hustar0000000000000000crun-1.16.1/libocispec/yajl/src/api/yajl_tree.h0000664000000000000000000000000014025721605027152 1crun-1.16.1/libocispec/src/yajl/yajl_tree.hustar0000000000000000crun-1.16.1/libocispec/yajl/src/api/yajl_version.h.cmake0000664000000000000000000000000014025721605032564 1crun-1.16.1/libocispec/src/yajl/yajl_version.h.cmakeustar0000000000000000crun-1.16.1/libocispec/yajl/verify/0000755000000000000000000000000014656670214015327 5ustar0000000000000000crun-1.16.1/libocispec/yajl/verify/json_verify.c0000664000000000000000000001024614025721605020024 0ustar0000000000000000/* * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include #include #include #include #include #ifdef FUZZER int LLVMFuzzerInitialize(int *argc, char ***argv) { return 0; } int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len) { yajl_val tree; yajl_handle hand; char err[1024]; char *str = malloc(len+1); memcpy(str, buf, len); str[len] = '\0'; hand = yajl_alloc(NULL, NULL, NULL); yajl_parse(hand, buf, len); yajl_free(hand); /* make sure it is NUL terminated. */ tree = yajl_tree_parse(str, err, sizeof(err)); if (tree) yajl_tree_free(tree); free(str); return 0; } #endif static void usage(const char * progname) { fprintf(stderr, "%s: validate json from stdin\n" "usage: json_verify [options]\n" " -c allow comments\n" " -q quiet mode\n" " -s verify a stream of multiple json entities\n" " -u allow invalid utf8 inside strings\n", progname); exit(1); } int main(int argc, char ** argv) { yajl_status stat; size_t rd; yajl_handle hand; static unsigned char fileData[65536]; int quiet = 0; int retval = 0; int a = 1; #ifdef FUZZER if (getenv("VALIDATE_FUZZ")) { extern void HF_ITER(uint8_t** buf, size_t* len); for (;;) { size_t len; uint8_t *buf; HF_ITER(&buf, &len); LLVMFuzzerTestOneInput(buf, len); } } #endif /* allocate a parser */ hand = yajl_alloc(NULL, NULL, NULL); /* check arguments.*/ while ((a < argc) && (argv[a][0] == '-') && (strlen(argv[a]) > 1)) { unsigned int i; for ( i=1; i < strlen(argv[a]); i++) { switch (argv[a][i]) { case 'q': quiet = 1; break; case 'c': yajl_config(hand, yajl_allow_comments, 1); break; case 'u': yajl_config(hand, yajl_dont_validate_strings, 1); break; case 's': yajl_config(hand, yajl_allow_multiple_values, 1); break; default: fprintf(stderr, "unrecognized option: '%c'\n\n", argv[a][i]); usage(argv[0]); } } ++a; } if (a < argc) { usage(argv[0]); } for (;;) { rd = fread((void *) fileData, 1, sizeof(fileData) - 1, stdin); retval = 0; if (rd == 0) { if (!feof(stdin)) { if (!quiet) { fprintf(stderr, "error encountered on file read\n"); } retval = 1; } break; } fileData[rd] = 0; /* read file data, pass to parser */ stat = yajl_parse(hand, fileData, rd); if (stat != yajl_status_ok) break; } /* parse any remaining buffered data */ stat = yajl_complete_parse(hand); if (stat != yajl_status_ok) { if (!quiet) { unsigned char * str = yajl_get_error(hand, 1, fileData, rd); fprintf(stderr, "%s", (const char *) str); yajl_free_error(hand, str); } retval = 1; } yajl_free(hand); if (!quiet) { printf("JSON is %s\n", retval ? "invalid" : "valid"); } return retval; } crun-1.16.1/libocispec/yajl/Makefile.am0000664000000000000000000000116614025721605016054 0ustar0000000000000000noinst_LTLIBRARIES = libyajl.la EXTRA_DIST = src/headers src/api autogen.sh libyajl_la_CPPFLAGS = -DNDEBUG libyajl_la_CFLAGS = -I $(abs_srcdir)/src/headers libyajl_la_SOURCES = \ src/yajl_alloc.h \ src/yajl_bytestack.h \ src/yajl_lex.h \ src/yajl_buf.h \ src/yajl_encode.h \ src/yajl_parser.h \ src/yajl_alloc.c \ src/yajl.c \ src/yajl_gen.c \ src/yajl_parser.c \ src/yajl_buf.c \ src/yajl_encode.c \ src/yajl_lex.c \ src/yajl_tree.c noinst_PROGRAMS = verify/json_verify verify_json_verify_SOURCES = verify/json_verify.c verify_json_verify_CFLAGS = -I $(srcdir)/src/headers verify_json_verify_LDADD = libyajl.la crun-1.16.1/libocispec/yajl/configure0000755000000000000000000154357414656670144015757 0ustar0000000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for yajl 2.1.0. # # 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 -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 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 me@lloyd.io about $0: your system, including any error possibly output before $0: this message. Then install a modern shell, or manually $0: run the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='yajl' PACKAGE_TARNAME='yajl' PACKAGE_VERSION='2.1.0' PACKAGE_STRING='yajl 2.1.0' PACKAGE_BUGREPORT='me@lloyd.io' PACKAGE_URL='' ac_unique_file="src/yajl.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 POW_LIB LIBOBJS CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR 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 OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_silent_rules enable_maintainer_mode enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures yajl 2.1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/yajl] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of yajl 2.1.0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --disable-maintainer-mode disable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=no] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). 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 LT_SYS_LIBRARY_PATH User-defined run-time library search path. CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF yajl configure 2.1.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_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_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_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## -------------------------- ## ## Report this to me@lloyd.io ## ## -------------------------- ##" ) | 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_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type 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 yajl $as_me 2.1.0, 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 ac_config_headers="$ac_config_headers config.h" # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_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. # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # 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 # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='yajl' VERSION='2.1.0' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar plaintar pax cpio none' # The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether UID '$am_uid' is supported by ustar format" >&5 $as_echo_n "checking whether UID '$am_uid' is supported by ustar format... " >&6; } if test $am_uid -le $am_max_uid; 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; } _am_tools=none fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GID '$am_gid' is supported by ustar format" >&5 $as_echo_n "checking whether GID '$am_gid' is supported by ustar format... " >&6; } if test $am_gid -le $am_max_gid; 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; } _am_tools=none fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5 $as_echo_n "checking how to create a ustar tar archive... " >&6; } # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_ustar-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do { echo "$as_me:$LINENO: $_am_tar --version" >&5 ($_am_tar --version) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && break done am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"' am__tar_="$_am_tar --format=ustar -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 ustar -w "$$tardir"' am__tar_='pax -L -x ustar -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H ustar -L' am__tar_='find "$tardir" -print | cpio -o -H ustar -L' am__untar='cpio -i -H ustar -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_ustar}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5 (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -rf conftest.dir if test -s conftest.tar; then { echo "$as_me:$LINENO: $am__untar &5 ($am__untar &5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: cat conftest.dir/file" >&5 (cat conftest.dir/file) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } grep GrepMe conftest.dir/file >/dev/null 2>&1 && break fi done rm -rf conftest.dir if ${am_cv_prog_tar_ustar+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_prog_tar_ustar=$_am_tool fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5 $as_echo "$am_cv_prog_tar_ustar" >&6; } depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 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 fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=no fi enable_dlopen=no enable_win32_dll=no # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: # Checks for libraries. # Checks for header files. for ac_header in float.h limits.h stddef.h stdlib.h string.h sys/time.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi # Checks for library functions. for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if ${ac_cv_func_realloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "#define HAVE_REALLOC 1" >>confdefs.h else $as_echo "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac $as_echo "#define realloc rpl_realloc" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5 $as_echo_n "checking for working strtod... " >&6; } if ${ac_cv_func_strtod+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_strtod=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifndef strtod double strtod (); #endif int main() { { /* Some versions of Linux strtod mis-parse strings with leading '+'. */ char *string = " +69"; char *term; double value; value = strtod (string, &term); if (value != 69 || term != (string + 4)) return 1; } { /* Under Solaris 2.4, strtod returns the wrong value for the terminating character under some conditions. */ char *string = "NaN"; char *term; strtod (string, &term); if (term != string && *(term - 1) == 0) return 1; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strtod=yes else ac_cv_func_strtod=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 $as_echo "$ac_cv_func_strtod" >&6; } if test $ac_cv_func_strtod = no; then case " $LIBOBJS " in *" strtod.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strtod.$ac_objext" ;; esac ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" if test "x$ac_cv_func_pow" = xyes; then : fi if test $ac_cv_func_pow = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 $as_echo_n "checking for pow in -lm... " >&6; } if ${ac_cv_lib_m_pow+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pow (); int main () { return pow (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_pow=yes else ac_cv_lib_m_pow=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 $as_echo "$ac_cv_lib_m_pow" >&6; } if test "x$ac_cv_lib_m_pow" = xyes; then : POW_LIB=-lm else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5 $as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;} fi fi fi for ac_func in gettimeofday memset strspn do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -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 -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${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 yajl $as_me 2.1.0, 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="\\ yajl config.status 2.1.0 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" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi crun-1.16.1/libocispec/yajl/configure.ac0000664000000000000000000000131314025721605016300 0ustar0000000000000000AC_PREREQ([2.69]) AC_INIT([yajl], [2.1.0], [me@lloyd.io]) AC_CONFIG_SRCDIR([src/yajl.c]) AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CC AM_INIT_AUTOMAKE([1.11 -Wno-portability foreign tar-ustar no-dist-gzip dist-xz subdir-objects]) AM_MAINTAINER_MODE([enable]) AM_SILENT_RULES([yes]) LT_INIT([disable-shared]) # Checks for libraries. # Checks for header files. AC_CHECK_HEADERS([float.h limits.h stddef.h stdlib.h string.h sys/time.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_INLINE AC_TYPE_SIZE_T # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_REALLOC AC_FUNC_STRTOD AC_CHECK_FUNCS([gettimeofday memset strspn]) AC_CONFIG_FILES([ Makefile ]) AC_OUTPUT crun-1.16.1/libocispec/yajl/aclocal.m40000644000000000000000000133244514656670144015701 0ustar0000000000000000# generated automatically by aclocal 1.16.2 -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ]) # serial 58 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # Copyright (C) 2002-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' 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.16.2], [], [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.16.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _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. # This creates each '.Po' and '.Plo' makefile fragment that we'll 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" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR crun-1.16.1/libocispec/yajl/Makefile.in0000644000000000000000000012143514656670145016101 0ustar0000000000000000# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = verify/json_verify$(EXEEXT) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) LTLIBRARIES = $(noinst_LTLIBRARIES) libyajl_la_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp am_libyajl_la_OBJECTS = src/libyajl_la-yajl_alloc.lo \ src/libyajl_la-yajl.lo src/libyajl_la-yajl_gen.lo \ src/libyajl_la-yajl_parser.lo src/libyajl_la-yajl_buf.lo \ src/libyajl_la-yajl_encode.lo src/libyajl_la-yajl_lex.lo \ src/libyajl_la-yajl_tree.lo libyajl_la_OBJECTS = $(am_libyajl_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libyajl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libyajl_la_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_verify_json_verify_OBJECTS = \ verify/json_verify-json_verify.$(OBJEXT) verify_json_verify_OBJECTS = $(am_verify_json_verify_OBJECTS) verify_json_verify_DEPENDENCIES = libyajl.la verify_json_verify_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(verify_json_verify_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = src/$(DEPDIR)/libyajl_la-yajl.Plo \ src/$(DEPDIR)/libyajl_la-yajl_alloc.Plo \ src/$(DEPDIR)/libyajl_la-yajl_buf.Plo \ src/$(DEPDIR)/libyajl_la-yajl_encode.Plo \ src/$(DEPDIR)/libyajl_la-yajl_gen.Plo \ src/$(DEPDIR)/libyajl_la-yajl_lex.Plo \ src/$(DEPDIR)/libyajl_la-yajl_parser.Plo \ src/$(DEPDIR)/libyajl_la-yajl_tree.Plo \ verify/$(DEPDIR)/json_verify-json_verify.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libyajl_la_SOURCES) $(verify_json_verify_SOURCES) DIST_SOURCES = $(libyajl_la_SOURCES) $(verify_json_verify_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope AM_RECURSIVE_TARGETS = cscope am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in COPYING \ ChangeLog README TODO compile config.guess config.sub depcomp \ install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) GZIP_ENV = --best DIST_ARCHIVES = $(distdir).tar.xz DIST_TARGETS = dist-xz distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ 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_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libyajl.la EXTRA_DIST = src/headers src/api autogen.sh libyajl_la_CPPFLAGS = -DNDEBUG libyajl_la_CFLAGS = -I $(abs_srcdir)/src/headers libyajl_la_SOURCES = \ src/yajl_alloc.h \ src/yajl_bytestack.h \ src/yajl_lex.h \ src/yajl_buf.h \ src/yajl_encode.h \ src/yajl_parser.h \ src/yajl_alloc.c \ src/yajl.c \ src/yajl_gen.c \ src/yajl_parser.c \ src/yajl_buf.c \ src/yajl_encode.c \ src/yajl_lex.c \ src/yajl_tree.c verify_json_verify_SOURCES = verify/json_verify.c verify_json_verify_CFLAGS = -I $(srcdir)/src/headers verify_json_verify_LDADD = libyajl.la all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } src/$(am__dirstamp): @$(MKDIR_P) src @: > src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/$(DEPDIR) @: > src/$(DEPDIR)/$(am__dirstamp) src/libyajl_la-yajl_alloc.lo: src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/libyajl_la-yajl.lo: src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/libyajl_la-yajl_gen.lo: src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/libyajl_la-yajl_parser.lo: src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/libyajl_la-yajl_buf.lo: src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/libyajl_la-yajl_encode.lo: src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/libyajl_la-yajl_lex.lo: src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/libyajl_la-yajl_tree.lo: src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) libyajl.la: $(libyajl_la_OBJECTS) $(libyajl_la_DEPENDENCIES) $(EXTRA_libyajl_la_DEPENDENCIES) $(AM_V_CCLD)$(libyajl_la_LINK) $(libyajl_la_OBJECTS) $(libyajl_la_LIBADD) $(LIBS) verify/$(am__dirstamp): @$(MKDIR_P) verify @: > verify/$(am__dirstamp) verify/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) verify/$(DEPDIR) @: > verify/$(DEPDIR)/$(am__dirstamp) verify/json_verify-json_verify.$(OBJEXT): verify/$(am__dirstamp) \ verify/$(DEPDIR)/$(am__dirstamp) verify/json_verify$(EXEEXT): $(verify_json_verify_OBJECTS) $(verify_json_verify_DEPENDENCIES) $(EXTRA_verify_json_verify_DEPENDENCIES) verify/$(am__dirstamp) @rm -f verify/json_verify$(EXEEXT) $(AM_V_CCLD)$(verify_json_verify_LINK) $(verify_json_verify_OBJECTS) $(verify_json_verify_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f src/*.$(OBJEXT) -rm -f src/*.lo -rm -f verify/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libyajl_la-yajl.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libyajl_la-yajl_alloc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libyajl_la-yajl_buf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libyajl_la-yajl_encode.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libyajl_la-yajl_gen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libyajl_la-yajl_lex.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libyajl_la-yajl_parser.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libyajl_la-yajl_tree.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@verify/$(DEPDIR)/json_verify-json_verify.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< src/libyajl_la-yajl_alloc.lo: src/yajl_alloc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -MT src/libyajl_la-yajl_alloc.lo -MD -MP -MF src/$(DEPDIR)/libyajl_la-yajl_alloc.Tpo -c -o src/libyajl_la-yajl_alloc.lo `test -f 'src/yajl_alloc.c' || echo '$(srcdir)/'`src/yajl_alloc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libyajl_la-yajl_alloc.Tpo src/$(DEPDIR)/libyajl_la-yajl_alloc.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/yajl_alloc.c' object='src/libyajl_la-yajl_alloc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -c -o src/libyajl_la-yajl_alloc.lo `test -f 'src/yajl_alloc.c' || echo '$(srcdir)/'`src/yajl_alloc.c src/libyajl_la-yajl.lo: src/yajl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -MT src/libyajl_la-yajl.lo -MD -MP -MF src/$(DEPDIR)/libyajl_la-yajl.Tpo -c -o src/libyajl_la-yajl.lo `test -f 'src/yajl.c' || echo '$(srcdir)/'`src/yajl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libyajl_la-yajl.Tpo src/$(DEPDIR)/libyajl_la-yajl.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/yajl.c' object='src/libyajl_la-yajl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -c -o src/libyajl_la-yajl.lo `test -f 'src/yajl.c' || echo '$(srcdir)/'`src/yajl.c src/libyajl_la-yajl_gen.lo: src/yajl_gen.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -MT src/libyajl_la-yajl_gen.lo -MD -MP -MF src/$(DEPDIR)/libyajl_la-yajl_gen.Tpo -c -o src/libyajl_la-yajl_gen.lo `test -f 'src/yajl_gen.c' || echo '$(srcdir)/'`src/yajl_gen.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libyajl_la-yajl_gen.Tpo src/$(DEPDIR)/libyajl_la-yajl_gen.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/yajl_gen.c' object='src/libyajl_la-yajl_gen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -c -o src/libyajl_la-yajl_gen.lo `test -f 'src/yajl_gen.c' || echo '$(srcdir)/'`src/yajl_gen.c src/libyajl_la-yajl_parser.lo: src/yajl_parser.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -MT src/libyajl_la-yajl_parser.lo -MD -MP -MF src/$(DEPDIR)/libyajl_la-yajl_parser.Tpo -c -o src/libyajl_la-yajl_parser.lo `test -f 'src/yajl_parser.c' || echo '$(srcdir)/'`src/yajl_parser.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libyajl_la-yajl_parser.Tpo src/$(DEPDIR)/libyajl_la-yajl_parser.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/yajl_parser.c' object='src/libyajl_la-yajl_parser.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -c -o src/libyajl_la-yajl_parser.lo `test -f 'src/yajl_parser.c' || echo '$(srcdir)/'`src/yajl_parser.c src/libyajl_la-yajl_buf.lo: src/yajl_buf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -MT src/libyajl_la-yajl_buf.lo -MD -MP -MF src/$(DEPDIR)/libyajl_la-yajl_buf.Tpo -c -o src/libyajl_la-yajl_buf.lo `test -f 'src/yajl_buf.c' || echo '$(srcdir)/'`src/yajl_buf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libyajl_la-yajl_buf.Tpo src/$(DEPDIR)/libyajl_la-yajl_buf.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/yajl_buf.c' object='src/libyajl_la-yajl_buf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -c -o src/libyajl_la-yajl_buf.lo `test -f 'src/yajl_buf.c' || echo '$(srcdir)/'`src/yajl_buf.c src/libyajl_la-yajl_encode.lo: src/yajl_encode.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -MT src/libyajl_la-yajl_encode.lo -MD -MP -MF src/$(DEPDIR)/libyajl_la-yajl_encode.Tpo -c -o src/libyajl_la-yajl_encode.lo `test -f 'src/yajl_encode.c' || echo '$(srcdir)/'`src/yajl_encode.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libyajl_la-yajl_encode.Tpo src/$(DEPDIR)/libyajl_la-yajl_encode.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/yajl_encode.c' object='src/libyajl_la-yajl_encode.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -c -o src/libyajl_la-yajl_encode.lo `test -f 'src/yajl_encode.c' || echo '$(srcdir)/'`src/yajl_encode.c src/libyajl_la-yajl_lex.lo: src/yajl_lex.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -MT src/libyajl_la-yajl_lex.lo -MD -MP -MF src/$(DEPDIR)/libyajl_la-yajl_lex.Tpo -c -o src/libyajl_la-yajl_lex.lo `test -f 'src/yajl_lex.c' || echo '$(srcdir)/'`src/yajl_lex.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libyajl_la-yajl_lex.Tpo src/$(DEPDIR)/libyajl_la-yajl_lex.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/yajl_lex.c' object='src/libyajl_la-yajl_lex.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -c -o src/libyajl_la-yajl_lex.lo `test -f 'src/yajl_lex.c' || echo '$(srcdir)/'`src/yajl_lex.c src/libyajl_la-yajl_tree.lo: src/yajl_tree.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -MT src/libyajl_la-yajl_tree.lo -MD -MP -MF src/$(DEPDIR)/libyajl_la-yajl_tree.Tpo -c -o src/libyajl_la-yajl_tree.lo `test -f 'src/yajl_tree.c' || echo '$(srcdir)/'`src/yajl_tree.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libyajl_la-yajl_tree.Tpo src/$(DEPDIR)/libyajl_la-yajl_tree.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/yajl_tree.c' object='src/libyajl_la-yajl_tree.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libyajl_la_CPPFLAGS) $(CPPFLAGS) $(libyajl_la_CFLAGS) $(CFLAGS) -c -o src/libyajl_la-yajl_tree.lo `test -f 'src/yajl_tree.c' || echo '$(srcdir)/'`src/yajl_tree.c verify/json_verify-json_verify.o: verify/json_verify.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(verify_json_verify_CFLAGS) $(CFLAGS) -MT verify/json_verify-json_verify.o -MD -MP -MF verify/$(DEPDIR)/json_verify-json_verify.Tpo -c -o verify/json_verify-json_verify.o `test -f 'verify/json_verify.c' || echo '$(srcdir)/'`verify/json_verify.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) verify/$(DEPDIR)/json_verify-json_verify.Tpo verify/$(DEPDIR)/json_verify-json_verify.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='verify/json_verify.c' object='verify/json_verify-json_verify.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(verify_json_verify_CFLAGS) $(CFLAGS) -c -o verify/json_verify-json_verify.o `test -f 'verify/json_verify.c' || echo '$(srcdir)/'`verify/json_verify.c verify/json_verify-json_verify.obj: verify/json_verify.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(verify_json_verify_CFLAGS) $(CFLAGS) -MT verify/json_verify-json_verify.obj -MD -MP -MF verify/$(DEPDIR)/json_verify-json_verify.Tpo -c -o verify/json_verify-json_verify.obj `if test -f 'verify/json_verify.c'; then $(CYGPATH_W) 'verify/json_verify.c'; else $(CYGPATH_W) '$(srcdir)/verify/json_verify.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) verify/$(DEPDIR)/json_verify-json_verify.Tpo verify/$(DEPDIR)/json_verify-json_verify.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='verify/json_verify.c' object='verify/json_verify-json_verify.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(verify_json_verify_CFLAGS) $(CFLAGS) -c -o verify/json_verify-json_verify.obj `if test -f 'verify/json_verify.c'; then $(CYGPATH_W) 'verify/json_verify.c'; else $(CYGPATH_W) '$(srcdir)/verify/json_verify.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf src/.libs src/_libs -rm -rf verify/.libs verify/_libs distclean-libtool: -rm -f libtool config.lt ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 -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) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) config.h 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) -rm -f src/$(DEPDIR)/$(am__dirstamp) -rm -f src/$(am__dirstamp) -rm -f verify/$(DEPDIR)/$(am__dirstamp) -rm -f verify/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f src/$(DEPDIR)/libyajl_la-yajl.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_alloc.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_buf.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_encode.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_gen.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_lex.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_parser.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_tree.Plo -rm -f verify/$(DEPDIR)/json_verify-json_verify.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool 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 -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f src/$(DEPDIR)/libyajl_la-yajl.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_alloc.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_buf.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_encode.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_gen.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_lex.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_parser.Plo -rm -f src/$(DEPDIR)/libyajl_la-yajl_tree.Plo -rm -f verify/$(DEPDIR)/json_verify-json_verify.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: all install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles am--refresh check \ check-am clean clean-cscope clean-generic clean-libtool \ clean-noinstLTLIBRARIES clean-noinstPROGRAMS cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ dist-zstd distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: crun-1.16.1/libocispec/yajl/config.h.in0000644000000000000000000000544214656670144016055 0ustar0000000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if your system has a GNU libc compatible `realloc' function, and to 0 otherwise. */ #undef HAVE_REALLOC /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_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 `strspn' function. */ #undef HAVE_STRSPN /* 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_TIME_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 the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to rpl_realloc if the replacement function should be used. */ #undef realloc /* Define to `unsigned int' if does not define. */ #undef size_t crun-1.16.1/libocispec/yajl/COPYING0000664000000000000000000000135714025721605015055 0ustar0000000000000000Copyright (c) 2007-2014, Lloyd Hilaiel Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. crun-1.16.1/libocispec/yajl/ChangeLog0000664000000000000000000001675614025721605015605 0ustar00000000000000002.1.0 * @nonodename, @patperry - fixed some compiler warnings * @yep, @emaste - documentation improvements * @sgravrock - build fix for NetBSD (and whenever sh != bash) * @rotty, @brimstone3, @lloyd - allow client to reset generator * @sgravrock - remove bash dependencies * @lloyd - add api tests * @rflynn - remove ruby dependency * @cloderic - nmake install works on windows * @shahbag - build fix for qnx * @breese - debugging improvements * @lloyd - json_verify supports -s flag for stream processing * @lloyd - json_reformat supports -s flag for stream processing 2.0.4 * @jcekstrom - additional checking in integer parsing * @jcekstrom - fix a bug in yajl_tree that would cause valid json integersto fail to parse * @plaguemorin - fix a memory leak in yajl_tree (error strings were being leaked) * @7AC - reset errno * @ConradIrwin - include flags to reformatter to allow toggling of escape solidus option 2.0.3 * John Stamp generation of a pkgconfig file at build time. * @robzuber bugfix in yajl_tree_get() * @lloyd - fix for compilation on 64 bit windows 2.0.2 * lth fix typos in yajl_tree.h macros YAJL_IS_INTEGER and YAJL_IS_DOUBLE, contributed by Artem S Vybornov. * lth add #ifdef __cplusplus wrappers to yajl_tree to allow proper usage from many populer C++ compilers. 2.0.1 * lth generator flag to allow client to specify they want escaped solidi '/'. issue #28 * lth crash fix when yajl_parse() is never called. issue #27 2.0.0 * lth YAJL is now ISC licensed: http://en.wikipedia.org/wiki/ISC_license * lth 20-35% (osx and linux respectively) parsing performance improvement attained by tweaking string scanning (idea: @michaelrhanson). * Florian Forster & lth - yajl_tree interface introduced as a higher level interface to the parser (eats JSON, poops a memory representation) * lth require a C99 compiler * lth integers are now represented with long long (64bit+) on all platforms. * lth size_t now used throughout to represent buffer lengths, so you can safely manage buffers greater than 4GB. * gno semantic improvements to yajl's API regarding partial value parsing and trailing garbage * lth new configuration mechanism for yajl, see yajl_config() and yajl_gen_config() * gno more allocation checking in more places * gno remove usage of strtol, replace with custom implementation that cares not about your locale. * lth yajl_parse_complete renamed to yajl_complete_parse. * lth add a switch to validate utf8 strings as they are generated. * lth tests are a lot quieter in their output. * lth addition of a little in tree performance benchmark, `perftest` in perf/perftest.c 1.0.12 * Conrad Irwin - Parse null bytes correctly * Mirek Rusin - fix LLVM warnings * gno - Don't generate numbers for keys. closes #13 * lth - various win32 fixes, including build documentation improvements * John Stamp - Don't export private symbols. * John Stamp - Install yajl_version.h, not the template. * John Stamp - Don't use -fPIC for static lib. Cmake will automatically add it for the shared. * lth 0 fix paths embedded in dylib upon installation on osx. closes #11 1.0.11 * lth remove -Wno-missing-field-initializers for greater gcc compat (3.4.6) 1.0.10 * Brian Maher - yajl is now buildable without a c++ compiler present * Brian Maher - fix header installation on OSX with cmake 2.8.0 installed * lth & vitali - allow builder to specify alternate lib directory for installation (i.e. lib64) * Vitali Lovich - yajl version number now programatically accessible * lth - prevent cmake from embedding rpaths in binaries. Static linking makes this unneccesary. 1.0.9 * lth - fix inverted logic causing yajl_gen_double() to always fail on win32 (thanks to Fredrik Kihlander for the report) 1.0.8 * Randall E. Barker - move dllexport defnitions so dlls with proper exports can again be generated on windows * lth - add yajl_get_bytes_consumed() which allows the client to determine the offset as an error, as well as determine how many bytes of an input buffer were consumed. * lth - fixes to keep "error offset" up to date (like when the client callback returns 0) * Brian Maher - allow client to specify a printing function in generation 1.0.7 * lth fix win32 build (isinf and isnan) 1.0.6 * lth fix several compiler warnings * lth fix generation of invalid json from yajl_gen_double (NaN is not JSON) * jstamp support for combining short options in tools * jstamp exit properly on errors from tools * octo test success no longer depends on integer size * max fix configure --prefix 1.0.5 * lth several performance improvements related to function inlinin' 1.0.4 * lth fix broken utf8 validation for three & four byte represenations. thanks to http://github.com/brianmario and http://github.com/technoweenie 1.0.3 * lth fix syntax error in cplusplus extern "C" statements for wider compiler support 1.0.2 * lth update doxygen documentation with new sample code, passing NULL for allocation functions added in 1.0.0 1.0.1 * lth resolve crash in json_reformatter due to incorrectly ordered parameters. 1.0.0 * lth add 'make install' rules, thaks to Andrei Soroker for the contribution. * lth client may override allocation routines at generator or parser allocation time * tjw add yajl_parse_complete routine to allow client to explicitly specify end-of-input, solving the "lonely number" case, where json text consists only of an element with no explicit syntactic end. * tjw many new test cases * tjw cleanup of code for symmetry and ease of reading * lth integration of patches from Robert Varga which cleanup compilation warnings on 64 bit linux 0.4.0 * lth buffer overflow bug in yajl_gen_double s/%lf/%g/ - thanks to Eric Bergstrome * lth yajl_number callback to allow passthrough of arbitrary precision numbers to client. Thanks to Hatem Nassrat. * lth yajl_integer now deals in long, instead of long long. This combined with yajl_number improves compiler compatibility while maintaining precision. * lth better ./configure && make experience (still requires cmake and ruby) * lth fix handling of special characters hex 0F and 1F in yajl_encode (thanks to Robert Geiger) * lth allow leading zeros in exponents (thanks to Hatem Nassrat) 0.3.0 * lth doxygen documentation (html & man) generated as part of the build * lth many documentation updates. * lth fix to work with older versions of cmake (don't use LOOSE_LOOP constructs) * lth work around different behavior of freebsd 4 scanf. initialize parameter to scanf to zero. * lth all tests run 32x with ranging buffer sizes to stress stream parsing * lth yajl_test accepts -b option to allow read buffer size to be set * lth option to validate UTF8 added to parser (argument in yajl_parser_cfg) * lth fix buffer overrun when chunk ends inside \u escaped text * lth support client cancelation 0.2.2 * lth on windows build debug with C7 symbols and no pdb files. 0.2.1 * fix yajl_reformat and yajl_verify to work on arbitrarily sized inputs. * fix win32 build break, clean up all errors and warnings. * fix optimized build flags. 0.2.0 * optionally support comments in input text 0.1.0 * Initial release crun-1.16.1/libocispec/yajl/README0000664000000000000000000000536114025721605014701 0ustar0000000000000000********************************************************************** This is YAJL 2. For the legacy version of YAJL see https://github.com/lloyd/yajl/tree/1.x ********************************************************************** Welcome to Yet Another JSON Library (YAJL) ## Why does the world need another C library for parsing JSON? Good question. In a review of current C JSON parsing libraries I was unable to find one that satisfies my requirements. Those are, 0. written in C 1. portable 2. robust -- as close to "crash proof" as possible 3. data representation independent 4. fast 5. generates verbose, useful error messages including context of where the error occurs in the input text. 6. can parse JSON data off a stream, incrementally 7. simple to use 8. tiny Numbers 3, 5, 6, and 7 were particularly hard to find, and were what caused me to ultimately create YAJL. This document is a tour of some of the more important aspects of YAJL. ## YAJL is Free. Permissive licensing means you can use it in open source and commercial products alike without any fees. My request beyond the licensing is that if you find bugs drop me a email, or better yet, fork and fix. Porting YAJL should be trivial, the implementation is ANSI C. If you port to new systems I'd love to hear of it and integrate your patches. ## YAJL is data representation independent. BYODR! Many JSON libraries impose a structure based data representation on you. This is a benefit in some cases and a drawback in others. YAJL uses callbacks to remain agnostic of the in-memory representation. So if you wish to build up an in-memory representation, you may do so using YAJL, but you must bring the code that defines and populates the in memory structure. This also means that YAJL can be used by other (higher level) JSON libraries if so desired. ## YAJL supports stream parsing This means you do not need to hold the whole JSON representation in textual form in memory. This makes YAJL ideal for filtering projects, where you're converting YAJL from one form to another (i.e. XML). The included JSON pretty printer is an example of such a filter program. ## YAJL is fast Minimal memory copying is performed. YAJL, when possible, returns pointers into the client provided text (i.e. for strings that have no embedded escape chars, hopefully the common case). I've put a lot of effort into profiling and tuning performance, but I have ignored a couple possible performance improvements to keep the interface clean, small, and flexible. My hope is that YAJL will perform comparably to the fastest JSON parser out there. YAJL should impose both minimal CPU and memory requirements on your application. ## YAJL is tiny. Fat free. No whip. enjoy, Lloyd - July, 2007 crun-1.16.1/libocispec/yajl/TODO0000664000000000000000000000051414025721605014504 0ustar0000000000000000* add a test for 0x1F bug * numeric overflow in integers and double * line and char offsets in the lexer and in error messages * testing: a. the permuter b. some performance comparison against json_checker. * investigate pull instead of push parsing * Handle memory allocation failures gracefully * cygwin/msys support on win32 crun-1.16.1/libocispec/yajl/compile0000755000000000000000000001635014656670145015411 0ustar0000000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 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* | MSYS*) 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/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.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 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/libocispec/yajl/config.guess0000755000000000000000000012617314656670145016360 0ustar0000000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-08-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 1 2 13 15 trap 'exitcode=$?; test -z "$tmp" || rm -fr "$tmp"; exit $exitcode' 0 set_cc_for_build() { : "${TMPDIR=/tmp}" # shellcheck disable=SC2039 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$driver" break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) UNAME_REL="`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" case `isainfo -b` in 32) echo i386-pc-solaris2"$UNAME_REL" ;; 64) echo x86_64-pc-solaris2"$UNAME_REL" ;; esac exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi else echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf fi exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; *:Minix:*:*) echo "$UNAME_MACHINE"-unknown-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: crun-1.16.1/libocispec/yajl/config.sub0000755000000000000000000007530414656670145016022 0ustar0000000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-08-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type IFS="-" read -r field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 os=$maybe_os ;; android-linux) basic_machine=$field1-unknown os=linux-android ;; *) basic_machine=$field1-$field2 os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any patern case $field1-$field2 in decstation-3100) basic_machine=mips-dec os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 os= ;; *) basic_machine=$field1 os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc os=bsd ;; a29khif) basic_machine=a29k-amd os=udi ;; adobe68k) basic_machine=m68010-adobe os=scout ;; alliant) basic_machine=fx80-alliant os= ;; altos | altos3068) basic_machine=m68k-altos os= ;; am29k) basic_machine=a29k-none os=bsd ;; amdahl) basic_machine=580-amdahl os=sysv ;; amiga) basic_machine=m68k-unknown os= ;; amigaos | amigados) basic_machine=m68k-unknown os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=sysv4 ;; apollo68) basic_machine=m68k-apollo os=sysv ;; apollo68bsd) basic_machine=m68k-apollo os=bsd ;; aros) basic_machine=i386-pc os=aros ;; aux) basic_machine=m68k-apple os=aux ;; balance) basic_machine=ns32k-sequent os=dynix ;; blackfin) basic_machine=bfin-unknown os=linux ;; cegcc) basic_machine=arm-unknown os=cegcc ;; convex-c1) basic_machine=c1-convex os=bsd ;; convex-c2) basic_machine=c2-convex os=bsd ;; convex-c32) basic_machine=c32-convex os=bsd ;; convex-c34) basic_machine=c34-convex os=bsd ;; convex-c38) basic_machine=c38-convex os=bsd ;; cray) basic_machine=j90-cray os=unicos ;; crds | unos) basic_machine=m68k-crds os= ;; da30) basic_machine=m68k-da30 os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec os= ;; delta88) basic_machine=m88k-motorola os=sysv3 ;; dicos) basic_machine=i686-pc os=dicos ;; djgpp) basic_machine=i586-pc os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=ose ;; gmicro) basic_machine=tron-gmicro os=sysv ;; go32) basic_machine=i386-pc os=go32 ;; h8300hms) basic_machine=h8300-hitachi os=hms ;; h8300xray) basic_machine=h8300-hitachi os=xray ;; h8500hms) basic_machine=h8500-hitachi os=hms ;; harris) basic_machine=m88k-harris os=sysv3 ;; hp300) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=bsd ;; hp300hpux) basic_machine=m68k-hp os=hpux ;; hppaosf) basic_machine=hppa1.1-hp os=osf ;; hppro) basic_machine=hppa1.1-hp os=proelf ;; i386mach) basic_machine=i386-mach os=mach ;; vsta) basic_machine=i386-pc os=vsta ;; isi68 | isi) basic_machine=m68k-isi os=sysv ;; m68knommu) basic_machine=m68k-unknown os=linux ;; magnum | m3230) basic_machine=mips-mips os=sysv ;; merlin) basic_machine=ns32k-utek os=sysv ;; mingw64) basic_machine=x86_64-pc os=mingw64 ;; mingw32) basic_machine=i686-pc os=mingw32 ;; mingw32ce) basic_machine=arm-unknown os=mingw32ce ;; monitor) basic_machine=m68k-rom68k os=coff ;; morphos) basic_machine=powerpc-unknown os=morphos ;; moxiebox) basic_machine=moxie-unknown os=moxiebox ;; msdos) basic_machine=i386-pc os=msdos ;; msys) basic_machine=i686-pc os=msys ;; mvs) basic_machine=i370-ibm os=mvs ;; nacl) basic_machine=le32-unknown os=nacl ;; ncr3000) basic_machine=i486-ncr os=sysv4 ;; netbsd386) basic_machine=i386-pc os=netbsd ;; netwinder) basic_machine=armv4l-rebel os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=newsos ;; news1000) basic_machine=m68030-sony os=newsos ;; necv70) basic_machine=v70-nec os=sysv ;; nh3000) basic_machine=m68k-harris os=cxux ;; nh[45]000) basic_machine=m88k-harris os=cxux ;; nindy960) basic_machine=i960-intel os=nindy ;; mon960) basic_machine=i960-intel os=mon960 ;; nonstopux) basic_machine=mips-compaq os=nonstopux ;; os400) basic_machine=powerpc-ibm os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=ose ;; os68k) basic_machine=m68k-none os=os68k ;; paragon) basic_machine=i860-intel os=osf ;; parisc) basic_machine=hppa-unknown os=linux ;; pw32) basic_machine=i586-unknown os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=rdos ;; rdos32) basic_machine=i386-pc os=rdos ;; rom68k) basic_machine=m68k-rom68k os=coff ;; sa29200) basic_machine=a29k-amd os=udi ;; sei) basic_machine=mips-sei os=seiux ;; sequent) basic_machine=i386-sequent os= ;; sps7) basic_machine=m68k-bull os=sysv2 ;; st2000) basic_machine=m68k-tandem os= ;; stratus) basic_machine=i860-stratus os=sysv4 ;; sun2) basic_machine=m68000-sun os= ;; sun2os3) basic_machine=m68000-sun os=sunos3 ;; sun2os4) basic_machine=m68000-sun os=sunos4 ;; sun3) basic_machine=m68k-sun os= ;; sun3os3) basic_machine=m68k-sun os=sunos3 ;; sun3os4) basic_machine=m68k-sun os=sunos4 ;; sun4) basic_machine=sparc-sun os= ;; sun4os3) basic_machine=sparc-sun os=sunos3 ;; sun4os4) basic_machine=sparc-sun os=sunos4 ;; sun4sol2) basic_machine=sparc-sun os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun os= ;; sv1) basic_machine=sv1-cray os=unicos ;; symmetry) basic_machine=i386-sequent os=dynix ;; t3e) basic_machine=alphaev5-cray os=unicos ;; t90) basic_machine=t90-cray os=unicos ;; toad1) basic_machine=pdp10-xkl os=tops20 ;; tpf) basic_machine=s390x-ibm os=tpf ;; udi29k) basic_machine=a29k-amd os=udi ;; ultra3) basic_machine=a29k-nyu os=sym1 ;; v810 | necv810) basic_machine=v810-nec os=none ;; vaxv) basic_machine=vax-dec os=sysv ;; vms) basic_machine=vax-dec os=vms ;; vxworks960) basic_machine=i960-wrs os=vxworks ;; vxworks68) basic_machine=m68k-wrs os=vxworks ;; vxworks29k) basic_machine=a29k-wrs os=vxworks ;; xbox) basic_machine=i686-pc os=mingw32 ;; ymp) basic_machine=ymp-cray os=unicos ;; *) basic_machine=$1 os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi os=${os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray os=${os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $os in irix*) ;; *) os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony os=newsos ;; next | m*-next) cpu=m68k vendor=next case $os in nextstep* ) ;; ns2*) os=nextstep2 ;; *) os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde os=${os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) IFS="-" read -r cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x$os != x ] then case $os in # First match some system type aliases that might get confused # with valid system types. # solaris* is a basic system type, with this one exception. auroraux) os=auroraux ;; bluegene*) os=cnk ;; solaris1 | solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; solaris) os=solaris2 ;; unixware*) os=sysv4.2uw ;; gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) es1800*) os=ose ;; # Some version numbers need modification chorusos*) os=chorusos ;; isc) os=isc2.2 ;; sco6) os=sco5v6 ;; sco5) os=sco3.2v5 ;; sco4) os=sco3.2v4 ;; sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` ;; sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; scout) # Don't match below ;; sco*) os=sco3.2v2 ;; psos*) os=psos ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # sysv* is not here because it comes later, after sysvr4. gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | kopensolaris* | plan9* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | knetbsd* | mirbsd* | netbsd* \ | bitrig* | openbsd* | solidbsd* | libertybsd* \ | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ | chorusrdb* | cegcc* | glidix* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ | linux-newlib* | linux-musl* | linux-uclibc* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ | interix* | uwin* | mks* | rhapsody* | darwin* \ | openstep* | oskit* | conix* | pw32* | nonstopux* \ | storm-chaos* | tops10* | tenex* | tops20* | its* \ | os2* | vos* | palmos* | uclinux* | nucleus* \ | morphos* | superux* | rtmk* | windiss* \ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; qnx*) case $cpu in x86 | i*86) ;; *) os=nto-$os ;; esac ;; hiux*) os=hiuxwe2 ;; nto-qnx*) ;; nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; sim | xray | os68k* | v88r* \ | windows* | osx | abug | netware* | os9* \ | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) ;; linux-dietlibc) os=linux-dietlibc ;; linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; lynx*178) os=lynxos178 ;; lynx*5) os=lynxos5 ;; lynx*) os=lynxos ;; mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; opened*) os=openedition ;; os400*) os=os400 ;; sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; wince*) os=wince ;; utek*) os=bsd ;; dynix*) os=bsd ;; acis*) os=aos ;; atheos*) os=atheos ;; syllable*) os=syllable ;; 386bsd) os=bsd ;; ctix* | uts*) os=sysv ;; nova*) os=rtmk-nova ;; ns2) os=nextstep2 ;; nsk*) os=nsk ;; # Preserve the version number of sinix5. sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; sinix*) os=sysv4 ;; tpf*) os=tpf ;; triton*) os=sysv3 ;; oss*) os=sysv3 ;; svr4*) os=sysv4 ;; svr3) os=sysv3 ;; sysvr4) os=sysv4 ;; # This must come after sysvr4. sysv*) ;; ose*) os=ose ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) os=mint ;; zvmoe) os=zvmoe ;; dicos*) os=dicos ;; pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $cpu in arm*) os=eabi ;; *) os=elf ;; esac ;; nacl*) ;; ios) ;; none) ;; *-eabi) ;; *) echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $cpu-$vendor in score-*) os=elf ;; spu-*) os=elf ;; *-acorn) os=riscix1.2 ;; arm*-rebel) os=linux ;; arm*-semi) os=aout ;; c4x-* | tic4x-*) os=coff ;; c8051-*) os=elf ;; clipper-intergraph) os=clix ;; hexagon-*) os=elf ;; tic54x-*) os=coff ;; tic55x-*) os=coff ;; tic6x-*) os=coff ;; # This must come before the *-dec entry. pdp10-*) os=tops20 ;; pdp11-*) os=none ;; *-dec | vax-*) os=ultrix4.2 ;; m68*-apollo) os=domain ;; i386-sun) os=sunos4.0.2 ;; m68000-sun) os=sunos3 ;; m68*-cisco) os=aout ;; mep-*) os=elf ;; mips*-cisco) os=elf ;; mips*-*) os=elf ;; or32-*) os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=sysv3 ;; sparc-* | *-sun) os=sunos4.1.1 ;; pru-*) os=elf ;; *-be) os=beos ;; *-ibm) os=aix ;; *-knuth) os=mmixware ;; *-wec) os=proelf ;; *-winbond) os=proelf ;; *-oki) os=proelf ;; *-hp) os=hpux ;; *-hitachi) os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=sysv ;; *-cbm) os=amigaos ;; *-dg) os=dgux ;; *-dolphin) os=sysv3 ;; m68k-ccur) os=rtu ;; m88k-omron*) os=luna ;; *-next) os=nextstep ;; *-sequent) os=ptx ;; *-crds) os=unos ;; *-ns) os=genix ;; i370-*) os=mvs ;; *-gould) os=sysv ;; *-highlevel) os=bsd ;; *-encore) os=bsd ;; *-sgi) os=irix ;; *-siemens) os=sysv4 ;; *-masscomp) os=rtu ;; f30[01]-fujitsu | f700-fujitsu) os=uxpv ;; *-rom68k) os=coff ;; *-*bug) os=coff ;; *-apple) os=macos ;; *-atari*) os=mint ;; *-wrs) os=vxworks ;; *) os=none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $os in riscix*) vendor=acorn ;; sunos*) vendor=sun ;; cnk*|-aix*) vendor=ibm ;; beos*) vendor=be ;; hpux*) vendor=hp ;; mpeix*) vendor=hp ;; hiux*) vendor=hitachi ;; unos*) vendor=crds ;; dgux*) vendor=dg ;; luna*) vendor=omron ;; genix*) vendor=ns ;; clix*) vendor=intergraph ;; mvs* | opened*) vendor=ibm ;; os400*) vendor=ibm ;; ptx*) vendor=sequent ;; tpf*) vendor=ibm ;; vxsim* | vxworks* | windiss*) vendor=wrs ;; aux*) vendor=apple ;; hms*) vendor=hitachi ;; mpw* | macos*) vendor=apple ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) vendor=atari ;; vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: crun-1.16.1/libocispec/yajl/depcomp0000755000000000000000000005602014656670145015406 0ustar0000000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/libocispec/yajl/install-sh0000755000000000000000000003643514656670145016045 0ustar0000000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2018-03-11.20; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac 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. ;; *) # Note that $RANDOM variable is not portable (e.g. dash); Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p' feature. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_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 && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/libocispec/yajl/ltmain.sh0000644000000000000000000117106714656670143015661 0ustar0000000000000000#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.6 package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES 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 . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! 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 # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! 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 ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do eval $_G_hook '"$@"' # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ -specs=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: crun-1.16.1/libocispec/yajl/missing0000755000000000000000000001533614656670145015435 0ustar0000000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: crun-1.16.1/libocispec/yajl/autogen.sh0000775000000000000000000000061514025721605016017 0ustar0000000000000000#!/bin/sh git submodule update --init --recursive test -n "$srcdir" || srcdir=`dirname "$0"` test -n "$srcdir" || srcdir=. olddir=`pwd` cd $srcdir if ! (autoreconf --version >/dev/null 2>&1); then echo "*** No autoreconf found, please install it ***" exit 1 fi mkdir -p m4 autoreconf --force --install --verbose cd $olddir test -n "$NOCONFIGURE" || "$srcdir/configure" "$@" crun-1.16.1/.tarball-version0000644000000000000000000000000714656670214014052 0ustar00000000000000001.16.1 crun-1.16.1/.tarball-git-version.h0000644000000000000000000000016114656670214015062 0ustar0000000000000000/* autogenerated. */ #ifndef GIT_VERSION # define GIT_VERSION "afa829ca0122bd5e1d67f1f38e6cc348027e3c32" #endif